-
Notifications
You must be signed in to change notification settings - Fork 0
affAtAge
Updated 17/10/2022
The repository is maintained by Thomas Spargo (thomas.spargo@kcl.ac.uk) - please reach out with any questions.
The affAtAge function pseudo-randomly assigns status of a person being affected (1) or not (0) by a disease based on age, variant status, and disease characteristics associated with variant status (see varChars).
Example for a person of relative age 3, who is known to have the variant (vargoup="var"):
#Define the variant characteristics using varChars function
var.Char<- varChars(f=0.75,g=0,numsteps=10,onsetRateDiff=1)
#Specify other parameters
vargroup <- "var"
age <- 3
#Assign status based on risk at start age
aff<-affAtAge(vargroup,age,var.Char)
vargroup - String indicating individual's variant status which is either "novar","var", or "possvar"(possvar is a person with 50% chance of being "var" or "novar").
age - Age of person relative to the baseline age at which the disease onsets (age 0 indicates 0 disease risk, age 1+ indicates >0 risk up until max risk according to variant status, as indicated in var.Char)
var.Char - A matrix in the format of the varChars function output (The input should have the class 'var.Char.matrix' which is assigned by the varChars function).
The var.Chars argument input is generated using varChars function See documentation here.
affAtAge is to be called recursively within the genFamily function.
A list of two elements.
$status
An integer of 1 or 0. 1 = affected by disease and 0 = not affected. These assignments are generated using rbinom with the settings: rbinom(n=1,size=1,prob = getProb).
$getProb
Numeric between 0 and 1, indicating the probability that the individual was affected at a given age, as passed to rbinom to determine status.