Title: | Propensity Score Matching for Unordered 3-Group Data |
---|---|
Description: | 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. This method was described by Alvaro Fuentes (2022) <doi:10.1080/00273171.2021.1925521>. |
Authors: | Qiang LIU [aut, cre] |
Maintainer: | Qiang LIU <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2024-11-20 06:51:13 UTC |
Source: | CRAN |
Generate new data and define the data.
datach(data, x)
datach(data, x)
data |
A data entry is required. |
x |
The 3 categorical variables that you make matches for. |
A list with data.
Propensity score matching for unordered 3-group data
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. |
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.
A list with data.
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)
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)
Identification and formatting of data.
pm3datalist(data, x, y, covs, factor = NULL)
pm3datalist(data, x, y, covs, factor = NULL)
data |
A data entry is required. |
x |
The 3 categorical variables that you make matches for. |
y |
Your result variable. |
covs |
Enter the relevant covariates. |
factor |
Define categorical variables. |
A data.
Generate propensity scores and generate the data to be matched.
data |
A data entry is required. |
x |
The 3 categorical variables that you make matches for. |
y |
Your result variable. |
covs |
Enter the relevant covariates. |
factor |
Define categorical variables. |
A list with data.
A data on indicators for premature newborns.
data(prematurity)
data(prematurity)
An object of class data.frame
with 189 rows and 11 columns.
data(prematurity)
data(prematurity)