pm3 {pm3} | R Documentation |
pm3
Description
Propensity score matching for unordered 3-group data
Arguments
data |
need a dataframe |
x |
Enter the 3 categorical variables to be matched.If x is a number, it must be of type 1,2,3. |
y |
Enter the outcome variable for your study. |
covs |
Covariates. Usually the other fitted variables of the model.This is also usually the baseline variable you need to match. |
factor |
Define the categorical variables in your data. |
CALIP |
The number used to match. Usually you don't need to change it. The default is 0.5. |
Details
You can use this program for 3 sets of categorical data for propensity score matching. Assume that the data has 3 different categorical variables. You can use it to perform propensity matching of baseline indicator groupings. The matching will make the differences in the baseline data smaller.
Value
A list with data.
Examples
bc<-prematurity
#####Generate data lists and extract data
g<-pm3(data=bc,x="race",y="low",covs=c("age","lwt","ptl"),
factor=c("ui","low","smoke"))
mbc<-g[["mbc"]]
####Compare before and after matching
library(tableone)
allVars <-c("age", "lwt", "ptl")
fvars<-c("ht")
tab2 <- CreateTableOne(vars = allVars, strata = "race" ,
data = bc, factorVars=fvars,addOverall = TRUE )
print(tab2,smd = TRUE)
tab1 <- CreateTableOne(vars = allVars, strata = "race" ,
data = mbc, factorVars=fvars,addOverall = TRUE )
print(tab1,smd = TRUE)