[R] Ljung-Box test (Box.test)

Steven Winter
Tue, 26 Jun 2012 18:01:37 -0000

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.

Unfortunately, I never took a statistics class where I learned the Ljung-Box
test, and information about it online is hard to find. 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?

Thank you all so much. I apologize for the basic nature of the question.

Steven
	[[alternative HTML version deleted]]