Description Usage Arguments Examples
View source: R/Fit Trunc Distr.r
For Untruncated fit, just leave out Att and rTrunc For uncenored fit, just leave out Lmt
1 2 3 4 5 |
y |
GU observations, for observations net of attachment/deductible, y = obs + Att |
Att |
the truncation points; |
Lmt |
the censoring limit |
ini |
the initial set of values; x is observations |
mtd |
the optimizing method, default is "Nelder-Mead", as it doesn't require gradient function |
parnames |
a vector that specify names of parameters |
gn_ll |
the gradient function of logliklihood, this is should be NULL, unless you are sure that the gradient function of the logliklihood is appropriate |
gn_ll_mtd |
when gn_ll is NULL, gradient function is generated using numerical differentiation, if this parameter is set as NULL, then no gradient function will be supplied to optimization, for other options refer to methods of the grad function from numDeriv package |
prior |
(BETA) priors for the parameters can be supplied, currently only normal and require specifying all parameters |
ll_scale |
(BETA) constant that scales loglikelihoods to be more normalized, default to 0 |
lower |
lower bound of the parameters, see optimx for more detail |
upper |
upper bound of the parameters, see optimx for more detail |
hessian |
whether to return hessian matrix at final paramters |
Func |
determines the distribution function, eg. "gamma", "lnorm", "pareto"; |
1 2 3 4 5 6 7 8 9 10 | n = 5000
x <- rgamma(n, shape=2, scale = 5)
Att <- sample(seq(0, 1, 0.2), n, replace = TRUE)
Lmt <- sample(seq(5, 20, 1), n, replace = TRUE)
x1 <- pmin(pmax(x - Att, 0), Lmt)
dat <- data.frame(cbind(x, Att, Lmt, x1))
dat1 <- dat[dat$x1 > 0, ]
(gammafit <- sevfit(y=dat1$x1, Att=dat1$Att, Lmt = dat1$Lmt, FUN="gamma", ini=c(2, 2), mtd="NM",
parnames=c("shape", "scale")))
AIC(gammafit)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.