R Under development (unstable) (2025-07-22 r88445 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(parfm) Loading required package: survival Loading required package: optimx > data(mastitis) > head(mastitis) Cowid Lower Upper Midpoint Status Heifer Quarter 1 1 282 310 296 1 1 1 2 1 291 319 305 0 1 2 3 1 287 315 301 0 1 3 4 1 318 346 332 0 1 4 5 2 155 189 172 1 1 1 6 2 65 99 82 1 1 2 > > mastitis$timeto <- as.numeric((mastitis$Midpoint * 4 / 365.25)) > > set.seed(1) > mastitis <- mastitis[sample(1:nrow(mastitis), 200), ] > > > ################################################################################ > #Example 4.4: The gamma frailty model for the udder quarter infection data # > #Duchateau and Janssen (2008, page 136) # > ################################################################################ > modParfm <- parfm(Surv(timeto, Status) ~ Heifer, + cluster="Cowid", + dist="weibull", + frailty="gamma", + data=mastitis) > modParfm Frailty distribution: gamma Baseline hazard distribution: Weibull Loglikelihood: -204.009 ESTIMATE SE p-val theta 1.721 0.359 rho 1.665 0.131 lambda 1.485 0.392 Heifer 0.707 0.420 0.093 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Kendall's Tau: 0.462 > > > ################################################################################ > #Example 4.7 The inverse Gaussian frailty model for the udder quarter # > #infection data # > #Duchateau and Janssen (2008, page 156) # > ################################################################################ > mastitis <- data.frame(mastitis, + timeto=as.numeric((mastitis$Midpoint *4 / 365.25))) > modParfm <- parfm(Surv(timeto, Status) ~ Heifer, + cluster="Cowid", + dist="weibull", + frailty="ingau", + data=mastitis) > modParfm Frailty distribution: inverse Gaussian Baseline hazard distribution: Weibull Loglikelihood: -208.328 ESTIMATE SE p-val theta 8.633 5.199 rho 1.641 0.127 lambda 2.418 1.152 Heifer 0.249 0.390 0.523 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Kendall's Tau: 0.422 > > > ################################################################################ > #Example 4.10 The positive stable frailty model for the udder quarter # > #infection data # > #Duchateau and Janssen (2008, page 169) # > ################################################################################ > mastitis <- data.frame(mastitis, + timeto=as.numeric((mastitis$Midpoint *4 / 365.25))) > modParfm <- parfm(Surv(timeto, Status) ~ Heifer, + cluster="Cowid", + dist="weibull", + frailty="possta", + data=mastitis) > modParfm Frailty distribution: positive stable Baseline hazard distribution: Weibull Loglikelihood: -211.673 ESTIMATE SE p-val nu 0.529 0.047 rho 1.830 0.151 lambda 0.424 0.115 Heifer 0.161 0.478 0.736 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Kendall's Tau: 0.529 > > proc.time() user system elapsed 14.92 0.68 15.54