Methods for objects of class created by fitdistr.grouped
Methods for objects of class created by 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 .
class
## 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,...)
Arguments
x, object: an object of class fitdistr.grouped as created by a call to the function with this name.
cor: logical (default=FALSE); is the correlation matrix required?
full: logical (default=FALSE); must the vector of fitted frequencies include the boundary classes, when they are added to cover the full support of the fitted distribution?
...: further arguments passed to or from other methods.
Object components
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
Author(s)
Adelchi Azzalini
See Also
the function fitdistr.grouped, the plotting method plot.fitdistr.grouped
References
Possolo, A., Merkatas, C. and Bodnar, O. (2019). Asymmetrical uncertainties. Metrologia 56, 045009.
Examples
data(barolo)attach(barolo)A75 <-(reseller=="A"& volume==75)logPrice <- log(price[A75],10)# as used in selm documentation; see its fittingdetach(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 countsafcrc59 <-1.141breaks <- c(-Inf, afcrc59 -0.033, afcrc59, afcrc59 +0.037,Inf)prob <- c(0.16,0.50,0.84)cum.percent <- c(0, prob,1)*100fitSN <- 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.