Last data update: 2014.03.03

R: Predictions from a regression tree with individual-specific...
predictR 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. This is required if EstimateRandomEffects=TRUE and newdata does not match the data used to estimate the random effects model that created object.

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.

Important note: In this implementation, estimation of group effects for new groups can be used only with group-specific intercepts are estimated with only one grouping 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 Data Mining Approach for Longitudinal Data”, Machine Learning, 2011; Laird, N. M., and J. H. Ware (1982), “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)
predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
predict(REEMresult, simpleREEMdata, id=simpleREEMdata$ID, EstimateRandomEffects=TRUE)

# Estimation based on a subset that excludes the last two time series, 
# with predictions for all observations
sub <- rep(c(rep(TRUE, 10), rep(FALSE, 2)), 50)
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, 
	subset=sub)
pred1 <- predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
pred2 <- predict(REEMresult, simpleREEMdata, id=simpleREEMdata$ID, EstimateRandomEffects=TRUE)

# Estimation based on a subset that excludes the last five individuals, 
# with predictions for all observations
sub <- c(rep(TRUE, 540), rep(FALSE, 60))
REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, 
	subset=sub)
pred3 <- predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
pred4 <- predict(REEMresult, simpleREEMdata, id=simpleREEMdata$ID, EstimateRandomEffects=TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(REEMtree)
Loading required package: nlme
Loading required package: rpart
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/REEMtree/predict.Rd_%03d_medium.png", width=480, height=480)
> ### Name: predict
> ### Title: Predictions from a regression tree with individual-specific
> ###   effects
> ### Aliases: predict.REEMtree
> ### Keywords: models tree
> 
> ### ** Examples
> 
> data(simpleREEMdata)
> REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID)
> predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
         1          2          3          4          5          6          7 
 0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 -0.3697058 
         8          9         10         11         12         13         14 
 0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058 -0.3697058 
        15         16         17         18         19         20         21 
 0.8677981  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058 
        22         23         24         25         26         27         28 
 0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 -0.3697058 
        29         30         31         32         33         34         35 
-0.3697058  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981 
        36         37         38         39         40         41         42 
-0.3697058 -0.3697058  0.8677981 -0.3697058  0.8677981  0.8677981 -0.3697058 
        43         44         45         46         47         48         49 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
        50         51         52         53         54         55         56 
 0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981 
        57         58         59         60         61         62         63 
-0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
        64         65         66         67         68         69         70 
 0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 
        71         72         73         74         75         76         77 
-0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
        78         79         80         81         82         83         84 
 0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 
        85         86         87         88         89         90         91 
-0.3697058 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 
        92         93         94         95         96         97         98 
 0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981 
        99        100        101        102        103        104        105 
 0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 
       106        107        108        109        110        111        112 
 0.8677981  0.8677981 -0.3697058 -0.3697058  0.8677981 -0.3697058  0.8677981 
       113        114        115        116        117        118        119 
 0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 -0.3697058 -0.3697058 
       120        121        122        123        124        125        126 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058  0.8677981 
       127        128        129        130        131        132        133 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058  0.8677981 
       134        135        136        137        138        139        140 
 0.8677981 -0.3697058  0.8677981  0.8677981 -0.3697058 -0.3697058 -0.3697058 
       141        142        143        144        145        146        147 
 0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981 
       148        149        150        151        152        153        154 
 0.8677981 -0.3697058  0.8677981 -0.3697058 -0.3697058 -0.3697058  0.8677981 
       155        156        157        158        159        160        161 
-0.3697058 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058 
       162        163        164        165        166        167        168 
-0.3697058  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 
       169        170        171        172        173        174        175 
-0.3697058 -0.3697058 -0.3697058  0.8677981 -0.3697058  0.8677981 -0.3697058 
       176        177        178        179        180        181        182 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
       183        184        185        186        187        188        189 
 0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981 
       190        191        192        193        194        195        196 
 0.8677981  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058 
       197        198        199        200        201        202        203 
 0.8677981 -0.3697058 -0.3697058 -0.3697058  0.8677981  0.8677981  0.8677981 
       204        205        206        207        208        209        210 
 0.8677981  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 
       211        212        213        214        215        216        217 
 0.8677981 -0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981 
       218        219        220        221        222        223        224 
 0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058 
       225        226        227        228        229        230        231 
 0.8677981  0.8677981  0.8677981 -0.3697058 -0.3697058  0.8677981  0.8677981 
       232        233        234        235        236        237        238 
 0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981  0.8677981 
       239        240        241        242        243        244        245 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058 -0.3697058 
       246        247        248        249        250        251        252 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
       253        254        255        256        257        258        259 
 0.8677981  0.8677981  0.8677981  0.8677981  0.8677981 -0.3697058 -0.3697058 
       260        261        262        263        264        265        266 
 0.8677981  0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058 -0.3697058 
       267        268        269        270        271        272        273 
