| REEMtree {REEMtree} | R Documentation |
Fit a RE-EM tree to data. This estimates a regression tree combined with a linear random effects model.
REEMtree(formula, data, random, subset = NULL,
initialRandomEffects = rep(0, TotalObs), ErrorTolerance = 0.001,
MaxIterations = 1000, verbose = FALSE,
tree.control = rpart.control(), lme.control = lmeControl(returnObject = TRUE),
method = "REML", correlation = NULL)
formula |
a formula, as in the lm or rpart function |
data |
a data frame in which to interpret the variables named in the formula (unlike in lm or rpart, this is not optional) |
random |
a description of the random effects, as a formula of the form ~1|g, where g is the grouping variable |
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 TRUE, the current estimate of the RE-EM tree will be printed after each iteration |
tree.control |
a list of control values for the estimation algorithm to replace the default values used to control the rpart algorithm. Defaults to an empty list. |
lme.control |
a list of control values for the estimation algorithm to replace the default values returned by the function lmeControl. Defaults to an empty list. |
method |
whether the linear model should be estimated with ML or REML |
correlation |
an optional corStruct object describing the within-group correlation structure; the available classes are given in corClasses |
an object of class REEMtree
Rebecca Sela rsela@stern.nyu.edu
Sela, Rebecca J., and Simonoff, Jeffrey S., “RE-EM Trees: A New Data Mining Approach for Longitudinal Data”.
rpart, nlme, REEMtree.object, corClasses
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+year|firm, correlation=corAR1())
REEMtree(invest ~ value + capital, data=Grunfeld, random=~1|firm/year)