Description Usage Arguments Value Examples
Mixed Logistic Random Forest for Binary Data
1 2 3 |
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. |
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.