50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

icensBKL (version 1.1)

icsurv2cdf: Conversion of icsurv objects in a data.frame

Description

Convert an object of class icsurv (created by several functions of the package Icens to a two-column data.frame that can be easily used to plot the fitted distribution function.

Usage

icsurv2cdf(fit)

Arguments

fit

an object of class icsurv, typically obtained by one of the functions EM, PGM, VEM, ISDM, EMICM of the package Icens.

Value

A data.frame with columns labeled time and cdf.

See Also

EM, PGM, VEM, ISDM, EMICM.

Examples

Run this code
# NOT RUN {
### Distribution function of the emergence of tooth 44 on boys
### (this example: only a subset of boys)
data("tandmob", package="icensBKL")
Boys <- subset(tandmob, fGENDER=="boy")
Sboy <- Surv(Boys$L44, Boys$R44, type="interval2")

Aboy <- subset(Boys, select=c("L44", "R44"))
Aboy$L44[is.na(Aboy$L44)] <- 0
Aboy$R44[is.na(Aboy$R44)] <- 20    ## 20 = infinity in this case
fitB.NPMLE <- EMICM(Aboy)
print(fitB.NPMLE)
plot(fitB.NPMLE)

fitB.NPMLE <- icsurv2cdf(fitB.NPMLE)
print(fitB.NPMLE)
plot(fitB.NPMLE$time, fitB.NPMLE$cdf, type="l", xlim=c(6, 13), ylim=c(0, 1),
     xlab="Age (years)", ylab="Proportion emerged")
# }

Run the code above in your browser using DataLab