ipsw.lg: Calculate pseudo-weights using inverse propensity score...

View source: R/weighting_functions.R

ipsw.lgR Documentation

Calculate pseudo-weights using inverse propensity score weighting (IPSW)

Description

This function computes IPSW pseudo-weights using logistic regression to predict propensity scores.

Usage

ipsw.lg(psa_dat, wt, rsp_name, formula)

Arguments

psa_dat

Dataframe of the combined non-probability and probability sample

wt

Name of the weight variable in psa_dat (common weights of 1 for non-probability sample, and survey weights for probability sample)

rsp_name

Name of the non-probability sample membership indicator in psa_dat (1 for non-probability sample units, and 0 for probability sample units)

formula

Formula of the regression model

Value

A vector of IPSW pseudo-weights

Examples

# IPSW with example data
ipsw_w <- ipsw.lg(simu_dat, "wt", "trt", "trt_f ~ x1+x2+x3+x4+x5+x6+x7")
# Compute weighted mean of y in non-prob data
sum((simu_dat$y[simu_dat$trt == 1]*ipsw_w)/sum(ipsw_w))

chkern/KWML documentation built on Sept. 10, 2022, 9:49 p.m.