rescale_ps {beastt}R Documentation

Rescale a prop_scr object

Description

Rescale a prop_scr object

Usage

rescale_ps(x, n = NULL, scale_factor = NULL)

Arguments

x

a prop_scr obj

n

Desired sample size that the external data should effectively contribute to the analysis of the internal trial data. This will be used to scale the external weights if scale_factor is not specified

scale_factor

Value to multiple all weights by. This will be used to scale the external weights if n is not specified

Value

a prop_scr object with rescaled weights

Examples

library(dplyr)
ps_obj <- calc_prop_scr(internal_df = filter(int_binary_df, trt == 0),
                       external_df = ex_binary_df,
                       id_col = subjid,
                       model = ~ cov1 + cov2 + cov3 + cov4)
# weights in a propensity score object can be rescaled to achieve a desired
# effective sample size (i.e., sum of weights)
rescale_ps(ps_obj, n = 75)

# Or by a predetermined factor
rescale_ps(ps_obj, scale_factor = 1.5)


[Package beastt version 0.0.3 Index]