0

Beneath you see the structure of my data frame:

structure(list(d = c("01-04", "01-05"), total_sales = c(36617293.0434783, 
18450093.9263006), tickets_sold = c(343.201739130435, 352.793352601156
), show_time = c(4.60695652173913, 4.08815028901734), occu_perc = c(38.7728097731239, 
45.7586994219653), ticket_price = c(91159.6181864, 48409.6421884827
)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"
))

I have the following script & I would like to include an exogenous variable in my analysis:

  # Model Computation
v1 <- cbind(OccPerc, ShowTime, TicketPrice, TicketSold, TotalSales)
colnames(v1) <- cbind("OccPerc","ShowTime","TicketPrice", "TicketSold","TotalSales")
# Lag Selection
lagselect <- VARselect(v1, lag.max = 15, type = "const")
lagselect$selection
#VAR MODEL
Model1 <- VAR(v1, p = 1, type = "const", season = NULL, exog =  "TotalSales") 
summary(Model1)

Upon running the third line of the script, I receive the following error message:

  Error in VAR(v1, p = 1, type = "const", season = NULL, exog = "TotalSales") : 
  
Different row size of y and exogen.

How would I need to rectify the issue?

  • It would help greatly if you could provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Dion Groothof Jan 01 '22 at 22:42
  • 3
    Does this answer your question? [VAR with exogenous variables](https://stackoverflow.com/questions/22513336/var-with-exogenous-variables) – hyena Jan 02 '22 at 03:57

0 Answers0