funnel_plot: Risk-adjusted funnel plot

View source: R/funnel_plot.R

funnel_plotR Documentation

Risk-adjusted funnel plot

Description

This function allows to construct a risk-adjusted funnel plot for comparing survival proportion between units, see Spiegelhalter (2005).

Usage

funnel_plot(data, ctime, p0, glmmod, followup, predlim = c(0.95, 0.99),
  assist)

Arguments

data

A data.frame with rows representing subjects and the following named columns:

entrytime:

time of entry into study (numeric);

survtime:

time from entry until event (numeric);

censorid:

censoring indicator (0 = right censored, 1 = observed), (integer);

unit:

integer or character indicating which unit (f.e. hospital) the observation belongs to.

and optionally additional covariates used for risk-adjustment.

ctime

Construction time at which the funnel plot should be determined. Maximum possible time used when not specified.

p0

The baseline failure probability at entrytime + followup for individuals. If not specified, average failure proportion over whole data is used instead.

glmmod

A generalized linear regression model as produced by the function glm(). Recommended:
glm(as.formula("(survtime <= followup) & (censorid == 1) ~ covariates"), data = data).
Alternatively, a list with the following elements:

formula:

a formula() in the form ~ covariates;

coefficients:

a named vector specifying risk adjustment coefficients for covariates. Names must be the same as in formula and colnames of data.

followup

The followup time for every individual. At what time after subject entry do we consider the outcome?

predlim

A vector of confidence levels for the prediction limits of interest. Default is c(0.95, 0.99).

assist

(optional): Output of the function parameter_assist()

Value

An object of class "funnelplot" containing:

  • data: A data.frame containing:

    unit:

    unit number/name;

    observed:

    observed number of failures at unit;

    expected:

    expected (risk-adjusted) number of failures at unit;

    numtotal

    total number of individuals considered at this unit;

    p:

    (risk-adjusted) proportion of failure at unit;

    predlimels:

    worse/in-control/better performance than expected at specified confidence levels.

  • call: the call used to obtain output

  • plotdata: data used for plotting confidence intervals

  • predlim: specified confidence level(s)

  • p0: (Estimated) baseline failure probability

Author(s)

Daniel Gomon

References

Spiegelhalter D. J. (2005). Funnel plots for comparing institutional performance. Statistics in medicine, 24(8), 1185-1202. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sim.1970")}

See Also

plot.funnelplot, summary.funnelplot

Other quality control charts: bk_cusum(), cgr_cusum()

Examples

#Determine a risk-adjustment model using a generalized linear model.
#Outcome (survival in first 100 days) is regressed on the available covariates:
exprfitfunnel <- as.formula("(survtime <= 100) & (censorid == 1)~ age + sex + BMI")
glmmodfun <- glm(exprfitfunnel, data = surgerydat, family = binomial(link = "logit"))
#Determine the necessary values to produce a funnel plot
funnel <- funnel_plot(data = surgerydat, ctime = 3*365, glmmod = glmmodfun, followup = 100)
#Produce a funnel plot!
plot(funnel)
## Not run: 
require(plotly)
#Create an interactive plot!
ggplotly(plot(funnel))

## End(Not run)

success documentation built on June 22, 2024, 10:19 a.m.