| Title: | Mixed Regression Models with Generalized Log-Gamma Random Effects |
|---|---|
| Description: | Multivariate distribution derived from a Bernoulli mixed model under a marginal approach, incorporating a non-normal random intercept whose distribution is assumed to follow a generalized log-gamma (GLG) specification under a particular parameter setting. Estimation is performed by maximizing the log-likelihood using numerical optimization techniques (Lizandra C. Fabio, Vanessa Barros, Cristian Lobos, Jalmar M. F. Carrasco, Marginal multivariate approach: A novel strategy for handling correlated binary outcomes, 2025, under submission). |
| Authors: | Lizandra C. Fabio [aut], Vanessa Barros [aut], Cristian Lobos [aut], Jalmar M. F. Carrasco [aut, cre] |
| Maintainer: | Jalmar M. F. Carrasco <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-05-24 07:32:59 UTC |
| Source: | https://github.com/cran/MBRM |
This dataset contains binary response data from a longitudinal study on rheumatoid arthritis. The data include repeated measurements on 38 individuals, each with 5 time points.
Arthritis1Arthritis1
A data frame with 190 rows and 6 variables:
Subject identifier (integer from 1 to 38)
Binary response variable (0 or 1)
Sex indicator (0 = Female, 1 = Male)
Age indicator (0 = <=55 years 1 = > 55 uears)
Treatment group (0 = Placebo, 1 = Auranofin)
Time indicator (0 = baseline, 1 = follow-up)
The original data was collected to evaluate the effect of a treatment over time on arthritis severity. Covariates include demographic and clinical variables, and the response is binary (presence/absence of symptoms).
Derived from the original dataset included in:
Arthritis.txt an internal clinical dataset used in Bernoulli-GLG modeling study.
Fitzmaurice, G. M. and Lipsitz, S. (1995). A model for binary time series data with serial odds ratio patterns. Journal of the Royal Statistical Society: Series B, 44, 51–61.
data(Arthritis1) head(Arthritis1) # Fit the Bernoulli-LGG model fit <- MRMfit(y ~ Sex + Age + Treatment + Time, data = Arthritis1) summary(fit)data(Arthritis1) head(Arthritis1) # Fit the Bernoulli-LGG model fit <- MRMfit(y ~ Sex + Age + Treatment + Time, data = Arthritis1) summary(fit)
This function computes the envelopes simulation of the randomized quantile residuals for objects of class MRM.
envelope.MRM(object, R = 100, ...)envelope.MRM(object, R = 100, ...)
object |
An object of class |
R |
Integer. Number of replications to simulate the envelopes (default is 100). |
... |
Additional arguments passed to |
A QQ-plot with envelope.
data(Arthritis1) fit <- MRMfit(y ~ Sex + Age + Treatment + Time, data = Arthritis1) envelope.MRM(fit)data(Arthritis1) fit <- MRMfit(y ~ Sex + Age + Treatment + Time, data = Arthritis1) envelope.MRM(fit)
This function fits a mixed regression model for binary outcomes with random effects
following a generalized log-gamma distribution. The estimation is performed by maximizing
a custom log-likelihood using numerical optimization via optim.
MRMfit(formula, data, hessian = TRUE, method = "BFGS", ...)MRMfit(formula, data, hessian = TRUE, method = "BFGS", ...)
formula |
A symbolic description of the model to be fitted, e.g., |
data |
A data frame containing the variables in the model. The data must include an
|
hessian |
Logical. Should a numerically differentiated Hessian matrix be returned? |
method |
Optimization method to be used in |
... |
Additional arguments passed to |
An object of class "MRM" containing:
call |
The matched function call. |
formula |
The model formula. |
coefficients |
Estimated fixed effects coefficients. |
scale |
Estimated scale parameter for the random effects distribution. |
loglik |
Maximized log-likelihood value. |
n |
Number of clusters or subjects. |
m |
Vector with the number of observations per cluster. |
ep |
Estimated standard errors of the parameters. |
iter |
Number of iterations used by the optimizer. |
method |
Optimization method used. |
data |
The original data frame used. |
# Simulated data data1 <- rMRM(n = 50, m = rep(3, 50), theta = c(0.8, 1, -1, 1), X = cbind(x1 = rnorm(150), x2 = rnorm(150))) # Fit using BFGS (default) fit1 <- MRMfit(y ~ x1 + x2, data = data1) summary(fit1) # Fit using L-BFGS-B with bounds fit2 <- MRMfit(y ~ x1 + x2, data = data1, method = "L-BFGS-B", lower = c(1e-5, rep(-Inf, 3)), upper = rep(Inf, 4), control = list(factr = 1e7)) summary(fit2)# Simulated data data1 <- rMRM(n = 50, m = rep(3, 50), theta = c(0.8, 1, -1, 1), X = cbind(x1 = rnorm(150), x2 = rnorm(150))) # Fit using BFGS (default) fit1 <- MRMfit(y ~ x1 + x2, data = data1) summary(fit1) # Fit using L-BFGS-B with bounds fit2 <- MRMfit(y ~ x1 + x2, data = data1, method = "L-BFGS-B", lower = c(1e-5, rep(-Inf, 3)), upper = rep(Inf, 4), control = list(factr = 1e7)) summary(fit2)
This function computes the randomized quantile residuals for objects of class MRM.
## S3 method for class 'MRM' residuals(object, ...)## S3 method for class 'MRM' residuals(object, ...)
object |
An object of class |
... |
Additional arguments passed to |
A numeric vector of randomized quantile residuals.
data(Arthritis1) fit <- MRMfit(y ~ Sex + Age + Treatment + Time, data = Arthritis1) summary(residuals(fit))data(Arthritis1) fit <- MRMfit(y ~ Sex + Age + Treatment + Time, data = Arthritis1) summary(residuals(fit))
This function simulates clustered binary response data from a mixed regression model with random effects. The model allows for different link functions and random effect distributions.
rMRM(n, m, theta, X)rMRM(n, m, theta, X)
n |
Integer. Number of clusters or subjects. |
m |
Integer vector of length |
theta |
Numeric vector. The first element is the scale or dispersion parameter for the random effects, and the remaining values are the fixed effects coefficients, including the intercept. |
X |
A data frame or matrix of covariates with |
A tibble containing the simulated dataset with the following columns:
Cluster or subject ID (integer from 1 to n).
Binary response variable (0 or 1).
Covariates as defined in X, repeated according to cluster size.
The output also has an attribute "proportions" indicating the proportions of 0's and 1's in y.
set.seed(123) n <- 500 m <- rep(3,n) theta <- c(0.5,1,-2,1) set.seed(123) x1 <- runif(sum(m)) x2 <- rnorm(sum(m)) X <- cbind(x1,x2) set.seed(456) data1 <- rMRM(n,m,theta,X) head(data1)set.seed(123) n <- 500 m <- rep(3,n) theta <- c(0.5,1,-2,1) set.seed(123) x1 <- runif(sum(m)) x2 <- rnorm(sum(m)) X <- cbind(x1,x2) set.seed(456) data1 <- rMRM(n,m,theta,X) head(data1)
A data frame with 1908 observations on the following 5 variables.
toenailtoenail
A data frame with 1908 rows and 4 variables:
Subject identifier (integer from 1 to 38)
Binary response is the severity of infection, 0 (not severe) and 1(severe).
Treatment group (0 = Treatment A, 1 = Treatment B)
a numeric vector giving the time of the visit (not exactly monthly intervals hence not round numbers)
a numeric vector giving the number of the visit
The Toenail data discussed in Molenberghs and Verbeke (2010) and Lesaffre and Spiessens (2001 come from a multicenter study comparing two oral treatments (coded as A and B) for toenail (Dermatophyte Onychomycosis - TDO) infection, involved patients evaluated at seven visits, i.e. on weeks 0, 4, 8, 12, 24, 36 and 48. This study was evaluated on 294 patients comprising 1908 measurements. The binary outcome was infection severity, coded as 0 (no and mild) and 1 (moderate and severe). The patients have not been treated prior to the first visit so this should be regarded as the baseline.
Molenberghs G, Verbeke G (2010). Models for Discrete Longitudinal data. Springer, New York.
Lesaffre, E. and Spiessens, B. (2001). On the effect of the number of quadrature points in a logistic random-effects model: An example. Journal of the Royal Statistical Society, Series C, 50, 325-335.
data(toenail) head(toenail) # Fit the Bernoulli-LGG model fit <- MRMfit(y ~ treatment + month + treatment:month, data = toenail) summary(fit)data(toenail) head(toenail) # Fit the Bernoulli-LGG model fit <- MRMfit(y ~ treatment + month + treatment:month, data = toenail) summary(fit)