- model
Either a clogit, glm or coxph fitted model object. Non-linear effects should be specified via ns(x, df=y), where ns is the natural spline function from the splines library.
- data
A dataframe containing variables used for fitting the model
- new_data
A dataframe (of the same variables and size as data) representing an alternative distribution of risk factors
- calculation_method
A character either 'B' (Bruzzi) or 'D' (Direct method). For case control data, the method described in Bruzzi 1985 is recommended. Bruzzi's method estimates PAF from relative risks and prevalence of exposure to the risk factor. The Direct method estimates PAF by summing estimated probabilities of disease in the absence of exposure on the individual level
- prev
estimated prevalence of disease. This only needs to be specified if the data source is from a case control study, and the direct method is used
- ci
Logical. If TRUE, a bootstrap confidence interval is computed along with point estimate (default FALSE)
- boot_rep
Integer. Number of bootstrap replications (Only necessary to specify if ci=TRUE)
- t_vector
Numeric. A vector of times at which to calculate PAF (only specified if model is coxph)
- ci_level
Numeric. Default 0.95. A number between 0 and 1 specifying the confidence level
- ci_type
Character. Default norm. A vector specifying the types of confidence interval desired. "norm", "basic", "perc" and "bca" are the available methods
- weight_vec
An optional vector of inverse sampling weights for survey data (note that variance will not be calculated correctly if sampling isn't independent). Note that this vector will be ignored if prev is specified, and the weights will be calibrated so that the weighted sample prevalence of disease equals prev.
- verbose
A logical indicator for whether extended output is produced when ci=TRUE, default TRUE