Mixed Frequency VAR model

Hi, very new to R so was wondering if somebody could help me with the coding for my thesis as i've been struggling with this for some time now.

First post on here so forgive me if I miss anything/ not detailed enough etc.

Basically i wish to build a VAR model to analyse the relationship between my 'fear sentiment index' (which is constructed using gtrendsr on search volume for terms 'coronavirus' and 'covid-19') and four of my variables. Those four variables being bitcoin price, volume, vix index and s&p500. From January 14th 2020- August 31st 2021.

This is not an original idea i am following the methodology from this paper https://www.tandfonline.com/doi/full/10.1080/1540496X.2020.1787150?nav=undefined

My issue is that my variables have mixed frequencies such as daily including weekends, daily without weekends and weekly observations.

I have my dataset loaded in and i have the data for the google trends, but how do i go about making it into the var model.

Honestly i am rather clueless and desperate so would appreciate any and all help.

Thanks RStudio Community!

I recommend aggregating all your variables to a weekly frequency with a mean(). If some variables are weekly, then there's nothing you can do with the daily information that I'm aware of. Some pseudo code that might be useful.

data_for_var <- data %>%
# assume data is in long format, with variable stored in columns name, value
  mutate(week = floor_date(date, unit = "week")) %>%
  group_by(name, week) %>%
  summarize(value = mean(value, na.rm = TRUE)) %>%
  ungroup() %>%

Thank you for your suggestion and the pseudo code! I'm trying to avoid aggregating the data into weekly frequencies, however i may have no choice.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.