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 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.

cv

if TRUE then cross-validation will be used for estimating the tree at each iteration. Default is TRUE.

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 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

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)


[Package REEMtree version 0.90.5 Index]