-0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058  0.8677981 
       274        275        276        277        278        279        280 
-0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
       281        282        283        284        285        286        287 
-0.3697058  0.8677981  0.8677981 -0.3697058  0.8677981  0.8677981  0.8677981 
       288        289        290        291        292        293        294 
 0.8677981  0.8677981 -0.3697058  0.8677981 -0.3697058 -0.3697058  0.8677981 
       295        296        297        298        299        300        301 
-0.3697058  0.8677981 -0.3697058  0.8677981  0.8677981 -0.3697058  1.6862250 
       302        303        304        305        306        307        308 
 1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325 
       309        310        311        312        313        314        315 
 2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250 
       316        317        318        319        320        321        322 
 1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       323        324        325        326        327        328        329 
 2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250 
       330        331        332        333        334        335        336 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       337        338        339        340        341        342        343 
 1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325 
       344        345        346        347        348        349        350 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250 
       351        352        353        354        355        356        357 
 1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325 
       358        359        360        361        362        363        364 
 2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250 
       365        366        367        368        369        370        371 
 1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       372        373        374        375        376        377        378 
 2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325 
       379        380        381        382        383        384        385 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  1.6862250 
       386        387        388        389        390        391        392 
 1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325 
       393        394        395        396        397        398        399 
 2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250 
       400        401        402        403        404        405        406 
 1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       407        408        409        410        411        412        413 
 2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250 
       414        415        416        417        418        419        420 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       421        422        423        424        425        426        427 
 1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325 
       428        429        430        431        432        433        434 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250 
       435        436        437        438        439        440        441 
 1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325 
       442        443        444        445        446        447        448 
 2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250 
       449        450        451        452        453        454        455 
 1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       456        457        458        459        460        461        462 
 2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325 
       463        464        465        466        467        468        469 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  1.6862250 
       470        471        472        473        474        475        476 
 1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325 
       477        478        479        480        481        482        483 
 2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250 
       484        485        486        487        488        489        490 
 1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       491        492        493        494        495        496        497 
 2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250 
       498        499        500        501        502        503        504 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       505        506        507        508        509        510        511 
 1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325 
       512        513        514        515        516        517        518 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250 
       519        520        521        522        523        524        525 
 1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325 
       526        527        528        529        530        531        532 
 2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250 
       533        534        535        536        537        538        539 
 1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       540        541        542        543        544        545        546 
 2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325 
       547        548        549        550        551        552        553 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  1.6862250 
       554        555        556        557        558        559        560 
 1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325  2.6136325 
       561        562        563        564        565        566        567 
 2.6136325  2.6136325  2.6136325  2.6136325  1.6862250  1.6862250  1.6862250 
       568        569        570        571        572        573        574 
 1.6862250  1.6862250  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       575        576        577        578        579        580        581 
 2.6136325  2.6136325  1.6862250  1.6862250  1.6862250  1.6862250  1.6862250 
       582        583        584        585        586        587        588 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
       589        590        591        592        593        594        595 
 1.6862250  1.6862250  1.6862250  1.6862250  1.6862250  2.6136325  2.6136325 
       596        597        598        599        600 
 2.6136325  2.6136325  2.6136325  2.6136325  2.6136325 
> predict(REEMresult, simpleREEMdata, id=simpleREEMdata$ID, EstimateRandomEffects=TRUE)
          1           2           3           4           5           6 
 1.19279900  1.19279900 -0.04470493  1.19279900  1.19279900  1.19279900 
          7           8           9          10          11          12 
-0.04470493  1.19279900  1.19279900  1.19279900  1.19279900  1.19279900 
         13          14          15          16          17          18 
-2.12044105 -2.12044105 -0.88293712 -0.88293712 -0.88293712 -0.88293712 
         19          20          21          22          23          24 
-0.88293712 -0.88293712 -2.12044105 -0.88293712 -0.88293712 -2.12044105 
         25          26          27          28          29          30 
-0.27711506 -0.27711506 -0.27711506 -1.51461898 -1.51461898 -0.27711506 
         31          32          33          34          35          36 
