cprobit {cprobit}R Documentation

Apply the three-step workflow for the analysis of two repeated outcomes from each subject

Description

Apply the three-step workflow for the analysis of two repeated outcomes from each subject

Usage

cprobit(
  formula,
  dat,
  index,
  transform = NULL,
  lambda = NA,
  resid_pval_threshold = 0.05
)

## S3 method for class 'cprobit'
summary(object, plot = FALSE, ...)

## S3 method for class 'cprobit'
print(x, ...)

Arguments

formula

Formula for the model. Do not convert data type within the formula (e.g., factor(x) is not supported in formula). See Details.

dat

A data.frame in the long format, with each row corresponding to one measurement from one subject, and two columns indicating the subject and case ID respecitively. Variable names must not contain space or special characters.

index

Names of variables indicating subject and case ID. Case ID must be coded as integers 1 and 2.

transform

Whether a Box-Cox transformation should be applied to the outcome, taking value NULL (the default), TRUE or FALSE.

lambda

Value of the Box-Cox transformation parameter to use. Default is NA, in which case it will be estimated from data.

resid_pval_threshold

The threshold for the Lilliefors p-value of the residuals to determine whether a Box-Cox transformation on the outcome is necessary. Default is 0.05.

object

Model fitted using cprobit function.

plot

Wether residual qq-plots should be plotted. Default is FALSE.

...

Additional arguments affecting the summary produced (not yet implemented).

x

Model fitted using cprobit function.

Details

Specify the formula for the repeated measurements instead of the change in the outcome, but without any time-invariant component that would have been eliminated after taking the difference. Interaction between two variables can be specified in the formula using * or :, but users need to create their own variable for interaction involving three or more variables.

If transform = NULL, the workflow will determine the need for a Box-Cox transforamtion on the outcome (i.e., Step 3) based on the residual diagnostics in Step 2. A Box-Cox transforamtion will be used if the p-value of the Lilliefors test is smaller than resid_pval_threshold (default is 0.05). If transform = TRUE, analyses will always be performed on both the observed and Box-Cox transformed outcomes. If transform = FALSE, analysis will only be performed on the observed outcomes.

Value

Returns a list.

References

Examples

# Apply the three-step workflow to assess the association between the
# baseline glucose variability and the change in the glucose variability in
# the subsequent two days.
# Although age and gender are available, they do not need to be explicitly
# adjusted for in the cprobit model.
data(bg_variability)
head(bg_variability)
model <- cprobit(formula = y ~ t + t:sd0, dat = bg_variability,
                 index = c("subject_id", "case_id"))
summary(model, plot = TRUE)

[Package cprobit version 1.0.2 Index]