Package 'resilience'

Title: Predictors of Resilience to a Stressor in a Single-Arm Study
Description: Studies of resilience in older adults employ a single-arm design where everyone experiences the stressor. The simplistic approach of regressing change versus baseline yields biased estimates due to regression-to-the-mean. This package provides a method to correct the bias. It also allows covariates to be included. The method implemented in the package is described in Varadhan, R., Zhu, J., and Bandeen-Roche, K (2023), Biostatistics (To appear).
Authors: Ravi Varadhan [aut, cre], Jiafeng Zhu [ctb]
Maintainer: Ravi Varadhan <[email protected]>
License: GPL (>= 2)
Version: 2024.1.2
Built: 2024-11-21 03:03:36 UTC
Source: https://github.com/cran/resilience

Help Index


Identifying Predictors of Resilience to Stressors in Single-Arm Studies of Pre-Post Change

Description

Studies of resilience in older adults are typically conducted with a single-arm where everyone experiences the stressor. The simplistic approach of regressing change versus baseline yields biased estimates due to mathematical coupling and regression-to-the-mean. This function provides a method to correct the bias.

Details

Package: resilience
Type: Package
Version: 2023.1.1
Date: 2023-08.21
License: GPL (version 2)
LazyLoad: yes

The package contains a singe function prepost, which implements the method of Varadhan, Zhu, and Bandeen-Roche (2023) to correct for the bias of naive analysis of pre-post change in studies of resilience.

Author(s)

Ravi Varadhan.

Maintainers: Ravi Varadhan <[email protected]>

References

Varadhan, R., Zhu, J., and Bandeen-Roche, K (2023). Identifying Predictors of Resilience to Stressors in Single-Arm Studies of Pre-Post Change. Biostatistics. To appear.


Identifying Predictors of Resilience to Stressors in Single-Arm Studies of Pre-Post Change

Description

Studies of resilience in older adults are typically conducted with a single-arm where everyone experiences the stressor. The simplistic approach of regressing change versus baseline yields biased estimates due to mathematical coupling and regression-to-the-mean. This function provides a method to correct the bias.

Usage

prepost(formula, data, change=TRUE, k=c(1.0,1.5, 2.0), m=1, nboot=1000, 
    ci.level=0.95, boot.method=c("perc", "norm", "basic", "bca"),
    ncores=2)

Arguments

formula

formula object where LHS is Post response variable and RHS is pre-response variable plus the covariates; note: the first variable of the RHS of the formula must be the pre-response variable. For example, y2 ~ y1 + x1 + x2.

data

data-frame containing all the variables. Only complete cases are used in the analysis, i.e. rows of dataframe with missing values in any of the predictors are automatically deleted.

k

A sensitivity analysis parameter. Typically, it is greater than or equal to 1.0. It is recommended that the user provide at least two values to examine how the effects vary with ‘k’. Default setting allows three values: k = 1.0, 1.5, and 2.0. For more details about this parameter refer to the manuscript.

m

Another sensitivity analysis parameter. It is set equal to 1.0. It is recommended that the user not change this unless there is information from an external study to justify a diferent value. For more details about this parameter refer to the manuscript.

change

A logical variable. If TRUE the dependent variable of regression is the pre-post change. If FALSE, the post response is used as the dependent variable.

nboot

Number of boot strap samples for calculating the confidence intervals of corrected regression coefficients. Default is 1000.

ci.level

Confidence coefficient for confidence interval. Default is 95% confidence intervals.

boot.method

The bootstrap method for confidence interval. Four options are provided: percentile, normal approximation, basic, and bias-corrected accelerated bootstrap. Default is “percentile.”

ncores

Number of cores avaialble for parallel computing. Default is set to 2 due to CRAN requirements. If more cores are available, the user can utilize all available cores with the command:
ncores = parallel::detectCores()

Details

The function uses the parallel and foreach packages to perform parallel computations of bootstrap confidence intervals for different values of the sensitivity parameter, ‘k.’

Value

beta.naive

Unadjusted, naive estimates of regression coefficients

corrected.beta

The corrected coefficients of the variables. A matrix with one column of parameter values for each value of sensitivity parameter ‘k.’

CI

A list of length equal to the number of sensitivity values. Each component of the list is a matrix with two columns of lower and upper confidence interval for each parameter.

Author(s)

Ravi Varadhan

References

Varadhan, R., Zhu, J., and Bandeen-Roche, K (2023). Identifying Predictors of Resilience to Stressors in Single-Arm Studies of Pre-Post Change. Biostatistics. To appear.

Examples

data(tkr)

names(tkr.dat)
dim(tkr.dat)

# pre-post change regression
ans1 <- prepost(post.Y ~ pre.Y + I(age-mean(age)) + I((age - mean(age))^2) + 
bmi + gender + as.factor(smoker), data=tkr.dat, k=c(1.2, 1.5), nboot=200)
print(ans1)

# Post regression
ans2 <- prepost(post.Y ~ pre.Y + I(age-mean(age)) + I((age - mean(age))^2) + 
bmi + gender + as.factor(smoker), data=tkr.dat, 
k=c(1.2, 1.5), change=FALSE, nboot=200, boot.method="norm")
print(ans2)

# without any covariates
ans3 <- prepost(post.Y ~ pre.Y, data=tkr.dat, k=c(1.2, 2.0), nboot=200)
print(ans3)

# Bootstrapping using "bca" - realtively slow
# Not run
#ans4 <- prepost(post.Y ~ pre.Y, data=tkr.dat, k=c(1.2, 2.0), change=FALSE,
#boot.method = "bca")

Pre-post stressor response data

Description

A data set with 900 rows and 6 columns

gender

Binary variable, 555 Female and 345 Male

age

Continuous variable, range from 60 to 100

bmi

Continuous variable, range from 16 to 55, with 44 missing values

smoker

Three-level factor, 819 no, 25 yes, and 56 unknown

post.Y

Continuous variable, post-stressor measure, range from 10 to 58, with 43 missing values

pre.Y

Continuous variable, pre-stressor measure, range from 9 to 66, with 196 missing values

Usage

data(tkr)

Format

An object of class data.frame with 900 rows and 6 columns.