-1.51461898 -0.27711506 -0.27711506 -0.27711506 -0.27711506 -1.51461898 
         37          38          39          40          41          42 
-1.10339858  0.13410534 -1.10339858  0.13410534  0.13410534 -1.10339858 
         43          44          45          46          47          48 
 0.13410534  0.13410534  0.13410534 -1.10339858  0.13410534  0.13410534 
         49          50          51          52          53          54 
 2.02920078  2.02920078  2.02920078  2.02920078  2.02920078  0.79169685 
         55          56          57          58          59          60 
 2.02920078  2.02920078  0.79169685  2.02920078  2.02920078  0.79169685 
         61          62          63          64          65          66 
 1.51728159  1.51728159  1.51728159  1.51728159  0.27977766  1.51728159 
         67          68          69          70          71          72 
 1.51728159  1.51728159  1.51728159  1.51728159  0.27977766  1.51728159 
         73          74          75          76          77          78 
-0.94207070 -2.17957462 -0.94207070 -0.94207070 -0.94207070 -0.94207070 
         79          80          81          82          83          84 
-2.17957462 -0.94207070 -0.94207070 -0.94207070 -0.94207070 -0.94207070 
         85          86          87          88          89          90 
-1.33280411 -1.33280411 -0.09530019 -0.09530019 -0.09530019 -0.09530019 
         91          92          93          94          95          96 
-0.09530019 -0.09530019 -0.09530019 -0.09530019 -0.09530019 -0.09530019 
         97          98          99         100         101         102 
 1.00131846  2.23882238  2.23882238  1.00131846  2.23882238  2.23882238 
        103         104         105         106         107         108 
 2.23882238  2.23882238  2.23882238  2.23882238  2.23882238  1.00131846 
        109         110         111         112         113         114 
 1.48663603  2.72413995  1.48663603  2.72413995  2.72413995  1.48663603 
        115         116         117         118         119         120 
 2.72413995  2.72413995  2.72413995  1.48663603  1.48663603  2.72413995 
        121         122         123         124         125         126 
 1.22027907  1.22027907 -0.01722485  1.22027907 -0.01722485  1.22027907 
        127         128         129         130         131         132 
 1.22027907  1.22027907  1.22027907 -0.01722485  1.22027907 -0.01722485 
        133         134         135         136         137         138 
 0.73251498  0.73251498 -0.50498894  0.73251498  0.73251498 -0.50498894 
        139         140         141         142         143         144 
-0.50498894 -0.50498894  0.73251498  0.73251498 -0.50498894  0.73251498 
        145         146         147         148         149         150 
 2.59197720  1.35447327  2.59197720  2.59197720  1.35447327  2.59197720 
        151         152         153         154         155         156 
 1.35447327  1.35447327  1.35447327  2.59197720  1.35447327  1.35447327 
        157         158         159         160         161         162 
-0.45884052 -0.45884052 -0.45884052 -0.45884052 -1.69634444 -1.69634444 
        163         164         165         166         167         168 
-0.45884052 -0.45884052 -0.45884052 -0.45884052 -0.45884052 -0.45884052 
        169         170         171         172         173         174 
-1.49551571 -1.49551571 -1.49551571 -0.25801179 -1.49551571 -0.25801179 
        175         176         177         178         179         180 
-1.49551571 -0.25801179 -0.25801179 -0.25801179 -1.49551571 -0.25801179 
        181         182         183         184         185         186 
 0.02931679  0.02931679  0.02931679  0.02931679 -1.20818714  0.02931679 
        187         188         189         190         191         192 
 0.02931679  0.02931679  0.02931679  0.02931679  0.02931679  0.02931679 
        193         194         195         196         197         198 
 1.18419033  1.18419033  1.18419033 -0.05331359  1.18419033 -0.05331359 
        199         200         201         202         203         204 
-0.05331359 -0.05331359  1.18419033  1.18419033  1.18419033  1.18419033 
        205         206         207         208         209         210 
 1.74627552  1.74627552  1.74627552  1.74627552  1.74627552  1.74627552 
        211         212         213         214         215         216 
 1.74627552  0.50877160  1.74627552  1.74627552  0.50877160  1.74627552 
        217         218         219         220         221         222 
 1.43470731  1.43470731  1.43470731  1.43470731  1.43470731  0.19720339 
        223         224         225         226         227         228 
 1.43470731  0.19720339  1.43470731  1.43470731  1.43470731  0.19720339 
        229         230         231         232         233         234 
