## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", echo = TRUE, warning = FALSE, message = FALSE ) library(OneShotEM) ## ----data-example------------------------------------------------------------- data(electro_explosive) print(electro_explosive) ## ----exp-fit------------------------------------------------------------------ fit_exp <- oneshot_em( formula = cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "exponential" ) summary(fit_exp) ## ----weibull-fit-------------------------------------------------------------- fit_weibull <- oneshot_em( formula = cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "weibull" ) summary(fit_weibull) ## ----compare-fit-------------------------------------------------------------- fit_npm <- oneshot_fit(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "weibull", method = "npm") fit_tm <- oneshot_fit(cbind(r, n) ~ temp, data = electro_explosive, it = "it", dist = "weibull", method = "tm") cat("New eM-Algorithm Iterations: ", fit_npm$iterations, "\n") cat("Traditional EM Iterations: ", fit_tm$iterations, "\n") ## ----plotting, fig.width = 6, fig.height = 4---------------------------------- plot(fit_weibull, type = "fitted") plot(fit_weibull, type = "survival")