Title: | Fit Rank-Ordered Logit (RO-Logit) Model |
---|---|
Description: | Implements the rank-ordered logit (RO-logit) model for stratified analysis of continuous outcomes introduced by Tan et al. (2017) <doi:10.1177/0962280217747309>. Model diagnostics based on the heuristic residuals and estimates in linear scales are available from the package, and outcomes with ties are supported. |
Authors: | Tan Chuen Seng, Ning Yilin |
Maintainer: | Ning Yilin <[email protected]> |
License: | LGPL-3 |
Version: | 0.1.2 |
Built: | 2025-03-11 02:59:19 UTC |
Source: | https://github.com/nyilin/rologit |
Obtain the heuristic residuals.
hresid(y, svar, design.mat, o, initial.res.par = c(0, 0), ...)
hresid(y, svar, design.mat, o, initial.res.par = c(0, 0), ...)
y |
vector of numeric. The outcomes. |
svar |
vector of numeric. The strata variable. |
design.mat |
matrix. The design matrix including intercept term. |
o |
matrix. Contains the estimated coefficients of the RO-logit and their SEs. |
initial.res.par |
The initial values of the intercept and log(scale), to
be passed to the |
... |
Other parameters to be passed to the |
Returns a list containing the estimated intercept and
log(scale)
, the covariance matrix of these two parameters,
convergence status from optim
, and the heuristic residuals.
A simulated dataset containing inpatient point-of-care blood glucose (BG) measurements from 2487 non-critical care adult patients above 40 years old. Data was simulated based on real data.
inpat_bg
inpat_bg
A data frame with 2487 rows and 13 variables:
Mean BG readings within each episode, in mmol/L.
Standard deviation of BG readings within each episode.
Gender of patients.
Whether each patient is in the medical ward (ward = 0
)
or surgical ward (ward = 1
).
Patient group defined based on the median age.
Patient group defined based on the median of duration of monitoring episode.
Patient group defined based on the median of daily BG monitoring frequency.
Patients' age.
Patients' duration of monitoring episode.
Patients' daily BG monitoring frequency.
Tan CS, Støer NC, Chen Y, Andersson M, Ning Y, Wee HL, Khoo EY, Tai ES, Kao SL, Reilly M. A stratification approach using logit-based models for confounder adjustment in the study of continuous outcomes. Statistical methods in medical research. 2017 Jan 1:0962280217747309.
Compute the negative log-likelihood for obtaining heuristic residuals.
loglikhresid(par, y, x, par1)
loglikhresid(par, y, x, par1)
par |
vector of numeric. Contain the intercept, first entry, and coefficient of log(sigma), second entry. |
y |
vector of numeric. Centered outcomes within each stratum. |
x |
matrix. The design matrix including intercept term. |
par1 |
vector of numeric. The estimated coefficients from RO-logit model. |
Make Q-Q plot for residual diagnostics.
qqplot.EVT1(hresid, scale)
qqplot.EVT1(hresid, scale)
hresid |
vector of numeric. The heuristic residuals. |
scale |
numeric. The scale parameter. |
## Not run: hresid <- evd::rgumbel(n = 100, loc = 0, scale = 3) qqplot.EVT1(hresid = hresid, scale = 3) ## End(Not run)
## Not run: hresid <- evd::rgumbel(n = 100, loc = 0, scale = 3) qqplot.EVT1(hresid = hresid, scale = 3) ## End(Not run)
Fit RO-logit model and obtain heuristic residuals
rologit( yvar, evar, cfdr = NULL, emod = NULL, svar, dat, method = "efron", initial.res.par = c(0, 0), plot = TRUE, ... )
rologit( yvar, evar, cfdr = NULL, emod = NULL, svar, dat, method = "efron", initial.res.par = c(0, 0), plot = TRUE, ... )
yvar |
string. Name of outcome variable. |
evar |
string (or vector of strings). Name of exposure(s). |
cfdr |
string (or vector of strings). Names of confounder(s). Default is
|
emod |
string (or vector of strings). Name of effect modifier(s).
Default is |
svar |
string. Name of stratum variable. Use |
dat |
|
method |
string. Use Efron ( |
initial.res.par |
The initial values of the intercept and log(scale), to
be passed to the |
plot |
logic. To plot the Q-Q plot for the heuristic residuals. Default
is |
... |
Other parameters to be passed to the |
Returns a list containing obj
(the RO-Logit model fitted using
coxph
), hresid
(the vector of heuristic residuals),
logscale
(log of scale parameter of the heuristic residuals), and
coefficients
(a data.frame with estimated coefficients before and
after scaling).
Allison PD, Christakis NA. Logit-models for sets of ranked items. Sociological Methodology 1994, Vol 24. 1994;24:199-228.
Beggs S, Cardell S, Hausman J. Assessing the Potential Demand for Electric Cars. J Econometrics. 1981;17:1-19.
Tan CS, Støer NC, Chen Y, Andersson M, Ning Y, Wee HL, Khoo EY, Tai ES, Kao SL, Reilly M. A stratification approach using logit-based models for confounder adjustment in the study of continuous outcomes. Statistical methods in medical research. 2017 Jan 1:0962280217747309.
Therneau TM, Grambsch PM. Modeling Survival Data: Extending the Cox Model: Springer New York; 2000.
# Fit an RO-logit model to determine whether the glycaemic control of # patients differs between medical and surgical wards. data(inpat_bg) # Divide patients into strata based on age, gender, duration of monitoring # episodes, and frequency of daily BG measurements. inpat_bg$group <- paste(inpat_bg$age_group, inpat_bg$sex, inpat_bg$los_group, inpat_bg$bg_freq_group, sep = "|") # Fit an RO-logit model with mean BG reading as the outcome and ward as the # exposure: obj <- rologit(yvar = "bg_mean", evar = "ward", svar = "group", dat = inpat_bg, initial.res.par = c(2, 2)) summary(obj)
# Fit an RO-logit model to determine whether the glycaemic control of # patients differs between medical and surgical wards. data(inpat_bg) # Divide patients into strata based on age, gender, duration of monitoring # episodes, and frequency of daily BG measurements. inpat_bg$group <- paste(inpat_bg$age_group, inpat_bg$sex, inpat_bg$los_group, inpat_bg$bg_freq_group, sep = "|") # Fit an RO-logit model with mean BG reading as the outcome and ward as the # exposure: obj <- rologit(yvar = "bg_mean", evar = "ward", svar = "group", dat = inpat_bg, initial.res.par = c(2, 2)) summary(obj)
Fit RO-logit model using Cox-PH
rologit.coxph(design.mat, y, svar = NULL, method = "efron")
rologit.coxph(design.mat, y, svar = NULL, method = "efron")
design.mat |
The design matrix without intercept term. |
y |
vector of numeric. The outcomes. |
svar |
vector of numeric. The strata variable. |
method |
string. Use Efron ( |
Returns the model fitted using coxph
.
Prints the estimated coefficients of an RO-Logit model.
## S3 method for class 'rologit' summary(object, ...)
## S3 method for class 'rologit' summary(object, ...)
object |
Model object fitted using |
... |
Additional arguments affecting the summary produced. |