-0.71505831  0.52244561  0.52244561  0.52244561  0.52244561 -0.71505831 
        235         236         237         238         239         240 
 0.52244561  0.52244561  0.52244561  0.52244561  0.52244561  0.52244561 
        241         242         243         244         245         246 
-1.52921510 -2.76671903 -1.52921510 -2.76671903 -2.76671903 -1.52921510 
        247         248         249         250         251         252 
-1.52921510 -1.52921510 -2.76671903 -1.52921510 -1.52921510 -1.52921510 
        253         254         255         256         257         258 
 1.67580625  1.67580625  1.67580625  1.67580625  1.67580625  0.43830233 
        259         260         261         262         263         264 
 0.43830233  1.67580625  1.67580625  1.67580625  0.43830233  1.67580625 
        265         266         267         268         269         270 
 2.40684292  2.40684292  2.40684292  3.64434685  3.64434685  2.40684292 
        271         272         273         274         275         276 
 3.64434685  2.40684292  3.64434685  2.40684292  3.64434685  3.64434685 
        277         278         279         280         281         282 
-0.27167333  0.96583060  0.96583060  0.96583060 -0.27167333  0.96583060 
        283         284         285         286         287         288 
 0.96583060 -0.27167333  0.96583060  0.96583060  0.96583060  0.96583060 
        289         290         291         292         293         294 
 0.55440371 -0.68310022  0.55440371 -0.68310022 -0.68310022  0.55440371 
        295         296         297         298         299         300 
-0.68310022  0.55440371 -0.68310022  0.55440371  0.55440371 -0.68310022 
        301         302         303         304         305         306 
 4.00313997  4.00313997  4.00313997  4.00313997  4.00313997  4.93054747 
        307         308         309         310         311         312 
 4.93054747  4.93054747  4.93054747  4.93054747  4.93054747  4.93054747 
        313         314         315         316         317         318 
 1.07940061  1.07940061  1.07940061  1.07940061  1.07940061  2.00680811 
        319         320         321         322         323         324 
 2.00680811  2.00680811  2.00680811  2.00680811  2.00680811  2.00680811 
        325         326         327         328         329         330 
 0.42060216  0.42060216  0.42060216  0.42060216  0.42060216  1.34800967 
        331         332         333         334         335         336 
 1.34800967  1.34800967  1.34800967  1.34800967  1.34800967  1.34800967 
        337         338         339         340         341         342 
-1.95265996 -1.95265996 -1.95265996 -1.95265996 -1.95265996 -1.02525245 
        343         344         345         346         347         348 
-1.02525245 -1.02525245 -1.02525245 -1.02525245 -1.02525245 -1.02525245 
        349         350         351         352         353         354 
 0.81197521  0.81197521  0.81197521  0.81197521  0.81197521  1.73938271 
        355         356         357         358         359         360 
 1.73938271  1.73938271  1.73938271  1.73938271  1.73938271  1.73938271 
        361         362         363         364         365         366 
 0.94638102  0.94638102  0.94638102  0.94638102  0.94638102  1.87378853 
        367         368         369         370         371         372 
 1.87378853  1.87378853  1.87378853  1.87378853  1.87378853  1.87378853 
        373         374         375         376         377         378 
 6.20297319  6.20297319  6.20297319  6.20297319  6.20297319  7.13038069 
        379         380         381         382         383         384 
 7.13038069  7.13038069  7.13038069  7.13038069  7.13038069  7.13038069 
        385         386         387         388         389         390 
 6.26643754  6.26643754  6.26643754  6.26643754  6.26643754  7.19384504 
        391         392         393         394         395         396 
 7.19384504  7.19384504  7.19384504  7.19384504  7.19384504  7.19384504 
        397         398         399         400         401         402 
 3.75397565  3.75397565  3.75397565  3.75397565  3.75397565  4.68138316 
        403         404         405         406         407         408 
 4.68138316  4.68138316  4.68138316  4.68138316  4.68138316  4.68138316 
        409         410         411         412         413         414 
-0.69774891 -0.69774891 -0.69774891 -0.69774891 -0.69774891  0.22965860 
        415         416         417         418         419         420 
 0.22965860  0.22965860  0.22965860  0.22965860  0.22965860  0.22965860 
        421         422         423         424         425         426 
 0.06786078  0.06786078  0.06786078  0.06786078  0.06786078  0.99526828 
        427         428         429         430         431         432 
 0.99526828  0.99526828  0.99526828  0.99526828  0.99526828  0.99526828 
        433         434         435         436         437         438 
