predict {REEMtree}R Documentation

Predictions from a regression tree with individual-specific effects

Description

Returns a vector of predictions from a fitted RE-EM Tree. Predictions are based on the node of the tree in which the new observation would fall and (optionally) an estimated random effect for the observation.

Usage

predict.REEMtree(object, newdata, id = NULL, 
        EstimateRandomEffects = TRUE, ...)

Arguments

object a fitted REEMtree
newdata an data frame to be used for obtaining the predictions. All variables used in the fixed and random effects models, including the group identifier, must be present in the data frame. New values of the group identifier are allowed. Unlike in predict.lme and predict.rpart, the data frame is required
id a string containing the name of the variable that is used to identify the groups
EstimateRandomEffects if TRUE, the fitted effects will be included in the estimates and effects for new groups will be estimated wherever the target variable is not missing. If FALSE or if the random effect cannot be estimated, random effects are set to 0, so that only the fixed effects based on the regression tree are used.
... additional arguments that will be passed through to rpart

Details

If EstimateRandomEffects=TRUE and a group was not used in the original estimation, its random effect must be estimated. If there are no non-missing values of the target variable for this group, then the new effect is set to 0.

If there are non-missing values of the target variable, then the random effect is estimated based on the estimated variance of the errors and variance of the random effects in the fitted model. See Equation 3.2 of Laird and Ware (1982) for the precise relationship.

A fixed effect for a new group with non-missing observations for the target variable is estimated as the mean of the difference between the predicted values and the observed values of the target variable.

Value

a vector containing the predicted values

Author(s)

Rebecca Sela rsela@stern.nyu.edu

References

Sela, Rebecca J., and Simonoff, Jeffrey S., “RE-EM Trees: A New Data Mining Approach for Longitudinal Data”, Laird, N. M., and J. H. Ware (1982), dquote{Random-effects models for longitudinal data}, Biometrics 38: 963-974

See Also

predict.nlme, predict.rpart

Examples

data(simpleREEMdata)
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, 
        simpleREEMdata$ID)
predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
predict(REEMresult, simpleREEMdata, id=simpleREEMdata$ID, 
        EstimateRandomEffects=TRUE)

[Package REEMtree version 1.0 Index]