# \donttest{
## Simulated Weibull data
require(icenReg)
set.seed(123)
simdata<-simIC_weib(70, inspections = 5, inspectLength = 1)
sp<-ic_sp(cbind(l, u) ~ x1 + x2, data = simdata)
res0<-maple.ph(cbind(l, u) ~ x1 + x2, data = simdata, M=c(2,20),
g=sp$coefficients, tau=7)
op<-par(mfrow=c(1,2))
plot(res0, which=c("likelihood","change-point"))
par(op)
res1<-mable.ph(cbind(l, u) ~ x1 + x2, data = simdata, M=res0$m,
g=c(.5,-.5), tau=7)
op<-par(mfrow=c(1,2))
plot(res1, y=data.frame(x1=0, x2=0), which="density", add=FALSE, type="l",
xlab="Time", main="Desnity Function")
lines(xx<-seq(0, 7, len=512), dweibull(xx, 2,2), lty=2, col=2)
legend("topright", bty="n", lty=1:2, col=1:2, c("Estimated","True"))
plot(res1, y=data.frame(x1=0, x2=0), which="survival", add=FALSE, type="l",
xlab="Time", main="Survival Function")
lines(xx, 1-pweibull(xx, 2, 2), lty=2, col=2)
legend("topright", bty="n", lty=1:2, col=1:2, c("Estimated","True"))
par(op)
# }
Run the code above in your browser using DataLab