Skip to contents

This function is used to statistical inference of model parameters. The methods including maximum likelihood estimator and Bayesian inference.

Usage

sta_infer(
  method = "MLE",
  process = "Wiener",
  type = "classical",
  data = NULL,
  p = 0.975,
  par = c(1, 1),
  chains = 1,
  warmup = 1000,
  iter = 2000,
  cores = 1,
  s = NULL,
  rel = NULL
)

Arguments

method

time.

process

Wiener, Gamma or Inverse Gaussian process.

type

classical in default.

data

degradation data.

p

in default `p=0.975`.

par

initial parameter.

chains

in default `chains = 1`

warmup

in default `warmup = 1000`.

iter

in default `iter= 2000`.

cores

cores = 1,

s

stress.

rel

relationship.

Value

Returns a data frame if method is MLE, returns stan raw results if method is Bayes.

Examples

dat <- sim_dat(
  group = 5, t = 1:200, para = c(2, 3),
  process = "Wiener", type = "classical",
  s = NULL, rel = NULL
)
# MLE
mle_fit <- sta_infer(
  method = "MLE", process = "Wiener",
  type = "classical", data = dat
)
mle_fit
#>         low   mean     up
#> [1,] 1.7401 1.9246 2.1092
#> [2,] 2.8396 2.9701 3.1006
# Bayes
# rstan_options(auto_write = TRUE)
# options(mc.cores = parallel::detectCores())
# bayes_fit = sta_infer(method = "Bayes", process = "Wiener",
# type = "classical", data = dat)
# bayes_fit$summary
# print(bayes_fit$summary, probs = c(0.025,0.5,0.975),pars = c("mu","w"))
# plot(bayes_fit$stan_re)
# traceplot(bayes_fit$stan_re,pars = c("mu","w"),
#            inc_warmup = TRUE,nrow = 1) +
#    theme(legend.position = "top")