I fit a simple linear model $y = bX$ to a data set today, and that produced 24 residuals (I have 24 data points, one for each year from 1984-2007). I would like to test the time-independence of the residuals of my model, and I was recommended by my supervisor to use the Ljung-Box test. The Box.test
function in R takes 4 arguments:
x
: a numeric vector or univariate time series.lag
: the statistic will be based on lag autocorrelation coefficients.type
: test to be performed: partial matching is used.fitdf
: number of degrees of freedom to be subtracted if x is a series of residuals.
What does lag
mean, and what value would you guys recommend I use for the test? Also, what does fitdf
represent, and what would the value for that parameter be in my case? Finally, the value of x
is a vector of my 24 residuals, correct?