Learn R Programming

REEMtree (version 0.90.5)

AutoCorrelationLRtest: Test for autocorrelation in the residuals of a RE-EM tree

Description

This function tests for autocorrelation in the residuals of a RE-EM tree using a likelihood ratio test. The test keeps the tree structure of the RE-EM tree object fixed and uses a standard likelihood ratio test on the linear random effects model.

Usage

AutoCorrelationLRtest(object, newdata=NULL, correlation=corAR1())

Value

correlation

Type of correlation used in testing

loglik0

Likelihood of the random effects model if there is no autocorrelation

loglikAR

Likelihood of the random effects model if autocorrelation (of type AR(1)) is estimated

pvalue

P-value of the likelihood ratio test

Arguments

object

A RE-EM tree

newdata

Dataset on which the test is to be performed; if none is given, the original dataset is used

correlation

Type of correlation to be tested for in the residuals. The correlation can be any of type corClasses.

Author

Rebecca Sela rsela@stern.nyu.edu

Details

In general, newdata is likely to be the data used to estimate object. The RE-EM tree can be estimated with or without allowing for autocorrelation. Because the estimated tree may differ depending on whether autocorrelation is allowed in the RE-EM tree estimation process, but we recommend testing based on the tree estimated with autocorrelation allowed and the tree estimated without autocorrelation allowed.

References

Sela, Rebecca J., and Simonoff, Jeffrey S., “RE-EM Trees: A Data Mining Approach for Longitudinal and Clustered Data”, Machine Learning (2011).

See Also

corClasses

Examples

Run this code
data(simpleREEMdata)

# Estimation without autocorrelation
simpleEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID)
# Estimation with autocorrelation
simpleEMresult2<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, correlation=corAR1())

# Autocorrelation test based on the first tree
AutoCorrelationLRtest(simpleEMresult, simpleREEMdata)
# Autocorrelation test based on the second tree
AutoCorrelationLRtest(simpleEMresult2, simpleREEMdata)
# Autocorrelation test with an alternative correlation structure
AutoCorrelationLRtest(simpleEMresult, simpleREEMdata, correlation=corCAR1())

Run the code above in your browser using DataLab