| REEMtree {LongituRF} | R Documentation | 
(S)REEMtree algorithm
Description
(S)REEMtree is an adaptation of the random forest regression method to longitudinal data introduced by Sela and Simonoff. (2012) <doi:10.1007/s10994-011-5258-3>. The algorithm will estimate the parameters of the following semi-parametric stochastic mixed-effects model:
Y_i(t)=f(X_i(t))+Z_i(t)\beta_i + \omega_i(t)+\epsilon_i
with Y_i(t) the output at time t for the ith individual; X_i(t) the input predictors (fixed effects) at time t for the ith individual;
Z_i(t) are the random effects at time t for the ith individual; \omega_i(t) is the stochastic process at time t for the ith individual
which model the serial correlations of the output measurements; \epsilon_i is the residual error.
Usage
REEMtree(X, Y, id, Z, iter = 10, time, sto, delta = 0.001)
Arguments
| X | [matrix]: A  | 
| Y | [vector]: A vector containing the output trajectories. | 
| id | [vector]: Is the vector of the identifiers for the different trajectories. | 
| Z | [matrix]: A  | 
| iter | [numeric]: Maximal number of iterations of the algorithm. The default is set to  | 
| time | [vector]: Is the vector of the measurement times associated with the trajectories in  | 
| sto | [character]: Defines the covariance function of the stochastic process, can be either  | 
| delta | [numeric]: The algorithm stops when the difference in log likelihood between two iterations is smaller than  | 
Value
A fitted (S)MERF model which is a list of the following elements:
-  forest:Tree obtained at the last iteration.
-  random_effects :Predictions of random effects for different trajectories.
-  id_btilde:Identifiers of individuals associated with the predictionsrandom_effects.
-  var_random_effects:Estimation of the variance covariance matrix of random effects.
-  sigma_sto:Estimation of the volatility parameter of the stochastic process.
-  sigma:Estimation of the residual variance parameter.
-  time:The vector of the measurement times associated with the trajectories inY,ZandX.
-  sto:Stochastic process used in the model.
-  Vraisemblance:Log-likelihood of the different iterations.
-  id:Vector of the identifiers for the different trajectories.
Examples
set.seed(123)
data <- DataLongGenerator(n=20) # Generate the data composed by n=20 individuals.
# Train a SREEMtree model on the generated data.
# The data are generated with a Brownian motion,
# so we use the parameter sto="BM" to specify a Brownian motion as stochastic process
X.fixed.effects <- as.data.frame(data$X)
sreemt <- REEMtree(X=X.fixed.effects,Y=data$Y,Z=data$Z,id=data$id,time=data$time,
sto="BM", delta=0.0001)
sreemt$forest # is the fitted random forest (obtained at the last iteration).
sreemt$random_effects # are the predicted random effects for each individual.
sreemt$omega # are the predicted stochastic processes.
plot(sreemt$Vraisemblance) #evolution of the log-likelihood.