Title: | Longitudinal Concordance Correlation |
---|---|
Description: | Estimates the longitudinal concordance correlation to access the longitudinal agreement profile. The estimation approach implemented is variance components approach based on polynomial mixed effects regression model, as proposed by Oliveira, Hinde and Zocchi (2018) <doi:10.1007/s13253-018-0321-1>. In addition, non-parametric confidence intervals were implemented using percentile method or normal-approximation based on Fisher Z-transformation. |
Authors: | Thiago de Paula Oliveira [aut, cre] , Rafael de Andrade Moral [aut] , Silvio Sandoval Zocchi [ctb] , Clarice Garcia Borges Demetrio [ctb] , John Hinde [aut] |
Maintainer: | Thiago de Paula Oliveira <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.0.0 |
Built: | 2024-11-21 03:35:08 UTC |
Source: | https://github.com/prof-thiagooliveira/lcc |
lcc
ObjectCalculates the Akaike Information Criterion (AIC) or the Bayesian Information Criterion (BIC)
for a fitted longitudinal concordance correlation model represented by an lcc
object.
Calculates the Bayesian Information Criterion (BIC) for a fitted
longitudinal concordance correlation model represented by an lcc
object.
BIC is used for model selection, with lower values indicating a better model.
## S3 method for class 'lcc' AIC(object, ..., k = 2) ## S3 method for class 'lcc' BIC(object, ...)
## S3 method for class 'lcc' AIC(object, ..., k = 2) ## S3 method for class 'lcc' BIC(object, ...)
object |
An object of class |
... |
Optional arguments passed to the underlying |
k |
Numeric value used as a penalty coefficient for the number of
parameters in the fitted model; the default |
The function computes AIC or BIC values as a measure of the relative quality of
statistical models for a given set of data. Lower AIC or BIC values indicate a
better model fit with fewer parameters. For more information, refer to the methods
for AIC
objects.
The function computes BIC as a measure of the trade-off between model fit and
complexity. It is particularly useful for comparing models with different numbers
of parameters. For more information, refer to the documentation for BIC
.
lcc
, summary.lcc
,
coef.lcc
, vcov.lcc
lcc
, summary.lcc
,
coef.lcc
, vcov.lcc
, AIC.lcc
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) AIC(fm1) ## End(Not run) ## Not run: attach(simulated_hue) fm6 <- lcc(data = simulated_hue, subject = "Fruit", resp = "Hue", method = "Method", time = "Time", qf = 2, qr = 1, components = TRUE, time_lcc = list(n=50, from=min(Time), to=max(Time))) AIC(fm6) BIC(fm6) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) AIC(fm1) ## End(Not run) ## Not run: attach(simulated_hue) fm6 <- lcc(data = simulated_hue, subject = "Fruit", resp = "Hue", method = "Method", time = "Time", qf = 2, qr = 1, components = TRUE, time_lcc = list(n=50, from=min(Time), to=max(Time))) AIC(fm6) BIC(fm6) ## End(Not run)
lcc
ObjectCompares the fit of different longitudinal concordance correlation models (lcc objects). When comparing multiple models, the function returns a data frame with degrees of freedom, log-likelihood, AIC, and BIC for each model. For a single model, it returns F-values and P-values for fixed terms in the model.
## S3 method for class 'lcc' anova(object, ..., test = TRUE, type = c("sequential", "marginal"), adjustSigma = TRUE, verbose = FALSE)
## S3 method for class 'lcc' anova(object, ..., test = TRUE, type = c("sequential", "marginal"), adjustSigma = TRUE, verbose = FALSE)
object |
An object inheriting from class |
... |
Other optional fitted model objects inheriting from classes "lcc" or "lme". |
test |
Logical; if |
type |
Character string specifying the type of sum of squares for F-tests. Options are "sequential" or "marginal". Defaults to "sequential". |
adjustSigma |
Logical; if |
verbose |
Logical; if |
This function is an adaptation from anova.lme
.
It assesses whether the addition of terms significantly improves model fit.
## Not run: fm1.aov <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 1) fm2.aov <- update(fm1.aov, qr = 2) anova(fm1.aov, fm2.aov) ## End(Not run) ## Not run: fm3.aov <- update(fm2.aov, REML = FALSE) fm4.aov <- update(fm2.aov, REML = FALSE, qf = 3) anova(fm3.aov, fm4.aov) ## End(Not run) ## Not run: fm5.aov <- update(fm2.aov, var.class = varExp, weights.form = "time") anova(fm1.aov, fm2.aov, fm5.aov) ## End(Not run)
## Not run: fm1.aov <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 1) fm2.aov <- update(fm1.aov, qr = 2) anova(fm1.aov, fm2.aov) ## End(Not run) ## Not run: fm3.aov <- update(fm2.aov, REML = FALSE) fm4.aov <- update(fm2.aov, REML = FALSE, qf = 3) anova(fm3.aov, fm4.aov) ## End(Not run) ## Not run: fm5.aov <- update(fm2.aov, var.class = varExp, weights.form = "time") anova(fm1.aov, fm2.aov, fm5.aov) ## End(Not run)
The fixed effects estimated and corresponding random effects estimates are obtained at subject levels less or equal to i. The resulting estimates are returned as a data frame, with rows corresponding to subject levels and columns to coefficients.
## S3 method for class 'lcc' coef(object, ...)
## S3 method for class 'lcc' coef(object, ...)
object |
an object inheriting from class |
... |
optional arguments passed to the |
See methods for nlme
objects to get more
details.
Thiago de Paula Oliveira, [email protected]
lcc
, summary.lcc
,
lccPlot
, vcov.lcc
## Not run: fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) coef(fm1) ## End(Not run)
## Not run: fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) coef(fm1) ## End(Not run)
lcc
ObjectExtracts and prints the fitted values from an object of class
lcc
, as returned by modeling functions. The function allows selection
of different types of fitted values based on longitudinal data analysis.
## S3 method for class 'lcc' fitted(object, type = "lcc", digits = NULL, ...)
## S3 method for class 'lcc' fitted(object, type = "lcc", digits = NULL, ...)
object |
An object of class |
type |
The type of fitted values to extract: "lcc" for longitudinal concordance correlation, "lpc" for longitudinal Pearson correlation, or "la" for longitudinal accuracy. Defaults to "lcc". |
digits |
Minimum number of significant digits to be printed.
Default is |
... |
Additional arguments (currently not used). |
The function prints the fitted values and returns them as a data frame.
data(hue) fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, components = TRUE) fitted(fm1) fitted(fm1, type = "lpc") fitted(fm1, type = "la")
data(hue) fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, components = TRUE) fitted(fm1) fitted(fm1, type = "lpc") fitted(fm1, type = "la")
This internal helper function is used to format the columns of a data frame for printing, specifically for use within the 'print.anova.lcc' function. It applies special formatting rules based on the column name, such as rounding and special handling of small p-values.
formatColumn(column, colName)
formatColumn(column, colName)
column |
A vector representing a column from a data frame. |
colName |
A string indicating the name of the column, which determines the formatting rules to be applied. |
The function specifically handles the following columns: - "p-value": Rounds the values to four decimal places, and represents values less than 0.0001 as "<.0001". - "AIC", "BIC", "logLik", "L.Ratio": Applies 'zapsmall' for formatting. Other columns are returned without changes.
A vector with the same length as 'column', where each element has been formatted according to the column-specific rules.
data <- data.frame( pvalue = c(0.00005, 0.0234, 0.5), AIC = c(123.4567, 234.5678, 345.6789) ) data$pvalue <- formatColumn(data$pvalue, "p-value") data$AIC <- formatColumn(data$AIC, "AIC")
data <- data.frame( pvalue = c(0.00005, 0.0234, 0.5), AIC = c(123.4567, 234.5678, 345.6789) ) data$pvalue <- formatColumn(data$pvalue, "p-value") data$AIC <- formatColumn(data$AIC, "AIC")
Retrieves the variance-covariance matrix of the specified component from a fitted
lcc
model object. The function can extract different types of variance-covariance
matrices based on the specified component type.
## S3 method for class 'lcc' getVarCov(obj, type = "random.effects", ...)
## S3 method for class 'lcc' getVarCov(obj, type = "random.effects", ...)
obj |
An object of class |
type |
Specifies the type of variance-covariance matrix to extract.
Options are |
... |
Optional arguments passed to the underlying |
This function is useful for detailed inspection of the variance components
in different aspects of the model. For more information on the types of variance-covariance
matrices and their interpretations, refer to the documentation of the nlme
package.
lcc
, summary.lcc
,
coef.lcc
, vcov.lcc
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) getVarCov(fm1) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) getVarCov(fm1) ## End(Not run)
An observational study conducted at the Vegetable Production Department
at "Luiz de Queiroz" College of Agriculture/University of São Paulo in
2010/2011 to evaluate the peel color of 20 papaya fruits cv. Sunrise Solo over
time. The color hue was measured on the equatorial region of each fruit
using four points observed by the colorimeter and 1,000 points observed
by the scanner. Thus, the circular mean hue was calculated for each
fruit by each device at time . The aim of the agreement study was to
assess how well the colorimeter agreed with the scanner over time.
data(hue)
data(hue)
A data frame with 554 observations on the mean hue variable. The format is:
H_mean |
numeric; mean hue of papaya's peel |
Method |
a factor with levels Colorimeter ,
Scanner |
Time |
integer; time in days |
Fruit |
a factor with 20 levels; from 1 to 20 |
where each level is represented by one fruit. |
Oliveira, T.P.; Hinde, J.; Zocchi S.S. Longitudinal Concordance Correlation Function Based on Variance Components: An Application in Fruit Color Analysis. Journal of Agricultural, Biological, and Environmental Statistics, v. 23, n. 2, 233–254, 2018.
Oliveira, T.P.; Zocchi S.S.; Jacomino, A.P. Measuring color hue in 'Sunrise Solo' papaya using a flatbed scanner. Rev. Bras. Frutic., v. 39, n. 2, e-911, 2017.
Oliveira, T.P.; Hinde, J.; Zocchi S.S. Longitudinal Concordance Correlation Function Based on Variance Components: An Application in Fruit Color Analysis. Journal of Agricultural, Biological, and Environmental Statistics, v. 23, n. 2, 233–254, 2018.
lcc
.
data(hue) summary(hue) str(hue) ## Second degree polynomial model with random intercept, slope and ## quadratic term including an exponential variance function using ## time as covariate. model<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, components = TRUE, time_lcc = list(from = min(hue$Time), to = max(hue$Time), n=40), var.class=varExp, weights.form="time") summary(model, type="model") summary(model, type="lcc") ## for discussion on the analysis of complete data set, ## see Oliveira et al. (2018)
data(hue) summary(hue) str(hue) ## Second degree polynomial model with random intercept, slope and ## quadratic term including an exponential variance function using ## time as covariate. model<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, components = TRUE, time_lcc = list(from = min(hue$Time), to = max(hue$Time), n=40), var.class=varExp, weights.form="time") summary(model, type="model") summary(model, type="lcc") ## for discussion on the analysis of complete data set, ## see Oliveira et al. (2018)
The lcc
function gives fitted values and
non-parametric bootstrap confidence intervals for LCC,
longitudinal Pearson correlation (LPC), and longitudinal accuracy
(LA) statistics. These statistics can be estimated using different
structures for the variance-covariance matrix for random effects
and variance functions to model heteroscedasticity among the
within-group errors using or not the time as a covariate.
lcc(data, resp, subject, method, time, interaction, qf, qr, covar, gs, pdmat, var.class, weights.form, time_lcc, ci, percentileMet, alpha, nboot, show.warnings, components, REML, lme.control, numCore)
lcc(data, resp, subject, method, time, interaction, qf, qr, covar, gs, pdmat, var.class, weights.form, time_lcc, ci, percentileMet, alpha, nboot, show.warnings, components, REML, lme.control, numCore)
data |
an object of class |
resp |
character string. Name of the response variable in the data set. |
subject |
character string. Name of the subject variable in the data set. |
method |
character string. Name of the method variable in the data set. The first level of method is used as the gold-standard method. |
time |
character string. Name of the time variable in the data set. |
interaction |
an option to estimate the interaction effect
between |
qf |
an integer specifying the degree time polynomial trends,
normally 1, 2 or 3. (Degree 0 is not allowed). Default is
|
qr |
an integer specifying random effects terms to account for
subject-to-subject variation. Note that |
covar |
character vector. Name of the covariates to be included
in the model as fixed effects. Default to |
gs |
character string. Name of method level which represents the gold-standard. Default is the first level of method. |
pdmat |
standard classes of positive-definite matrix structures
defined in the |
var.class |
standard classes of variance functions to model the
variance structure of within-group errors using covariates, see
|
weights.form |
character string. An one-sided formula
specifying a variance covariate and, optionally, a grouping factor
for the variance parameters in the |
time_lcc |
regular sequence for time variable merged with
specific or experimental time values used for LCC, LPC, and LA
predictions. Default is
|
ci |
an optional non-parametric boostrap confidence interval
calculated for the LCC, LPC and LA statistics. If |
percentileMet |
an optional method for calculating the
non-parametric bootstrap intervals. If |
alpha |
significance level. Default is 0.05. |
nboot |
an integer specifying the number of bootstrap samples. Default is 5,000. |
show.warnings |
an optional argument that shows the number of
convergence errors in the bootstrap samples. If |
components |
an option to print LPC and LA statistics. If
|
REML |
if |
lme.control |
a list of control values for the estimation
algorithm to replace the default values of the function
|
numCore |
number of cores used in parallel during bootstrapping computation. Default is 1. |
an object of class lcc. The output is a list with the following components:
model |
summary of the polynomial mixed-effects regression model. |
Summary.lcc |
fitted values
for the LCC or LCC, LPC and LA (if |
data |
the input dataset. |
Thiago de Paula Oliveira, [email protected], Rafael de Andrade Moral, John Hinde
Lin, L. A Concordance Correlation Coefficient to Evaluate Reproducibility. Biometrics, 45, n. 1, 255-268, 1989.
Oliveira, T.P.; Hinde, J.; Zocchi S.S. Longitudinal Concordance Correlation Function Based on Variance Components: An Application in Fruit Color Analysis. Journal of Agricultural, Biological, and Environmental Statistics, v. 23, n. 2, 233–254, 2018.
Oliveira, T.P.; Moral, R.A.; Zocchi, S.S.; Demetrio, C.G.B.; Hinde, J. lcc: an R packageto estimate the concordance correlation, Pearson correlation, and accuracy over time. PeerJ, 8:c9850, 2020. DOI:10.7717/peerj.9850
summary.lcc
, fitted.lcc
,
print.lcc
, lccPlot
,
plot.lcc
, coef.lcc
,
ranef.lcc
, vcov.lcc
,
getVarCov.lcc
, residuals.lcc
,
AIC.lcc
data(hue) ## Second degree polynomial model with random intercept, slope and ## quadratic term fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(fm1) summary(fm1) summary(fm1, type="model") lccPlot(fm1) + ylim(0,1) + geom_hline(yintercept = 1, linetype = "dashed") + scale_x_continuous(breaks = seq(1,max(hue$Time),2)) ## Estimating longitudinal Pearson correlation and longitudinal #accuracy fm2 <- update(fm1, components = TRUE) summary(fm2) lccPlot(fm2) + ylim(0,1) + geom_hline(yintercept = 1, linetype = "dashed") + scale_x_continuous(breaks = seq(1,max(hue$Time),2)) + theme_bw() ## Not run: ## A grid of points as the Time variable for prediction fm3 <- update(fm2, time_lcc = list(from = min(hue$Time), to = max(hue$Time), n=40)) summary(fm3) lccPlot(fm3) + ylim(0,1) + geom_hline(yintercept = 1, linetype = "dashed") + scale_x_continuous(breaks = seq(1,max(hue$Time),2)) + theme_bw() ## End(Not run) ## Including an exponential variance function using time as a #covariate. fm4 <- update(fm2,time_lcc = list(from = min(hue$Time), to = max(hue$Time), n=30), var.class=varExp, weights.form="time") summary(fm4, type="model") fitted(fm4) fitted(fm4, type = "lpc") fitted(fm4, type = "la") lccPlot(fm4) + geom_hline(yintercept = 1, linetype = "dashed") lccPlot(fm4, type = "lpc") + geom_hline(yintercept = 1, linetype = "dashed") lccPlot(fm4, type = "la") + geom_hline(yintercept = 1, linetype = "dashed") ## Not run: ## Non-parametric confidence interval with 500 bootstrap samples fm5 <- update(fm1, ci = TRUE, nboot = 500) summary(fm5) lccPlot(fm5) + geom_hline(yintercept = 1, linetype = "dashed") ## End(Not run) ## Considering three methods of color evaluation ## Not run: data(simulated_hue) attach(simulated_hue) fm6 <- lcc(data = simulated_hue, subject = "Fruit", resp = "Hue", method = "Method", time = "Time", qf = 2, qr = 1, components = TRUE, time_lcc = list(n=50, from=min(Time), to=max(Time))) summary(fm6) lccPlot(fm6, scales = "free") lccPlot(fm6, type="lpc", scales = "free") lccPlot(fm6, type="la", scales = "free") detach(simulated_hue) ## End(Not run) ## Including an additional covariate in the linear predictor ## (randomized block design) ## Not run: data(simulated_hue_block) attach(simulated_hue_block) fm7 <- lcc(data = simulated_hue_block, subject = "Fruit", resp = "Hue", method = "Method",time = "Time", qf = 2, qr = 1, components = TRUE, covar = c("Block"), time_lcc = list(n=50, from=min(Time), to=max(Time))) summary(fm7) lccPlot(fm7, scales="free") detach(simulated_hue_block) ## End(Not run) ## Testing interaction effect between time and method fm8 <- update(fm1, interaction = FALSE) anova(fm1, fm8) ## Not run: ## Using parallel computing with 3 cores, and a set.seed(123) to verify model reproducibility. set.seed(123) fm9 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, ci=TRUE, nboot = 30, numCore = 3) # Repeating same model with same set seed. set.seed(123) fm10 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, ci=TRUE, nboot = 30, numCore = 3) ## Verifying if both fitted values and confidence intervals are identical identical(fm9$Summary.lcc$fitted,fm10$Summary.lcc$fitted) ## End(Not run)
data(hue) ## Second degree polynomial model with random intercept, slope and ## quadratic term fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(fm1) summary(fm1) summary(fm1, type="model") lccPlot(fm1) + ylim(0,1) + geom_hline(yintercept = 1, linetype = "dashed") + scale_x_continuous(breaks = seq(1,max(hue$Time),2)) ## Estimating longitudinal Pearson correlation and longitudinal #accuracy fm2 <- update(fm1, components = TRUE) summary(fm2) lccPlot(fm2) + ylim(0,1) + geom_hline(yintercept = 1, linetype = "dashed") + scale_x_continuous(breaks = seq(1,max(hue$Time),2)) + theme_bw() ## Not run: ## A grid of points as the Time variable for prediction fm3 <- update(fm2, time_lcc = list(from = min(hue$Time), to = max(hue$Time), n=40)) summary(fm3) lccPlot(fm3) + ylim(0,1) + geom_hline(yintercept = 1, linetype = "dashed") + scale_x_continuous(breaks = seq(1,max(hue$Time),2)) + theme_bw() ## End(Not run) ## Including an exponential variance function using time as a #covariate. fm4 <- update(fm2,time_lcc = list(from = min(hue$Time), to = max(hue$Time), n=30), var.class=varExp, weights.form="time") summary(fm4, type="model") fitted(fm4) fitted(fm4, type = "lpc") fitted(fm4, type = "la") lccPlot(fm4) + geom_hline(yintercept = 1, linetype = "dashed") lccPlot(fm4, type = "lpc") + geom_hline(yintercept = 1, linetype = "dashed") lccPlot(fm4, type = "la") + geom_hline(yintercept = 1, linetype = "dashed") ## Not run: ## Non-parametric confidence interval with 500 bootstrap samples fm5 <- update(fm1, ci = TRUE, nboot = 500) summary(fm5) lccPlot(fm5) + geom_hline(yintercept = 1, linetype = "dashed") ## End(Not run) ## Considering three methods of color evaluation ## Not run: data(simulated_hue) attach(simulated_hue) fm6 <- lcc(data = simulated_hue, subject = "Fruit", resp = "Hue", method = "Method", time = "Time", qf = 2, qr = 1, components = TRUE, time_lcc = list(n=50, from=min(Time), to=max(Time))) summary(fm6) lccPlot(fm6, scales = "free") lccPlot(fm6, type="lpc", scales = "free") lccPlot(fm6, type="la", scales = "free") detach(simulated_hue) ## End(Not run) ## Including an additional covariate in the linear predictor ## (randomized block design) ## Not run: data(simulated_hue_block) attach(simulated_hue_block) fm7 <- lcc(data = simulated_hue_block, subject = "Fruit", resp = "Hue", method = "Method",time = "Time", qf = 2, qr = 1, components = TRUE, covar = c("Block"), time_lcc = list(n=50, from=min(Time), to=max(Time))) summary(fm7) lccPlot(fm7, scales="free") detach(simulated_hue_block) ## End(Not run) ## Testing interaction effect between time and method fm8 <- update(fm1, interaction = FALSE) anova(fm1, fm8) ## Not run: ## Using parallel computing with 3 cores, and a set.seed(123) to verify model reproducibility. set.seed(123) fm9 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, ci=TRUE, nboot = 30, numCore = 3) # Repeating same model with same set seed. set.seed(123) fm10 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, ci=TRUE, nboot = 30, numCore = 3) ## Verifying if both fitted values and confidence intervals are identical identical(fm9$Summary.lcc$fitted,fm10$Summary.lcc$fitted) ## End(Not run)
lcc
ObjectThis function generates a plot of predictions versus the time covariate for
an lcc
object. Predicted values are connected by lines, while actual
observations are denoted by circles. If components=TRUE
was used in the
lcc
object, individual plots for each statistic (LCC, LPC, and LA) are
produced on separate pages.
lccPlot(obj, type = "lcc", control = list(), ...)
lccPlot(obj, type = "lcc", control = list(), ...)
obj |
An object inheriting from class "lcc", representing a fitted lcc model. |
type |
Character string specifying the type of plot to generate.
|
control |
A list of graphical control values or character strings returned
by the |
... |
Additional arguments passed to the
|
An object of class ggplot
or viewport
, depending on the
all.plot
setting in control
.
Thiago de Paula Oliveira, [email protected]
data(hue) # Second degree polynomial model with random intercept, slope and quadratic term fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, components = TRUE) lccPlot(fm1, type = "lcc") lccPlot(fm1, type = "lpc") lccPlot(fm1, type = "la") # Using ggplot2 themes lccPlot(fm1, type = "lpc") + theme_bw() + labs(x = "Time (Days)", y = "LPC Value") # Generating and saving plots ## Not run: ggsave("lccPlot.pdf", lccPlot(fm1, type = "lcc")) ## End(Not run)
data(hue) # Second degree polynomial model with random intercept, slope and quadratic term fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2, components = TRUE) lccPlot(fm1, type = "lcc") lccPlot(fm1, type = "lpc") lccPlot(fm1, type = "la") # Using ggplot2 themes lccPlot(fm1, type = "lpc") + theme_bw() + labs(x = "Time (Days)", y = "LPC Value") # Generating and saving plots ## Not run: ggsave("lccPlot.pdf", lccPlot(fm1, type = "lcc")) ## End(Not run)
lcc
ObjectIf REML=TRUE
, the default, returns the
restricted log-likelihood value of the linear mixed-effects model;
else the log-likelihood value
## S3 method for class 'lcc' logLik(object, ..., REML)
## S3 method for class 'lcc' logLik(object, ..., REML)
object |
an object inheriting from class |
... |
further arguments passed to |
REML |
an optional logical value. If |
See methods for nlme
objects to get more
details.
Thiago de Paula Oliveira, [email protected]
## Not run: fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) logLik(fm1) ## End(Not run)
## Not run: fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) logLik(fm1) ## End(Not run)
lcc
ObjectGenerates a series of diagnostic plots for evaluating the fit of a linear
mixed-effects model represented by an lcc
object. This function
provides six types of plots, including residual plots, fitted value
comparisons, and normal Q-Q plots. Users can select specific plots or display
all by default.
## S3 method for class 'lcc' plot(x, which = c(1L:6L), caption = list("Residuals vs Fitted", "Residuals vs Time", "Residuals by Subject", "Observed values vs Fitted values", "Normal Q-Q Plot (Conditional residuals)", "Normal Q-Q Plot (Random effects)"), sub.caption = NULL, main = NULL, panel = if(add.smooth) panel.smooth else points, add.smooth = TRUE, ask = TRUE, id.n = 3, labels.id = names(residuals(x)), label.pos = c(4, 2), cex.id = 0.75, cex.caption = 1, cex.oma.man = 1.25, ...)
## S3 method for class 'lcc' plot(x, which = c(1L:6L), caption = list("Residuals vs Fitted", "Residuals vs Time", "Residuals by Subject", "Observed values vs Fitted values", "Normal Q-Q Plot (Conditional residuals)", "Normal Q-Q Plot (Random effects)"), sub.caption = NULL, main = NULL, panel = if(add.smooth) panel.smooth else points, add.smooth = TRUE, ask = TRUE, id.n = 3, labels.id = names(residuals(x)), label.pos = c(4, 2), cex.id = 0.75, cex.caption = 1, cex.oma.man = 1.25, ...)
x |
An object of class |
which |
A numeric vector specifying which plots to display. The valid range is c(1L:6L), corresponding to the plot types. |
caption |
Captions for the plots, provided as a vector or list of valid graphics annotations. Default captions are provided for each plot. |
sub.caption |
A common sub-title for all plots; defaults to
|
main |
The main title for the plots, displayed above the captions. |
panel |
Panel function to be used for adding points to the plots.
Defaults to |
add.smooth |
Logical; indicates whether a smoother should be added
to most plots. Defaults to |
ask |
Logical; if |
id.n |
Number of extreme points to label in the first three plots. |
labels.id |
Labels for the extreme points, defaulting to observation
numbers if |
label.pos |
Positioning of labels in the left and right halves of the graph, applicable for plots 1-3. |
cex.id |
Magnification factor for point labels. |
cex.caption |
Size of the plot captions. |
cex.oma.man |
Size of the overall margin annotation (applies only
if |
... |
Additional graphical parameters passed to |
The Q-Q plots use normalized residuals. Standardized residuals are pre-multiplied
by the inverse square-root factor of the estimated error correlation matrix,
while random effects are adjusted using the estimated variances from matrix G.
Simulation envelopes in Q-Q plots are generated using the hnp
package.
The function is partly adapted from plot.lm
.
Thiago de Paula Oliveira, [email protected]
lccPlot
, lcc
,
mtext
, text
, plotmath
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) plot(fm1) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) plot(fm1) ## End(Not run)
lcc
ObjectMethod print for the anova.lcc
.
## S3 method for class 'anova.lcc' print(x, verbose, ...)
## S3 method for class 'anova.lcc' print(x, verbose, ...)
x |
an object inheriting from class
|
verbose |
an optional logical value used to control the amount
of printed output. If |
... |
further arguments passed to |
Modified from anova.lme
. For more details see
methods for nlme
.
Thiago de Paula Oliveira, [email protected]
## Not run: ## Second degree polynomial model with random intercept, slope and ## quadratic term fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(anova(fm1)) ## End(Not run)
## Not run: ## Second degree polynomial model with random intercept, slope and ## quadratic term fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(anova(fm1)) ## End(Not run)
lcc
ObjectsPrints detailed information about the fitted longitudinal
concordance correlation model contained in an lcc
object.
## S3 method for class 'lcc' print(x, digits = NULL, ...)
## S3 method for class 'lcc' print(x, digits = NULL, ...)
x |
An object of class |
digits |
Minimum number of significant digits to be printed in values.
Default is |
... |
Further arguments passed to |
The function is used for its side effect of printing and returns
the input lcc
object invisibly.
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(fm1) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(fm1) ## End(Not run)
lcc
ObjectProvides a detailed summary of a fitted longitudinal concordance correlation model, including AIC, BIC, log-likelihood, and other relevant statistics. The function supports detailed output for different types of model fits.
## S3 method for class 'summary.lcc' print(x, verbose = FALSE, digits = NULL, ...)
## S3 method for class 'summary.lcc' print(x, verbose = FALSE, digits = NULL, ...)
x |
An object of class |
verbose |
Logical value to control the amount of printed output for
model details. Defaults to |
digits |
Specifies the minimum number of significant digits to be
printed in values. Default is |
... |
Further arguments passed to |
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(summary(fm1, type = "model")) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) print(summary(fm1, type = "model")) ## End(Not run)
lcc
ModelExtracts the estimated random effects from a fitted longitudinal concordance
correlation model represented by an lcc
object. The function returns
a data frame with rows corresponding to different groups at a specified level
and columns representing the random effects.
## S3 method for class 'lcc' ranef(object, ...)
## S3 method for class 'lcc' ranef(object, ...)
object |
An object inheriting from class |
... |
Optional arguments passed to the |
This function is useful for examining the random effects associated with
groups or subjects in the model. For a detailed explanation of these effects,
see the documentation for nlme
objects.
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) ranef(fm1) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) ranef(fm1) ## End(Not run)
Extracts residuals from the fitted longitudinal concordance correlation
model represented by an lcc
object. Different types of residuals can
be obtained based on the specified type.
## S3 method for class 'lcc' residuals(object, type = "response", ...)
## S3 method for class 'lcc' residuals(object, type = "response", ...)
object |
An object of class |
type |
A character string specifying the type of residuals to extract.
Options are |
... |
Optional arguments passed to the |
The function provides a convenient way to examine the differences between
observed and predicted values in the model. Understanding these residuals
can be crucial for model diagnostics and validation. For more information,
refer to the methods for nlme
objects.
lcc
, summary.lcc
,
coef.lcc
, vcov.lcc
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) residuals(fm1) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) residuals(fm1) ## End(Not run)
Simulated hue data set based on papaya's maturation over time considering three methods of measurement.
data(simulated_hue)
data(simulated_hue)
A simulated data frame with 6,000 observations on the mean hue variable. The format is:
Hue |
numeric; mean hue of papaya's peel |
Method |
a factor with levels labelled from Method 1 to Method 3 |
Time |
integer; time in days from 0 to 19 |
Fruit |
a factor with 100 levels labelled from 1 to 100 |
where each level is represented by one fruit. |
A total of 100 fruits were observed over 20 days by three methods to evaluate the mean hue of fruit's peel. The aim of the agreement study was to assess how well the methods 2, and 3 agreed with method 1 over time.
lcc
.
data(simulated_hue) summary(simulated_hue) str(simulated_hue)
data(simulated_hue) summary(simulated_hue) str(simulated_hue)
Simulated hue data set based on papaya's maturation over time considering four methods of measurement in a randomized block design.
data(simulated_hue_block)
data(simulated_hue_block)
A simulated data frame with 24,000 observations on the mean hue variable. The format is:
Hue |
numeric; mean hue of papaya's peel |
Block |
factor with levels labelled from 1 to 3 |
Method |
a factor with levels labelled from Method 1 ,
to Method 4 |
Time |
integer; time in days from 0 to 19 |
Fruit |
a factor with 300 levels labelled from 1 to 300 |
where each level is represented by one fruit. |
A total of 100 fruits by block were observed over 20 days by four methods to evaluate the mean hue of fruit's peel. We considered three blocks in this simulation. The aim of the agreement study was to assess how well the methods 2, 3, and 4 agreed with method 1 over time.
lcc
.
data(simulated_hue_block) summary(simulated_hue_block) str(simulated_hue_block)
data(simulated_hue_block) summary(simulated_hue_block) str(simulated_hue_block)
lcc
ObjectAdditional information about the fit of longitudinal
concordance correlation, longitudinal Pearson correlation, and
longitudinal accuracy represented by an object of class
lcc
. The returned object has a
print
method.
## S3 method for class 'lcc' summary(object, type, adjustSigma, verbose, ...)
## S3 method for class 'lcc' summary(object, type, adjustSigma, verbose, ...)
object |
an object inheriting from class
|
type |
an optional character string specifying the type of
output to be returned. If |
adjustSigma |
an optional logical value used when |
verbose |
an optional logical value used to control the amount
of output in the |
... |
not used. |
an object inheriting from class summary.lcc
including:
fitted |
the fitted values extracted from the
|
gof |
the goodness of fit (gof) measurement is calculated using the concordance correlation coefficient between fitted and observed values. Value of 1 denote perfect concordance. |
AIC |
the Akaike Information Criterion corresponding to object. |
BIC |
the Bayesian Information Criterion corresponding to object. |
logLik |
If |
Thiago de Paula Oliveira, [email protected]
AIC
, BIC
,
print.summary.lcc
, lcc
## Second degree polynomial model with random intercept, slope and ## quadratic term fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) summary(fm1, type="model") summary(fm1, type="lcc")
## Second degree polynomial model with random intercept, slope and ## quadratic term fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) summary(fm1, type="model") summary(fm1, type="lcc")
Extracts the variance-covariance matrix of the fixed effects from a fitted
lcc
model object. This function provides insights into the variability
and covariance structure of the fixed effects in the model.
## S3 method for class 'lcc' vcov(object, ...)
## S3 method for class 'lcc' vcov(object, ...)
object |
An object of class |
... |
Optional arguments passed to the |
The function specifically retrieves the variance-covariance matrix associated
with the fixed effects of the lcc
object, which is useful for understanding
the relationship between these effects. For more details on variance-covariance
matrices, refer to the methods for nlme
objects.
summary.lcc
, lccPlot
,
lcc
, coef.lcc
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) vcov(fm1) ## End(Not run)
## Not run: fm1 <- lcc(data = hue, subject = "Fruit", resp = "H_mean", method = "Method", time = "Time", qf = 2, qr = 2) vcov(fm1) ## End(Not run)