fitdistr.grouped-class | R Documentation |
fitdistr.grouped
A successful call to function fitdistr.grouped
creates
an object of class, also named fitdistr.grouped
, for which a set
of methods exist.
The structure of an object of this class is described in section
‘Object components’.
## S3 method for class 'fitdistr.grouped'
logLik(object, ...)
## S3 method for class 'fitdistr.grouped'
coef(object, ...)
## S3 method for class 'fitdistr.grouped'
vcov(object, ...)
## S3 method for class 'fitdistr.grouped'
print(x, ...)
## S3 method for class 'fitdistr.grouped'
summary(object, cor=FALSE, ...)
## S3 method for class 'fitdistr.grouped'
fitted(object, full=FALSE, ...)
x, object |
an object of class |
cor |
logical (default= |
full |
logical (default= |
... |
further arguments passed to or from other methods. |
Components of an object of class fitdistr.grouped
:
call
the matched call
family
the selected family
of distributions
logL
the achieved maximum log-likelihood
param
a vector of estimated parameters
vcov
the approximate variance-covariance matrix of the estimates
input
a list with the input quantities and some derived ones
opt
a list as returned by optim
Adelchi Azzalini
Possolo, A., Merkatas, C. and Bodnar, O. (2019). Asymmetrical uncertainties. Metrologia 56, 045009.
the function fitdistr.grouped
,
the plotting method plot.fitdistr.grouped
data(barolo)
attach(barolo)
A75 <- (reseller=="A" & volume==75)
logPrice <- log(price[A75], 10) # as used in selm documentation; see its fitting
detach(barolo)
breaks <- seq(1, 3, by=0.25)
f <- cut(logPrice, breaks = breaks)
counts <- tabulate(f, length(levels(f)))
fit.logPrice.gr <- fitdistr.grouped(breaks, counts, family='ST')
summary(fit.logPrice.gr) # compare this fit with the ungrouped data fitting
print(fit.logPrice.gr)
coef(fit.logPrice.gr)
vcov(fit.logPrice.gr)
data.frame(intervals=levels(f), counts, fitted=format(fitted(fit.logPrice.gr)))
full.intervals <- c("(-Inf, 1]", levels(f), "(3, Inf)")
data.frame("full-range intervals" = full.intervals,
"full-range counts" = c(0, counts, 0),
"full-range fit" = fitted(fit.logPrice.gr, full=TRUE))
sum(counts) - sum(fitted(fit.logPrice.gr))
sum(counts) - sum(fitted(fit.logPrice.gr, full=TRUE)) # must be "nearly 0"
#---
# Use first entry in Table 3 of Possolo et al. (2019) and do similar fitting
# to the *probability* values, not observation counts
afcrc59 <- 1.141
breaks <- c(-Inf, afcrc59 - 0.033, afcrc59, afcrc59 + 0.037, Inf)
prob <- c(0.16, 0.50, 0.84)
cum.percent <- c(0, prob, 1)*100
fitSN <- fitdistr.grouped(breaks, counts=diff(cum.percent), family="SN")
print(coef(fitSN))
print(rbind(target=c(prob, 1)*100, fitted=cumsum(fitted(fitSN))), digits=5)
# Note: given the nature of these data (i.e. probabilities, not counts),
# there is no point to use vcov, logLik and summary on the fitted object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.