Learn R Programming

nonrandom (version 1.42)

ps.makestrata: Propensity score stratification

Description

Stratification based on the estimated propensity score

Usage

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.

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:
  • dataa data frame containing the input data, extended by column(s) including stratum indices labeled by name.stratum.index.
  • name.stratum.indexa string indicating the name of the variable containing the stratum indices, generated at last.
  • stratum.indexa numeric vector containing the stratum indices labeled by 'name.stratum.index'.
  • intervalsa vector of characters indicating intervals corresponding to stratum.index.
  • stratified.bya string indicating the name of the stratification variable.
  • formula.pscorea formula describing formally the propensity score model fitted at last in pscore().
  • model.pscorean object of class glm containing information about the propensity score model fitted at last in pscore().
  • name.pscorea string indicating the name of the propensity score estimated at last in pscore().
  • pscorea numeric vector containing the estimated propensity score labeled by 'name.pscore'.
  • name.treata string indicating the name of treatment used.
  • treata numeric vector containing treatment labeled by 'name.treat'.

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.

See Also

cut, quantile

Examples

Run this code
## 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")

Run the code above in your browser using DataLab