plot.PAF_q: Plot impact fractions corresponding to risk-quantiles over...

View source: R/plot_PAF_continuous.R

plot.PAF_qR Documentation

Plot impact fractions corresponding to risk-quantiles over several risk factors

Description

Plot impact fractions corresponding to risk-quantiles over several risk factors

Usage

## S3 method for class 'PAF_q'
plot(x, ...)

Arguments

x

A PAF_q object. This is a dataframe that is created by running the function PAF_calc_continuous.

...

Other global arguments inherited by that might be passed to the ggplot routine

Value

A ggplot2 plotting object for PAF_q over the differing risk factors in x

Examples

library(splines)
library(survival)
library(parallel)
options(boot.parallel="snow")
options(boot.ncpus=2)
# The above could be set to the number of available cores on the machine
model_continuous <- glm(formula = case ~ region * ns(age, df = 5) +
sex * ns(age, df = 5) + education +exercise + ns(diet, df = 3) +
 alcohol + stress + ns(lipids,df = 3) + ns(waist_hip_ratio, df = 3) +
  high_blood_pressure, family = "binomial", data = stroke_reduced)
out <- PAF_calc_continuous(model_continuous,riskfactor_vec=
c("diet","lipids","waist_hip_ratio"),q_vec=c(0.1,0.9),
ci=FALSE,calculation_method="B",data=stroke_reduced)
plot(out)

# example with more quantile points and including confidence intervals
# (more useful - but a bit slower to run)
out <- PAF_calc_continuous(model_continuous,riskfactor_vec=
c("diet","lipids","waist_hip_ratio"),q_vec=c(0.01, 0.1,0.3,0.5,0.7,0.9),
ci=TRUE,calculation_method="B",data=stroke_reduced)
plot(out)


graphPAF documentation built on Feb. 16, 2023, 6:24 p.m.