-1.15170226 -1.15170226 -1.15170226 -1.15170226 -1.15170226 -0.22429475 
        439         440         441         442         443         444 
-0.22429475 -0.22429475 -0.22429475 -0.22429475 -0.22429475 -0.22429475 
        445         446         447         448         449         450 
 0.16393518  0.16393518  0.16393518  0.16393518  0.16393518  1.09134269 
        451         452         453         454         455         456 
 1.09134269  1.09134269  1.09134269  1.09134269  1.09134269  1.09134269 
        457         458         459         460         461         462 
-1.68460103 -1.68460103 -1.68460103 -1.68460103 -1.68460103 -0.75719352 
        463         464         465         466         467         468 
-0.75719352 -0.75719352 -0.75719352 -0.75719352 -0.75719352 -0.75719352 
        469         470         471         472         473         474 
-0.36583659 -0.36583659 -0.36583659 -0.36583659 -0.36583659  0.56157091 
        475         476         477         478         479         480 
 0.56157091  0.56157091  0.56157091  0.56157091  0.56157091  0.56157091 
        481         482         483         484         485         486 
 0.42375006  0.42375006  0.42375006  0.42375006  0.42375006  1.35115756 
        487         488         489         490         491         492 
 1.35115756  1.35115756  1.35115756  1.35115756  1.35115756  1.35115756 
        493         494         495         496         497         498 
 1.12638573  1.12638573  1.12638573  1.12638573  1.12638573  2.05379324 
        499         500         501         502         503         504 
 2.05379324  2.05379324  2.05379324  2.05379324  2.05379324  2.05379324 
        505         506         507         508         509         510 
 3.80431458  3.80431458  3.80431458  3.80431458  3.80431458  4.73172209 
        511         512         513         514         515         516 
 4.73172209  4.73172209  4.73172209  4.73172209  4.73172209  4.73172209 
        517         518         519         520         521         522 
 0.78794477  0.78794477  0.78794477  0.78794477  0.78794477  1.71535228 
        523         524         525         526         527         528 
 1.71535228  1.71535228  1.71535228  1.71535228  1.71535228  1.71535228 
        529         530         531         532         533         534 
-0.02266993 -0.02266993 -0.02266993 -0.02266993 -0.02266993  0.90473758 
        535         536         537         538         539         540 
 0.90473758  0.90473758  0.90473758  0.90473758  0.90473758  0.90473758 
        541         542         543         544         545         546 
 3.61806758  3.61806758  3.61806758  3.61806758  3.61806758  4.54547509 
        547         548         549         550         551         552 
 4.54547509  4.54547509  4.54547509  4.54547509  4.54547509  4.54547509 
        553         554         555         556         557         558 
 2.29707056  2.29707056  2.29707056  2.29707056  2.29707056  3.22447807 
        559         560         561         562         563         564 
 3.22447807  3.22447807  3.22447807  3.22447807  3.22447807  3.22447807 
        565         566         567         568         569         570 
 4.35255701  4.35255701  4.35255701  4.35255701  4.35255701  5.27996452 
        571         572         573         574         575         576 
 5.27996452  5.27996452  5.27996452  5.27996452  5.27996452  5.27996452 
        577         578         579         580         581         582 
 3.71908221  3.71908221  3.71908221  3.71908221  3.71908221  4.64648972 
        583         584         585         586         587         588 
 4.64648972  4.64648972  4.64648972  4.64648972  4.64648972  4.64648972 
        589         590         591         592         593         594 
 4.18499001  4.18499001  4.18499001  4.18499001  4.18499001  5.11239752 
        595         596         597         598         599         600 
 5.11239752  5.11239752  5.11239752  5.11239752  5.11239752  5.11239752 
> 
> # Estimation based on a subset that excludes the last two time series, 
> # with predictions for all observations
> sub <- rep(c(rep(TRUE, 10), rep(FALSE, 2)), 50)
> REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, 
+ 	subset=sub)
> pred1 <- predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
> pred2 <- predict(REEMresult, simpleREEMdata, id=simpleREEMdata$ID, EstimateRandomEffects=TRUE)
> 
> # Estimation based on a subset that excludes the last five individuals, 
> # with predictions for all observations
> sub <- c(rep(TRUE, 540), rep(FALSE, 60))
> REEMresult<-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID, 
+ 	subset=sub)
> pred3 <- predict(REEMresult, simpleREEMdata, EstimateRandomEffects=FALSE)
> pred4 <- pred