summary.coxedMargin {coxed}R Documentation

Marginal changes in expected duration

Description

This function reports summary statistics for the changes in duration that occur when comparing observations in newdata2 to observations in newdata as specified in the original call to coxed.

Usage

## S3 method for class 'coxedMargin'
summary(object, stat = "mean", ...)

Arguments

object

The output from coxed. If neither newdata or newdata2 are NULL, coxed is being calculate a marginal effect and the class of the coxed output will be "coxedMargin", so this function will be called by the generic summary function

stat

Either "mean" or "median"

...

For future methods

Details

coxed calculates a vector of expected durations for every observation in newdata2 and newdata (these data frames must have the same number of observations, and corresponding rows are assumed to refer to the same observation), and subtracts the expected duration from newdata2 from the expected duration from newdata. That generates a vector of marginal changes in duration for every observation. To generalize a finding across observations, either the mean (if type="mean") or the median (if type="median") of these differences is reported, along with the mean/median of the expected durations from each of the two covariate profiles. If bootstrap=TRUE in the call to coxed then a bootstrapped standard error and confidence interval is reported for each of these quantities as well.

Value

A data.frame containing the mean or median duration for each of newdata2 and newdata and the differences in these durations across the two covariate profiles. If bootstrap=TRUE in the call to coxed, the data frame also includes the bootstrapped standard error and confidence interval for these quantities.

Author(s)

Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>

See Also

coxed

Examples

mv.surv <- Surv(martinvanberg$formdur, event = rep(1, nrow(martinvanberg)))
mv.cox <- coxph(mv.surv ~ postel + prevdef + cont + ident + rgovm + pgovno + tpgovno +
     minority, method = "breslow", data = martinvanberg)
summary(mv.cox)

me <- coxed(mv.cox, method="npsf", bootstrap = FALSE,
            newdata = dplyr::mutate(martinvanberg, rgovm=0),
            newdata2 = dplyr::mutate(martinvanberg, rgovm=1.24))
summary(me, stat="mean")
summary(me, stat="median")

[Package coxed version 0.3.3 Index]