Learn R Programming

marp

An R package to apply model-averaging on renewal process.

Install

You can install the released version of marp from GitHub with:

if(!require(devtools)){
    install.packages("devtools")
    library(devtools)
}

devtools::install_github("kanji709/marp")

Example

Here is a basic example which shows you how to use marp:

# load R package - marp
library(marp)

# generate a small dataset
data <- rgamma(100,3,0.01)

# set parameters
m <- 10 # number of iterations for MLE optimization
t <- seq(100,200,by=10) # time intervals
B <- 99 # number of bootstraps
BB <- 99 # number of double-bootstrapps
alpha <- 0.05 # confidence level
y <- 304 # cut-off time point for probablity estimation
model_gen <- 2 # specifying the data generating model (if known)

# step one: fitting differnt renewal models
res1 <- marp::poisson_rp(dat,t,y)
res2 <- marp::gamma_rp(dat,t,m,y)
res3 <- marp::loglogis_rp(dat,t,m,y)
res4 <- marp::weibull_rp(dat,t,m,y)
res5 <- marp::lognorm_rp(dat,t,y)
res6 <- marp::bpt_rp(dat,t,m,y)

# step two: model selection and obtain model-averaged estimates
res <- marp::marp(dat,t,m,y,which.model = 2)

# step three: construct different confidence intervals (including model-averaged CIs)
ci <- marp::marp_confint(dat,m,t,B,BB,alpha,y,model_gen)

Copy Link

Version

Install

install.packages('marp')

Monthly Downloads

45

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Jie Kang

Last Published

August 11th, 2022

Functions in marp (0.1.0)

loglogis_rp

A function to fit Log-Logistics renewal model
percent_confint

A function to calculate percentile bootstrap confidence interval
pllog

Probability function of Log-Logistics model
lognorm_rp

A function to fit Log-Normal renewal model
lognorm_bstrp

A function to generate (double) bootstrap samples and fit Log-Normal renewal model
lowerT

An utility function to calculate upper limit of T statistic
marp

A function to apply model-averaged renewal process
weibull_bstrp

A function to generate (double) bootstrap samples and fit Weibull renewal model
weibull_logl

A function to calculate the log-likelihood of Weibull model
weibull_rp

A function to fit Weibull renewal model #' @import weibull_logl
marp_bstrp

A function to fit model-averaged renewal process
marp_confint

A function to apply model-averaged renewal process
student_confint

A function to calculate Studentized bootstrap confidence interval
poisson_rp

A function to fit Poisson renewal model
poisson_bstrp

A function to generate (double) bootstrap samples and fit Poisson renewal model
upperT

An utility function to calculate lower limit of T statistic
bpt_rp

A function to fit BPT renewal model
bpt_bstrp

A function to generate (double) bootstrap samples and fit BPT renewal model
gamma_rp

A function to fit Gamma renewal model
bpt_logl

A function to calculate the log-likelihood of BPT model
gamma_logl

A function to calculate the log-likelihood of Gamma model
loglogis_bstrp

A function to generate (double) bootstrap samples and fit Log-Logistic renewal model
gamma_bstrp

A function to generate (double) bootstrap samples and fit Gamma renewal model
dllog

Density function of Log-Logistics model
loglogis_logl

A function to calculate the log-likelihood of Log-Logistics model