Frank Harrell rms R-Pack is a great tool for implementing multiple logistic regression. However, I want to know how / if random effects can be included in a model passing through rms. I know that rms can work through nlme, but only a generalized least squares function (Gls), and not an lme function that allows the inclusion of random effects. Mixed effect models can be problematic for analysis / interpretation, but are sometimes necessary to account for nested effects in models.
I'm not sure if this is useful in this case, but I copied some code from the rms help files that uses a simple logistic regression model and added a line showing the mixed effects regression logic model passing through the glmmPQL MASS package.
n <- 1000
require(rms)
set.seed(17)
age <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol <- rnorm(n, 200, 25)
sex <- factor(sample(c('female','male'), n,TRUE))
label(age) <- 'Age'
label(cholesterol) <- 'Total Cholesterol'
label(blood.pressure) <- 'Systolic Blood Pressure'
label(sex) <- 'Sex'
units(cholesterol) <- 'mg/dl'
units(blood.pressure) <- 'mmHg'
ch <- cut2(cholesterol, g=40, levels.mean=TRUE)
table(ch)
f <- lrm(ch ~ age)
require(MASS)
f1<-glmmPQL(ch~age, random=~1|sex, family=binomial)
summary(f1)
I would be interested to know if random effects in rms can be enabled for both logistic regression (lrm) and the nlme run for linear regression.
Thank you all
source
share