1

i have lots of trouble with the export of a vector autoregression model with R, more specifically with the Stargazer package.

Model1 <- VAR(v1, p = 7, type = "const", season = NULL, exog = NULL) 
sum <- summary(Model1)
sum

gives the desired output in the console which i cannot export. enter image description here

When i try it with stargazer like this: stargazer(sum[["varresult"]], type = 'text', out="VarModel.html")

i get the error message

"Error in .summary.object$coefficients : $ operator is invalid for atomic vectors"

Can someone help me out here please?

reCaptcha
  • 39
  • 6
  • 1
    You gave stargazer an atomic vector. It needs a list. – IRTFM Jul 23 '22 at 19:07
  • When i run this line: stargazer(Model1[["varresult"]], type = 'text', out="VarModel.html") it gives me the model output, which is somehow a list, but the summary is not possible? how can i convert? Can you provide more details please? – reCaptcha Jul 23 '22 at 19:35
  • `sum` is an R function. It has nothing to do with `summary`. The `sum` function operates on numeric vectors and returns a length-1 numeric vector. – IRTFM Jul 23 '22 at 20:26
  • the model summary object is just named "sum" i can also name it "elephants", that does change nothing. – reCaptcha Jul 24 '22 at 05:13
  • Except whatever it was (which you apparently have not examined with any of the available inspection tools) did NOT have a list structure. That is what the error was telling you. – IRTFM Jul 24 '22 at 14:54

0 Answers0