Description Usage Arguments Details Value References See Also Examples
View source: R/RVPedSim_Functions.R
Primarily intended as an internal function, trim_ped
chooses a proband and trims relatives based on the proband's probability of recalling his or her relatives.
1 |
ped_file |
An object of class |
recall_probs |
Numeric. The proband's recall probabilities for relatives, see details. If not supplied, the default value of four times kinship coefficient between the proband and the relative is used. |
By default recall_probs
is four times the kinship coefficient, as defined by Thompson (see references), between the proband and the probands relative, which results in a recall probability of 2^{-(n-1)} for a relative of degree n. Alternatively, the user may specify a list of recall probabilities of length l > 0, in which case the first l-1 items in recall_probs
are the respective proband recall probabilities for relatives of degree 1, 2, ..., l-1, and the lth item in recall_probs
is the proband's recall probability for all relatives of degree l or greater. For example if recall_probs = c(1)
all relatives will be recalled by the proband with probability 1.
Occasionally, a trimmed family member must be retained to ensure that the pedigree can be plotted. When this occurs, family members who share a non-zero kinship coefficient with the proband are censored of all pertinent information, and will always have the following qualities:
availability status = 0
affected status = NA
birth year = NA
onset year = NA
death year = NA
RR = NA
Users who wish to use trim_ped
for pedigrees not generated by sim_ped
or sim_RVped
must use new.ped
to create an object of class ped
. The ped
object must contain the following variables for each pedigree member:
name | type | description |
FamID | numeric | family identification number |
ID | numeric | individual identification number |
dadID | numeric | identification number of father |
momID | numeric | identification number of mother |
sex | numeric | gender identification; if male sex = 0 , if female sex = 1 |
affected | logical | disease-affection status: |
proband | logical | a proband identifier: proband = TRUE if the individual is the proband, and FALSE otherwise. |
affected = TRUE if affected by disease , and FALSE otherwise, |
||
birthYr | numeric | the individual's birth year. |
onsetYr | numeric | the individual's disease onset year, when applicable. |
deathYr | numeric | the individual's death year, when applicable. |
RR | numeric | the individual's relative risk of disease. |
available | logical | availibility status; |
available = TRUE if available, and FALSE otherwise. |
||
ped_trim
The trimmed pedigree.
Nieuwoudt, Christina and Jones, Samantha J and Brooks-Wilson, Angela and Graham, Jinko (2018). Simulating Pedigrees Ascertained for Multiple Disease-Affected Relatives. Source Code for Biology and Medicine, 13:2.
Thompson, E. (2000). Statistical Inference from Genetic Data on Pedigrees. NSF-CBMS Regional Conference Series in Probability and Statistics, 6, I-169.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #Read in example pedigree to trim
data(EgPeds)
egPeds <- new.ped(EgPeds)
#plot example_ped using kinship2
plot(subset(egPeds, FamID == 1), location = "topright", cex = 0.85)
mtext("Original Pedigree", side = 3, line = 2)
## Trim pedigree examples
# Illustrate the effect of various settings for recall_probs
Recall_Probabilities <- list(c(1),
c(1, 0.5),
c(1, 0.25, 0.1))
for (k in 1:length(Recall_Probabilities)) {
set.seed(2)
#trim pedigree
TrimPed <- trim_ped(ped_file = subset(egPeds, FamID == 1),
recall_probs = Recall_Probabilities[[k]])
plot(TrimPed, location = "topright", cex = 0.85)
mtext(paste0("recall_probs = (", sep = "",
paste(Recall_Probabilities[[k]], collapse = ", "), ')' ),
side = 3, line = 2 )
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.