Learn R Programming

psrwe (version 3.2)

psrwe_borrow: Get number of subjects borrowed from each statum

Description

Based on PS distances or number of current control subjects, split the total number of subjects to be borrowed from the external data source for each stratum

Usage

psrwe_borrow(
  dtaps,
  total_borrow,
  method = c("distance", "inverse_distance", "n_current", "n_external"),
  .drop_arg_fml = FALSE,
  ...
)

Value

A class PSRWE_BORR list. It appends the following items to the dtaps:

Proportion

Proportion splitting the number of total borrow among strata.

N_Borrow

The number of subjects to be borrowed in each stratum.

Alpha

Weight parameter value in each stratum.

Arguments

dtaps

A class PSRWE_DTA or PSRWE_DTA_MAT object.

total_borrow

Total number of subjects to be borrowed

method

Method to split total_borrow for a class PSRWE_DTA object, which can be based on distance (method = "distance") or inverse distance (method = "inverse_distance"). Other possible options include "n_current" and "n_external" that use the proportion of stratum sample size based on the current and external data, respectively. Ignored for class PSRWE_DTA_MAT object.

.drop_arg_fml

internal use to drop arguments and call, this is only used in cjk.

...

Additional parameters for summary.PSRWE_DTA.

Examples

Run this code
data(ex_dta)
dta_ps <- psrwe_est(ex_dta,
                     v_covs = paste("V", 1:7, sep = ""),
                     v_grp = "Group",
                     cur_grp_level = "current")

ps_borrow <- psrwe_borrow(total_borrow = 20, dta_ps)
ps_borrow

## Use different similarity metric
ps_borrow_omkss <- psrwe_borrow(total_borrow = 20, dta_ps,
                                 metric = "omkss")
ps_borrow_omkss

Run the code above in your browser using DataLab