trips: Estimates propensity scores for three groups

Description Usage Arguments Details Examples

View source: R/triangle.psa.R

Description

The propensity score is

e(X)=P({ W }=1|X)

This function will estimate the propensity scores for each pair of groups (e.g. two treatments and one control).

Usage

1
2
trips(thedata, treat, formu = ~., groups = unique(treat), nstrata = 5,
  method = "logistic", ...)

Arguments

thedata

the data frame.

treat

vector or factor indicating the treatment/control assignment for thedata. Length must be equal to nrow(thedata).

formu

the logistic regression formula. Note that the dependent variable should not be specified and will be modified.

groups

a vector of exactly length three corresponding the values in treat for each control/treatment.

nstrata

the number of strata marks to plot on the edge.

method

the method to use to estimate the propensity scores. Current options are logistic or randomForest.

...

other parameters passed to glm.

Details

{ PS }_{ 1 }=e({ X }_{ { T }_{ 1 }C })=Pr(z=1|{ X }_{ { T }_{ 1 }C })

{ PS }_{ 2 }=e({ X }_{ { T }_{ 2 }C })=Pr(z=1|{ X }_{ { T }_{ 2 }C })

{ PS }_{ 3 }=e({ X }_{ { T }_{ 2 }{ T }_{ 1 } })=Pr(z=1|{ X }_{ { T }_{ 2 }{ T }_{ 1 } })

Examples

1
2
3
4
5
6
7
8
## Not run: 
data(tutoring)
formu <- ~ Gender + Ethnicity + Military + ESL + EdMother + EdFather + Age +
     Employment + Income + Transfer + GPA
tpsa <- trips(tutoring, tutoring$treat, formu)
head(tpsa)

## End(Not run)

Example output

Loading required package: ggplot2
Loading required package: scales
Loading required package: reshape2
Loading required package: ez
  id   treat model1 model2 model3       ps1        ps2       ps3 strata1
1  1 Control  FALSE  FALSE     NA 0.1191192 0.07710180        NA       3
2  2 Control  FALSE  FALSE     NA 0.1148481 0.07211163        NA       3
3  3 Control  FALSE  FALSE     NA 0.2703441 0.18373130        NA       5
4  4 Control  FALSE  FALSE     NA 0.1419821 0.18941772        NA       4
5  5 Control  FALSE  FALSE     NA 0.1950559 0.19734792        NA       5
6  6  Treat1   TRUE     NA   TRUE 0.2038571         NA 0.3573779       5
  strata2 strata3
1       3    <NA>
2       3    <NA>
3       5    <NA>
4       5    <NA>
5       5    <NA>
6    <NA>       2

TriMatch documentation built on May 2, 2019, 12:37 p.m.