View source: R/logLikSubjectDisplacements.R
logLikSubjectDisplacements | R Documentation |
logLikSubjectDisplacements
allows the user to evaluate the log-likelihood displacement for each subject,
indicating the influence of every subject to the model.
logLikSubjectDisplacements(
model,
disp_thrh = NA,
label_angle = 0,
var_name = NULL,
verbose = TRUE,
...
)
model |
An object of class "lme" representing the linear mixed-effects model fitted by |
disp_thrh |
Numeric value indicating the threshold of log-likelihood displacement. If not specified, the threshold is set to the 90% percentile of the log-likelihood displacement values. |
label_angle |
Numeric value indicating the angle for the label of subjects with a log-likelihood displacement greater than |
var_name |
Name of the variable for the weights of the model in the case that a variance structure has been specified using |
verbose |
Logical indicating if subjects with a log-likelihood displacement greater than |
... |
Extra arguments, if any, for lattice::panel.xyplot. |
The evaluation of the log-likelihood displacement is based in the analysis proposed in Verbeke and Molenberghs (2009) and Gałecki and Burzykowski (2013).
First, a list of models fitted to leave-one-subject-out datasets are obtained. Then, for each model, the maximum likelihood estimate obtained by fitting the
model to all data and the maximum likelihood estimate obtained by fitting the model to the data with the i
-th subject removed are obtained and used for the
log-likelihood displacement calculation. The likelihood displacement, LDi
, is defined as twice the difference between the log-likelihood computed at a
maximum and displaced values of estimated parameters (Verbeke and Molenberghs (2009), Gałecki and Burzykowsk (2013)):
LD_i \equiv 2 \times \Bigr[\ell_\textrm{Full}(\widehat{\Theta};\textrm{y})-\ell_\textrm{Full}(\widehat{\Theta}_{(-i)};\textrm{y})\Bigr]
where \widehat{\Theta}
is the maximum-likelihood estimate of \Theta
obtained by fitting the model to all data, while \widehat{\Theta}_{-i}
is
the maximum-likelihood estimate obtained by fitting the model to the data with the i
-subject excluded.
Returns a plot of the log-likelihood displacement values for each subject, indicating those subjects
whose contribution is greater than disp_thrh
.
Andrzej Galecki & Tomasz Burzykowski (2013) Linear Mixed-Effects Models Using R: A Step-by-Step Approach First Edition. Springer, New York. ISBN 978-1-4614-3899-1
Verbeke, G. & Molenberghs, G. (2000). Linear Mixed Models for Longitudinal Data. Springer New York. https://doi.org/10.1007/978-1-4419-0300-6
# Load the example data
data(grwth_data)
# Fit the model
lmm <- lmmModel(
data = grwth_data,
sample_id = "subject",
time = "Time",
treatment = "Treatment",
tumor_vol = "TumorVolume",
trt_control = "Control",
drug_a = "DrugA",
drug_b = "DrugB",
combination = "Combination"
)
# Obtain log-likelihood displacement for each subject
logLikSubjectDisplacements(model = lmm)
# Modifying the threshold for log-likelihood displacement
logLikSubjectDisplacements(model = lmm, disp_thrh = 1)
# Calculating the log-likelihood contribution in a model with a variance structure specified
lmm_var <- lmmModel(
data = grwth_data,
sample_id = "subject",
time = "Time",
treatment = "Treatment",
tumor_vol = "TumorVolume",
trt_control = "Control",
drug_a = "DrugA",
drug_b = "DrugB",
combination = "Combination",
weights = nlme::varIdent(form = ~ 1|SampleID)
)
# Calculate the log-likelihood contribution
logLikSubjectDisplacements(model = lmm, var_name = "SampleID")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.