MixRFb: Mixed Logistic Random Forest for Binary Data

Description Usage Arguments Value Examples

Description

Mixed Logistic Random Forest for Binary Data

Usage

1
2
3
MixRFb(Y, x, random, data, initialRandomEffects = 0, ErrorTolerance = 0.001,
  MaxIterations = 200, ErrorTolerance0 = 0.001, MaxIterations0 = 15,
  verbose = FALSE)

Arguments

Y

The outcome variable.

x

A formula string 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 for each run of PQL.

ErrorTolerance0

The tolerance for eta (penalized quasi-likelihood, PQL).

MaxIterations0

The maximum iteration times for PQL.

verbose

The option to monitor each run of PQL or not.

Value

A list contains the random forest, mixed model, and random effects. See the example below for the usage. A predict() function is also available below.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# example data (http://stats.stackexchange.com/questions/70783/how-to-assess-the-fit-of-a-binomial-glmm-fitted-with-lme4-1-0)
dat <- read.table("http://pastebin.com/raw.php?i=vRy66Bif")

library(party)
library(lme4)

source('MixRFb.r')
system.time(tmp <- MixRFb(Y=dat$true, x='factor(distance) + consequent + factor(direction) + factor(dist)', random='(1|V1)',
                          data=dat, initialRandomEffects=0,
                          ErrorTolerance=1, MaxIterations=200,
                          ErrorTolerance0=0.3, MaxIterations0=15, verbose=T))

# tmp$forest
# tmp$MixedModel
# tmp$RandomEffects

# eta
pred1 = predict.MixRF(tmp, dat, EstimateRE=TRUE)
prob = 1/(1+exp(-pred1))
res = (prob>.5)

# classification
table(res,dat$true)

randel/MixRF documentation built on May 26, 2019, 10:59 p.m.