AFfunction {AFheritability}R Documentation

Plot the attributable fraction as a function of heritability, disease prevalence, size of target group and intervention effect.

Description

AFfunction is a function which illustrates the AF as a function of heritability, disease prevalence, size of target group and intervention effect.

Usage

AFfunction(Prevalence, Heritability, Target, Intervention, xaxis, compare,
  Intervention_type = "location", plot = TRUE, legend = TRUE,
  cex = 1.4, ...)

Arguments

Prevalence

an estimate of the disease prevalence

Heritability

an estimate of the disease heritability

Target

proportion of those at highest genetic risk being targeted by the intervention

Intervention

effect of intervention

xaxis

option to specify which of the arguments Prevalence, Heritability, Target or Intervention should be used as the xaxis of the plot. The argument xaxis is a string with values "Prevalence", "Heritability", "Target" or "Intervention".

compare

option to specify which of the arguments Prevalence, Heritability, Target or Intervention should be used for comparisons. The argument compare can be specified as a numeric vector with a range of values or as a single value, see examples.

Intervention_type

an option to specify how the intervention is expected to affect the genetic liability distribution. The default option "location" assumes that the intervention shifts the genetic liability distribution to lower levels, among those targeted by the intervention. The option "scale" assumes that the intervention reduce the variance of the genetic liability distribution, among those targeted by the intervention.

plot

option to return a plot. Default is set to TRUE.

legend

option to return a legend in the plot. Default is set to TRUE.

cex

specifies the text size in the plot. Default is set to size 1.4.

...

further arguments to be passed to the ggplot function. See ggplot.

Details

The AFfunction() is a function that produce a plot of the AF as a function of Prevalence, Heritability, Target or Intervention. A user interface of the function is provided in runShinyApp.

Value

AF

the AF as a function of heritability, disease prevalence, size of target group and intervention effect.

plot

Plot of the AF as a function of either heritability, disease prevalence, size of target group and intervention effect. The legend shows a comparison variable.

References

Dahlqwist E et al. (2019) <doi:10.1007/s00439-019-02006-8>.

Examples

# Example
heritability <- seq(0,1, by=0.1)
target_sizes <- sort(c(0.30, 0.25, 0.20, 0.15, 0.05, 0.01))

AF_h <- AFfunction(Prevalence=0.5, Heritability = heritability,
                   Target = target_sizes, Intervention = 1,
                   compare="Target", xaxis = "Heritability",
                   ylim = c(0,0.3), cex = 1.6)

AF_h

[Package AFheritability version 0.1.0 Index]