MixRF: Mixed Random Forest

Description Usage Arguments Value Examples

View source: R/MixRF.r

Description

The function to fit a random forest with random effects.

Usage

1
2
MixRF(Y, X, random, data, initialRandomEffects = 0, ErrorTolerance = 0.001, 
    MaxIterations = 1000)

Arguments

Y

The outcome variable.

X

A data frame or matrix contains the predictors.

random

A string in lme4 format indicates the random effect model.

data

The data set as a data frame.

initialRandomEffects

The initial values for random effects.

ErrorTolerance

The tolerance for log-likelihood.

MaxIterations

The maximum iteration times.

Value

A list contains the random forest ($forest), mixed model ($MixedModel), and random effects ($RandomEffects). See the example below for the usage.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(sleepstudy)

tmp = MixRF(Y = sleepstudy$Reaction, X = as.data.frame(sleepstudy$Days), 
    random = "(Days|Subject)", data = sleepstudy, initialRandomEffects = 0, 
    ErrorTolerance = 0.01, MaxIterations = 100)

# tmp$forest

# tmp$MixedModel

# tmp$RandomEffects

lschen-stat/MixRF documentation built on Aug. 9, 2017, 12:05 a.m.