0

I have a class project where in a part of it I have to find AIC and BIC. I am using a US.GDP data from the FRED and i cant seem to figure out what im doing wrong. Im very new to r so any tips are appreciated.enter image description here when I put this code in it comes up with the error

AIC(fit) Error in logLik.lm(object) : 'logLik.lm' does not support multiple responses

I am not sure what I need to do to allow me to find any sort of fit because I get different errors for all these codes

abline(fit) AIC(fit) BIC(fit)

I have tried finding how to maybe compare regressions but I really cant figure out how to find it since my only variables are the gdp from each quarter and then the date. Date on the x and gdp on the y. I am super stuck on this one part because i cant see what im doing wrong except maybe it wont work on a linear regression :/

TJ Brad
  • 1
  • 2
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Please [do not post code or data in images](https://meta.stackoverflow.com/q/285551/2372064) – MrFlick Apr 18 '23 at 15:08
  • Please provide enough code so others can better understand or reproduce the problem. – Community Apr 18 '23 at 15:09
  • 1
    So you have time series data? Perhaps this helps https://stackoverflow.com/questions/47321272/linear-regression-lines-cannot-show-on-time-series-plot-in-r – Marco Apr 18 '23 at 15:12
  • 1
    Cannot replicate your problem, with my code it works. `model <- lm(mpg ~ hp, data= mtcars) AIC(model) #> [1] 181.2386 BIC(model) #> [1] 185.6358 ` Maybe take a look here: https://stackoverflow.com/questions/31384834/how-to-get-aic-or-bic-for-multivariate-multiple-regression-in-r – Nick Glättli Apr 18 '23 at 15:17
  • Perhaps refer to this discussion as well: https://stackoverflow.com/questions/31384834/how-to-get-aic-or-bic-for-multivariate-multiple-regression-in-r – TheN Apr 18 '23 at 16:11

0 Answers0