ps.makestrata: Propensity score stratification

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ps.makestrata.R

Description

Stratification based on the estimated propensity score

Usage

1
2
 ps.makestrata(object, breaks=NULL, name.stratum.index="stratum.index",
 stratified.by=NULL, ...)

Arguments

object

an object of class 'pscore' or a data frame.

breaks

an integer, a numeric vector or suitable R function, e.g quantile(). The default is 'NULL', i.e. stratum bounds are automatically determined (see cut()).

name.stratum.index

a string indicating the variable name containing the stratum indices.

stratified.by

an integer or a string indicating the stratification variable in data. The default is NULL, i.e. if the class of the input object is 'pscore', object value 'pscore' is automatically used.

...

further arguments passed to or from other methods.

Details

Stratification by the estimated propensity score groups observations with identical or similar estimated propensity score.

If function pscore() is previously used with default settings, stratified.by has not to be specified. It is needed if the stratification variable is not labeled by 'pscore'.

Several options for the argument breaks are available. The default is 'NULL', i.e. values of the stratification variable are factorized and each factor correspond to a stratum. Using an integer, the number of strata is specified. If a numeric vector is given, its values indicate the stratum bounds.

Value

ps.makestrata() returns an object of class 'stratified.pscore' or 'stratified.data.frame' depending on the class of the input object. If the class of the input object is 'pscore', the output object inherits all components from the input object. The following components are available:

data

a data frame containing the input data, extended by column(s) including stratum indices labeled by name.stratum.index.

name.stratum.index

a string indicating the name of the variable containing the stratum indices, generated at last.

stratum.index

a numeric vector containing the stratum indices labeled by 'name.stratum.index'.

intervals

a vector of characters indicating intervals corresponding to stratum.index.

stratified.by

a string indicating the name of the stratification variable.

formula.pscore

a formula describing formally the propensity score model fitted at last in pscore().

model.pscore

an object of class glm containing information about the propensity score model fitted at last in pscore().

name.pscore

a string indicating the name of the propensity score estimated at last in pscore().

pscore

a numeric vector containing the estimated propensity score labeled by 'name.pscore'.

name.treat

a string indicating the name of treatment used.

treat

a numeric vector containing treatment labeled by 'name.treat'.

Author(s)

Susanne Stampf susanne.stampf@usb.ch

See Also

cut, quantile

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## STU1
data(stu1)
stu1.ps <- pscore(data    = stu1, 
                  formula = therapie~tgr+age)
stu1.strata <- ps.makestrata(object = stu1.ps)


## PRIDE
data(pride)
pride.ps <- pscore(data        = pride,
                   formula     = PCR_RSV~SEX+RSVINF+REGION+
                                 AGE+ELTATOP+EINZ+EXT,
                   name.pscore = "ps")
pride.strata <- ps.makestrata(object = pride.ps,
                              breaks = quantile(pride.ps$pscore,  
                                                seq(0,1,0.2)),
                              stratified.ps = "ps")

Example output

Loading required package: lme4
Loading required package: Matrix

nonrandom documentation built on May 29, 2017, 11:41 p.m.