if_direct {graphPAF}R Documentation

Internal: Calculation of an impact fraction using the direct approach

Description

Internal: Calculation of an impact fraction using the direct approach

Usage

if_direct(
  data,
  ind,
  model,
  model_type,
  new_data,
  prev,
  t_vector,
  response,
  weight_vec
)

Arguments

data

A dataframe containing variables used for fitting the model

ind

An indicator of which rows will be used from the dataset

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.

model_type

Either a "clogit", "glm" or "coxph" model object

new_data

A dataframe (of the same variables and size as data) representing an alternative distribution of risk factors

prev

Population prevalence of disease (default NULL)

t_vector

A vector of times at which PAF estimates are desired (for a coxph model)

response

A string representing the name of the outcome variable in data

weight_vec

An optional vector of inverse sampling weights

Value

A numeric estimated impact fraction.


[Package graphPAF version 2.0.0 Index]