ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

R Tutorial : Aggregating log-returns

Автор: DataCamp

Загружено: 2020-03-11

Просмотров: 4693

Описание: Want to learn more? Take the full course at https://learn.datacamp.com/courses/qu... at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.

---

I remarked before that it is easy to aggregate shorter interval log-returns like daily returns to obtain longer-interval returns like weekly or monthly returns. Effectively you just add them up!

Why would you want to do this? Well, by aggregating returns you can study the risks over longer time horizons, such as a month, a quarter or a year.

There is some simple mathematics behind the aggregation of log-returns. Let's assume that the series (X_t) are daily log-returns calculated from daily risk-factor values (Z_t).

Let's assume further that (Z_t) is a price series for some asset that is traded on weekdays.

To get the log-return for a whole trading week starting on day t (effectively the previous Friday evening price before markets open on the Monday morning) and ending on day t+5 (Friday evening again) you would calculate the difference log(Z_{t+5}) - log(Z_t).

It can be shown that this is just the sum of the log-returns for each of the trading days.

And a similar calculation works for any aggregation period.

To do this in R you can use a set of functions in the xts package with names like apply.weekly and apply.monthly.

If the object sp500x is an xts object contains daily log-returns you obtain weekly returns by applying the sum function within the apply.weekly function. Note how the returns now have date stamps that are seven days apart.

Similarly to get monthly returns you apply the sum function within the apply.monthly function. Now the date stamps are the last days of each calendar month.

Note that if you have a multivariate time series containing, for example, multiple stock prices you have to apply the function colSums() instead of sum(). Look out for an example of that at the end of the next exercise.

So now it is time to practise aggregating log-return series.

#DataCamp #RTutorial #QuantitativeRiskManagementinR

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
R Tutorial : Aggregating log-returns

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

QuantBros.com Introduction to R Programming for Financial Timeseries

QuantBros.com Introduction to R Programming for Financial Timeseries

Log Returns in Finance: Continuous Compounding and Euler's Number (e) Explained

Log Returns in Finance: Continuous Compounding and Euler's Number (e) Explained

How to Calculate Stock Returns in R | Using Log Return Method

How to Calculate Stock Returns in R | Using Log Return Method

Forecasting in R

Forecasting in R

How to Compute Historical Stock Returns

How to Compute Historical Stock Returns

Portfolio Optimization With R

Portfolio Optimization With R

Garch Modelling in R

Garch Modelling in R

Introduction To Making Forecasts From Time-Series Models in R

Introduction To Making Forecasts From Time-Series Models in R

R readxl Range Tutorial with RStudio and R Package

R readxl Range Tutorial with RStudio and R Package

Задача из вступительных Стэнфорда

Задача из вступительных Стэнфорда

Программирование на R для АБСОЛЮТНЫХ новичков

Программирование на R для АБСОЛЮТНЫХ новичков

Time Series Analysis

Time Series Analysis

Volatility Modeling: GARCH Processes in R

Volatility Modeling: GARCH Processes in R

FRM: Why we use log returns in finance

FRM: Why we use log returns in finance

Обсуждение временных рядов: модель ARIMA

Обсуждение временных рядов: модель ARIMA

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

SHAZAM Top 50🏖️Лучшая Музыка 2025🏖️Зарубежные песни Хиты🏖️Популярные Песни Слушать Бесплатно #40

SHAZAM Top 50🏖️Лучшая Музыка 2025🏖️Зарубежные песни Хиты🏖️Популярные Песни Слушать Бесплатно #40

Российско-украинская война - на карте

Российско-украинская война - на карте

R Tutorial: The GARCH equation for volatility prediction

R Tutorial: The GARCH equation for volatility prediction

Getting Time Series from Excel to R

Getting Time Series from Excel to R

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]