Description Usage Arguments Value See Also Examples
Fits a chosen density to loss data and draws plot of empirical and fitted density.
1 2 3 |
densfun |
a character string or a function returning a density evaluated at its first argument.
Distributions |
x |
an object with two columns (losses in second column) or vector of losses |
start |
a named list giving the parameters to be optimized with initial values (it can be omitted for the named distributions and must be for others) |
name |
if densfun is not a named function, |
qq |
if |
period |
could be |
ylim |
|
xlim |
|
col |
fitted density colour (default |
from |
start value of |
to |
end value of |
length.out |
desired length of the sequence p, |
by |
step in numeric vector of probabilities |
kernel |
smoothing kernel to be used; see |
n |
the number of equally spaced points at which the density is to be estimated; see |
draw.diff |
logical; draw differences between empirical and estimated density values? |
draw.max |
logical; draw maximal differences between empirical and estimated density values? |
xlog.scale |
a logical value (see |
... |
arguments passed to |
loglik |
the log-likelihood (from |
param |
fitted parameters (from |
sd |
estimated standard errors (from |
q.e |
vector of |
q.t |
vector of theoretical quantiles from fitted distribution |
ad |
absolute differences between empirical and fitted density values |
teor.dens |
fitted density values |
emp.dens |
empirical density values |
maxdiff |
maximum difference between empirical and fitted density values |
meandiff |
mean difference between empirical and fitted density values |
fitdistr
, optim
, qqplot
, period.loss
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | data(loss.data.object)
x<- read.loss(5,5,loss.data.object)
# first example:
mx<-x[,2]
par(mfrow=c(2,2))
loss.fit.dist("gamma",x)
loss.fit.dist("gamma",mx,col="blue") # no difference between mx and x
loss.fit.dist("gamma",mx,col = "darkgreen",qq=T)
# second example:
par(mfrow=c(2,1))
a = loss.fit.dist("inverse gaussian",col = "blue",x,qq=T)# there are emprical and theoretical quantiles
# third example:
loss.fit.dist("exponential",x)
# fourth example:
st<- list(shape=0.7882,scale = 11533)
par(mfrow=c(2,1))
loss.fit.dist("weibull",x,start = st) # fitting weibull distribution with given start
loss.fit.dist("weibull",x) # and without start
# fifth example:
par(mfrow=c(2,1))
sta<-list(sd = 3,mean = 0.5)
a1 = loss.fit.dist(dnorm,x,start = sta,name = "normal!") # of course "normal" is recognised distribution
# but supplying pars for the normal distribution is not supported!
# so it can be only that way
a2 = loss.fit.dist(dnorm,x,start = sta,name = "normal!",col = "blue")
# method is optim argument
# compare parameters
a1$param
a2$param
# sixth example:
sta<-list(sd = 3,mean = 0.5)
loss.fit.dist(dnorm,x,start = sta,name = "normal!")
a = loss.fit.dist(dnorm,x,start = sta,name = "normal!",qq = TRUE);summary(a)
head(cbind(a$q.e,a$q.t))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.