Last data update: 2014.03.03

R: Mixed Random Forest
MixRFR Documentation

Mixed Random Forest

Description

The function to fit a random forest with random effects.

Usage

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


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

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(MixRF)
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Loading required package: lme4
Loading required package: Matrix
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MixRF/MixRF.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MixRF
> ### Title: Mixed Random Forest
> ### Aliases: MixRF
> 
> ### ** Examples
> 
> 
> 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
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>