REEMtree {REEMtree} | R Documentation |
Create a RE-EM tree
Description
Fit a RE-EM tree to data. This estimates a regression tree combined with a linear random effects model.
Usage
REEMtree(formula, data, random, subset=NULL,
initialRandomEffects=rep(0,TotalObs),
ErrorTolerance=0.001, MaxIterations=1000,
verbose=FALSE, tree.control=rpart.control(cp=0.001),
cv=TRUE, no.SE =1,
lme.control=lmeControl(returnObject=TRUE),
method="REML", correlation=NULL)
Arguments
formula |
a formula, as in the |
data |
a data frame in which to interpret the variables named in the formula (unlike in |
random |
a description of the random effects, as a formula of the form |
subset |
an optional logical vector indicating the subset of the rows of data that should be used in the fit. All observations are included by default. |
initialRandomEffects |
an optional vector giving initial values for the random effects to use in estimation |
ErrorTolerance |
when the difference in the likelihoods of the linear models of two consecutive iterations is less than this value, the RE-EM tree has converged |
MaxIterations |
maximum number of iterations allowed in estimation |
verbose |
if |
tree.control |
a list of control values for the estimation algorithm to replace the default values used to control the |
cv |
if |
no.SE |
number of standard errors used in pruning (0 if unused) |
lme.control |
a list of control values for the estimation algorithm to replace the default values returned by the function |
method |
whether the linear model should be estimated with |
correlation |
an optional |
Value
an object of class REEMtree
Author(s)
Rebecca Sela rsela@stern.nyu.edu
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
rpart
, nlme
, REEMtree.object
, corClasses
Examples
data(simpleREEMdata)
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID)
# Estimation allowing for autocorrelation
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID,
correlation=corAR1())
# Random parameters model for the random effects
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1+X|ID)
# Estimation with a subset
sub <- rep(c(rep(TRUE, 10), rep(FALSE, 2)), 50)
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID,
subset=sub)
# Dataset from the R library "AER"
data("Grunfeld", package = "AER")
REEMtree(invest ~ value + capital, data=Grunfeld, random=~1|firm)
REEMtree(invest ~ value + capital, data=Grunfeld, random=~1|firm, correlation=corAR1())
REEMtree(invest ~ value + capital, data=Grunfeld, random=~1+year|firm)
REEMtree(invest ~ value + capital, data=Grunfeld, random=~1|firm/year)