An R package to apply model-averaging on renewal process.
You can install the released version of marp
from GitHub with:
if(!require(devtools)){
install.packages("devtools")
library(devtools)
}
::install_github("kanji709/marp") devtools
Here is a basic example which shows you how to use
marp
:
# load R package - marp
library(marp)
# generate a small dataset
<- rgamma(100,3,0.01)
data
# set parameters
<- 10 # number of iterations for MLE optimization
m <- seq(100,200,by=10) # time intervals
t <- 99 # number of bootstraps
B <- 99 # number of double-bootstrapps
BB <- 0.05 # confidence level
alpha <- 304 # cut-off time point for probablity estimation
y <- 2 # specifying the data generating model (if known)
model_gen
# step one: fitting differnt renewal models
<- marp::poisson_rp(dat,t,y)
res1 <- marp::gamma_rp(dat,t,m,y)
res2 <- marp::loglogis_rp(dat,t,m,y)
res3 <- marp::weibull_rp(dat,t,m,y)
res4 <- marp::lognorm_rp(dat,t,y)
res5 <- marp::bpt_rp(dat,t,m,y)
res6
# step two: model selection and obtain model-averaged estimates
<- marp::marp(dat,t,m,y,which.model = 2)
res
# step three: construct different confidence intervals (including model-averaged CIs)
<- marp::marp_confint(dat,m,t,B,BB,alpha,y,model_gen) ci