View source: R/landest_functions.R

ps.wgt.fun | R Documentation |

Calculates propensity score (or inverse probability of treatment) weights given the treatment indicator and available baseline (pretreatment) covariates.

```
ps.wgt.fun(treat, cov.for.ps, weight = NULL)
```

`treat` |
treatment indicator, should be 0/1. |

`cov.for.ps` |
matrix of covariates to be used to estimate propensity score (or inverse probability of treatment) weights |

`weight` |
a (n1+n0) by x matrix of weights where n1 = number of observations in treatment group 1 and n0 = number of observations in treatment group 0; used for perturbation-resampling, default is null. |

Let `Z_{i}`

denote the matrix of baseline (pretreatment) covariates and `G_i`

be the treatment group indicator such that `G_i = 1`

indicates treatment and `G_i = 0`

indicates control. This function estimates `P = P(G_i = 1 | Z_i)`

using logistic regression. The propensity score (or inverse probability of treatment) weights are then equal to `1/\hat{P}`

for those in treatment group 1 and `1/(1-\hat{P})`

for those in treatment group 0. These weights reflect the situation where the average treatment effect (ATE) is of interest, not average treatment effect in the treated (ATT).

propensity score (or inverse probability of treatment) weights

Layla Parast

Rosenbaum, P. R., & Rubin, D. B. (1983). The central role of the propensity score in observational studies for causal effects. Biometrika, 70(1), 41-55.

Rosenbaum, P. R., & Rubin, D. B. (1984). Reducing bias in observational studies using subclassification on the propensity score. Journal of the American Statistical Association, 79(387), 516-524.

```
data(example_obs)
W.weight = ps.wgt.fun(treat = example_obs$treat, cov.for.ps = as.matrix(example_obs$Z))
delta.iptw.km(tl=example_obs$TL, dl = example_obs$DL, treat = example_obs$treat, tt=2,
ps.weights = W.weight)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.