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)
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/REEMtree.Rd_%03d_medium.png", width=480, height=480)
> ### Name: REEMtree
> ### Title: Create a RE-EM tree
> ### Aliases: REEMtree
> ### Keywords: tree models
>
> ### ** 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)
[1] "*** RE-EM Tree ***"
n= 220
node), split, n, deviance, yval
* denotes terminal node
1) root 220 3502993.0 133.3119
2) capital< 905.65 213 816514.8 116.7423
4) value< 2023.55 183 199637.3 101.4119 *
5) value>=2023.55 30 311514.9 210.2577 *
3) capital>=905.65 7 848559.4 637.5000 *
[1] "Estimated covariance matrix of random effects:"
(Intercept)
(Intercept) 16102.04
[1] "Estimated variance of errors: 6560.76154717947"
[1] "Log likelihood: -1285.68868990103"
> REEMtree(invest ~ value + capital, data=Grunfeld, random=~1|firm, correlation=corAR1())
[1] "*** RE-EM Tree ***"
n= 220
node), split, n, deviance, yval
* denotes terminal node
1) root 220 9709554.0 133.3119
2) value< 2023.55 183 1185539.0 140.4533 *
3) value>=2023.55 37 3315838.0 475.4931
6) capital< 905.65 30 1049896.0 222.9857 *
7) capital>=905.65 7 848559.4 204.8394 *
[1] "Estimated covariance matrix of random effects:"
(Intercept)
(Intercept) 4.781951
[1] "Estimated variance of errors: 80619.1492573218"
[1] "Log likelihood: -1178.27919592153"
> REEMtree(invest ~ value + capital, data=Grunfeld, random=~1+year|firm)
[1] "*** RE-EM Tree ***"
n= 220
node), split, n, deviance, yval
* denotes terminal node
1) root 220 3479458.0 129.2651
2) capital< 905.65 213 809492.6 113.5582 *
3) capital>=905.65 7 847378.7 538.3319 *
[1] "Estimated covariance matrix of random effects:"
(Intercept) year
(Intercept) 5.214837e-09 4.910460e-06
year 4.910460e-06 6.604069e-03
[1] "Estimated variance of errors: 6914.0935068201"
[1] "Log likelihood: -1297.95669421635"
> REEMtree(invest ~ value + capital, data=Grunfeld, random=~1|firm/year)
[1] "*** RE-EM Tree ***"
n= 220
node), split, n, deviance, yval
* denotes terminal node
1) root 220 2179231.000 133.3119
2) capital< 905.65 213 318877.000 116.7423
4) value< 2023.55 183 5278.213 101.4119 *
5) value>=2023.55 30 8236.144 210.2577 *
3) capital>=905.65 7 22435.070 637.5000 *
[1] "Estimated covariance matrix of random effects:"
(Intercept)
(Intercept) 5493.977
[1] "Estimated variance of errors: 1066.78486808815"
[1] "Log likelihood: -1285.68868990103"
>
>
>
>
>
>
> dev.off()
null device
1
>