Description Usage Arguments Details Value Examples
Takes output from make_long() and applies censoring by creating a made-up, linear, hard-coded relationship between the probability of being censored at each observation time and SES. The relationship is as follows:
1 2 | apply_censoring(data_in = NULL, ses_coef = 0.1, age_coef = 0.2,
protected = c(1, 1.25, 1.5, 1.75, 2, 3))
|
data_in |
an object returned from calculate_ses() |
ses_coef |
a number near .1 that controls how much 1-(ses_i -min(ses))/(max(ses)-min(ses)) contributes to the probability of censoring |
age_coef |
a number near .2 that controls how much (age - min(age))/(max(age)-min(age)) contributes to the probability of censoring |
protected |
a vector corresponding to age / colnames of age_vec that are protected from censoring so that fpca.face() wont bonk |
prob.cens <- ses_coef*(1-(data_in$ses-min(data_in$ses))/(max(data_in$ses)-min(data_in$ses))) + age_coef*( (data_in$age-min(data_in$age))/(max(data_in$age)-min(data_in$age)))
So that as age increases, so does the probability of a censoring event occurring, whereas as ses for an individual increases, the prob of a censoring event decreases. The coefficients out front control how strong the effect is. Names are hard coded, so stick to script in the examples.
prob.cens as a column added to data_in representing the probability of being censored at that time.
instudy.sim as a column added to data_in representing whether that particular observation is instudy (1) or not (0)
instudy as a column added to data_in builds upon instudy.sim in that once instudy.sim is 0 instudy is 0 for all remaining observation times
1 2 3 4 5 6 7 8 | d<-prep_data()
head(d)
over_samp_mat<-sample_data(d,1000)
with_ses <- calculate_ses(over_samp_mat)
long <-make_long(with_ses)
head(long)
censored <- apply_censoring(long)
head(censored,18)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.