Object Oriented Implementation of Probability Models

Implements S4 classes for probability models based on packages 'distr' and 'distrEx'.


News

######################################################################

News: to package distrMod

######################################################################

(first two numbers of package versions do not necessarily reflect package-individual development, but rather are chosen for the distrXXX family as a whole in order to ease updating "depends" information)

############## v 2.7 ##############

user-visible CHANGES:

  • replaced http://CRAN... by https://CRAN... (also in CITATION and similar files)
  • new wrapper to MDEstimator: CvMMDEstimator, KolmogorovMDEstimator, TotalVarMDEstimator, HellingerMDEstimator
  • exported .CvMMDCovariance in distrMod
  • added call to return value of qqplot
  • qqplot and returnlevelplot have adopted the same argument naming (and selection paradigm) as the other diagnostic plots (IC-plot, comparePlot, infoPlot) in pkg RobAStBase: the suffix is .lbs instead of .lbl, changed argument name withLab to with.lab the attributes of shown points have ending .pts the observations are classed into three groups: - the labelled observations selected through which.lbs and which.Order - the shown non labelled observations (which are not in the previous set) selected by which.nonlbs - the non-shown observations (the remaining ones not contained in the former 2 grps) -> point attributes may either refer to prior selection or to post-selection in which case we have .npts variants
  • returnlevelplot now accepts a log argument for the y axis (helpful for Pareto distributions, see script...)

under the hood:

  • wherever possible also use q.l internally instead of q to provide functionality in IRKernel
  • fixed omegahat.net issue (raised by K.Hornik,(24.10.2016, 18:08)

bug fixes:

  • Estimate method for returnlevelplot was passing the wrong xlab
  • the selection mechanism had to be revised (lacked a passage through ranks)

############## v 2.6 ##############

user-visible CHANGES:

  • title changed to title style / capitalization
  • introduced dropZeroDensity argument to ML estimators
  • arguments panel.first, panel.last for plot-methods can now be lists
  • introduced returnlevelplot, a generalization of the respective diagnostic plot facility of package ismev
  • qqplot and returnlevelplot gain pattern substitution like plot in titles and x/y axis lables
  • pattern substitution can now be switched on and off in all plot functions according to argument withSubst

GENERAL ENHANCEMENTS:

under the hood:

  • zero dropping (see argument 'dropZeroDensity' above) --Optimizers like optim require finite values, so get problems when negative loglikelihood is evaluated, so optionally, and by default, values with density/likelihood 0 are dropped from optimization

  • removed ::: internal dependencies (within distr-Fam of pkgs) by copying respective routines

  • qqplot:

    • (already there for a while) gains ability to interchange x- and y- axis by argument 'datax' for compatibility with other qqplots
    • gains new methods for object of class "Estimate" (which could also be seen as "fitted" objects...)
    • additional argument added.points.CI to allow for additional evaluation points for the confidence intervals in the range of the seen data
    • now by default has datax = TRUE
    • fixed issue with labeling
    • issues with datax fixed
    • gains argument jit.tol to allow jittering to take place also for continuous observations, if observations are "too" close to each other
  • returnlevelplot

    • similar as qqplot as to additional methods
    • returnlevelplot now gains an argument threshold for POT
    • set datax argument in case it is missing in returnlevelplot ...
    • issues with datax fixed
    • gains argument jit.tol to allow jittering to take place also for continuous observations, if observations are "too" close to each other
  • new internal method .checkEstClassForParamFamily-method to be called immediately before returning an Estimate object (in functions Estimator(), MCEstimator(), MDEstimator(), MLEstimator()); this allows to return an object of S4 class specific to the resp. parametric family (by means of S4 method dispatch); this is used in pkg 'RobExtremes' to produce, e.g., objects of class "GEVMCEstimate", i.e. which inherit from both "MCEstimate" and "GEVEstimate", so that a diag-method for "GEVEstimate" becomes available for this class.

  • enhanced imports in DESCRIPTION by explicating second order imports

  • helper function .isReplicated gains an optional argument tol

    BUGFIXES:

  • fixed issue with slot withPosRestr in ParamFamParameter.R

  • fixed issue with check.validity (reported by B.Spangl)

  • fixed some minor issue in existsPIC (in case we get 0 matrix, and less strict tolerance)

  • fixed issue with returnlevelplot discovered by B. Spangl -- points had not been ordered

  • fixed CIs for qqplot and returnlevelplot

############## v 2.5 ##############

user-visible CHANGES:

GENERAL ENHANCEMENTS:

  • cleaned DESCRIPTION and NAMESPACE file as to Imports/Depends

under the hood:

  • For speeding up things, we now have an option withL2derivDistr = TRUE which if FALSE skips computing the image distribution in two dimensional models, i.e., have switched slot L2derivDistr from "DistrList" to "OptionalDistrList".

  • delayed calculation of variances and allow to skip or delay calculation of L2derivDistr; to this end introduced new class unions "OptionalNumericOrMatrixOrCall", "OptionalDistrListOrCall"; respectively at certain stages, evaluation of the call must then be forced

  • consequence: L2LocationScaleFamilies now use median mad as starting estimator in robest roptest (and no longer call CvM-MDE)

  • small change to avoid frequent calls to getImageDistr

  • (L2)ParamFamily gains slots .withEvalAsVar to allow delayed evaluation of variances .withEvalL2derivDistr to allow delayed evaluation of L2derivDistr .withMDE to control extra calls to MDEstimator that might not be necessary in robest (e.g. with GParetoFamily())

  • correspondingly accessor L2derivDistr now checks whether it is a call and if so evaluates

  • forgot to commit some changes in show() for asvar in the last round

  • in checkL2deriv, in addition, relative tolerances are also issued for Fisher Information

  • fixed an issue with modifyModel in case of location scale models: in these cases we do neither want to produce a call nor an evaluated call to imageDistr...

  • added .Rbuildignore

  • exported some routines which had been internal so far to avoid calls by :::

    BUGFIXES:

  • moved generics to "distribution" and "samplesize" to pkg distr to avoid conflict with pkg distrSim

############## v 2.4 ##############

user-visible CHANGES:

  • moved GumbelLocationFamily to new package "RobExtremes"
  • new function addAlphTrsp2col to add alpha transparency to a given color; qqplot gains argument alpha.trsp to control for alpha transparency

under the hood:

  • added modifyModel method for ParamFamily, some minor corrections due to more strict checking in R devel
  • created folder vignettes and moved content of inst/doc/ to it
  • removed lazyload tag in DESCRIPTION
  • updated affiliation info in newDistributions.Rnw
  • deleted inst/doc folder
  • .Rbuildignore file as a reaction to B. Ripley's mail on r-devel, "CRAN package sizes", Feb-14-2011
  • added computation of relative error in checkL2deriv - maybe there is a better idea avoiding division by zero,
  • added DESCRIPTION tag "ByteCompile" to all our packages
  • updating maintainer email address and URL.
  • added argument no.readonly = TRUE to assignments of form opar <- par()
  • new intermediate classes/ class unions for scale families and scale shape families;
  • consequent use of argument validity.check in MCE estimators.
  • removed relics of ancient L2Fam-slot withPos (was introduced in a try)
  • introduced slot scaleshapename for L2ScaleShapeUnion and methods scalename und scaleshapename (accessor/replacers)
  • after change of @<- semantics by J. Chambers moved from class(M) <- class(model) to slotwise copying
  • S4Method "mceCalc", signature(x = "numeric", PFam = "ParamFamily") gains additional calls to makeOKPar() to warrant admissible parameter values
  • Estimator can now deal with asymptotic variances if given; to this end gains optional argument ParamFamily
  • put some examples in \dontrun to reduce check time on CRAN
  • deleted file GumbelLocationFamily.Rd (no longer needed)
  • Default name of Estimator is now "Estimator"
  • deleted no longer needed chm folders

BUGFIXES:

  • bugfixes in NbinomMeanSizeFamily and NbinomwithSizeFamily (detected by Matthias!)
  • digamma was used instead of trigamma
  • validparameter: fixed a bug with slot withPosRestr (which is not a member of L2ParamFamily but of the respective parameter!)

############## v 2.3 ##############

user-visible CHANGES:

  • introduced NbinomFamily in response to Markus Kalisch's mail to RsR
  • restated L2-deriv and L2-deriv distribution s.t. it is computationally easier to treat
  • also now allow 2-parametric model Nbinom (see SimpleL2ParamFamilies.R...)

++ Vignette:

  • uploaded vignette for distrMod (still to be done: insert exact volume,number,pages)

  • Matthias' Kommentare (Kreis-Symbol, Rem) ge´┐Żndert

  • merged in Matthias' changes

  • integrated JSS version of vignette

  • vignette distrMod fertiggemacht

  • vignette announced in startup msg

  • meta-information included to vignette

under the hood:

  • DESCRIPTION files and package-help files gain a tag SVNRevision to be filled by get[All]RevNr.R from utils in distr

BUGFIXES:

  • re-uploaded svn-multi.sty and svnkw.sty after error report by Jan de Leeuw.
  • made doc for NbinomFamily error-free

Bug

  • qqplot https://r-forge.r-project.org/tracker/?atid=400&group_id=87&func=browse should be fixed

  • for restoring old par() values, not all attributes may be set; hence deleted them from stored value in plot functions by something like opar$cin <- opar$cra <- opar$csi <- opar$cxy <- opar$din <- NULL

  • unnecessary Rplots.pdf deleted from inst folders of distr and distrMod (are created anyway during vignette build)

############## v 2.2.2 ############## Vignette to distrMod aka

M. Kohl and P. Ruckdeschel (2010): R Package distrMod: S4 Classes and Methods for Probability Models. Journal of Statistical Software, 35(10), 1-27. \url{http://www.jstatsoft.org/v35/i10/}

included

############## v 2.2.1 ##############

############## v 2.2 ##############

user-visible CHANGES:

  • Estimators:

    • AllShow: deleted tab in nuisance and fixed part when parts are named.
    • in mceCalc penalty now allows for functions
    • Estimator(), MCEstimator(), MLEstimator(), MDEstimator() gain argument na.rm; if true estimators are evaluated at complete.cases(x)
    • MCEstimate-class gains slot startPar; corresponding accessor functions;
  • unified treatment of NAs:

    • class Estimate gains slot completecases,
    • class Confint gains slot completecases.estimate,
    • there is accessor function completecases[.estimate]
    • slot samplesize only counts complete cases
    • accessor functions samplesize[.estimate] gains argument onlycompletecases; if TRUE returns slot samplesize[.estimate] as is, otherwise adds sum(completecases.estimate) to it
    • internally all Estimator functions work with data na.omit(x) instead of x
  • Models:

    • checkL2deriv gains ... argument to pass on accuracy arguments to E()
  • plotting:

    • new diagnostic function qqplot to check the quality of a model fit
      • special methods for first argument "ANY" (the data) and for second argument of class "UnivariateDistribution", "ProbFamily",
      • comes with corresponding (pointwise/simultaneous) confidence intervals
      • flexible labelling of data points

GENERAL ENHANCEMENTS:

  • added tests/Examples folder with file distrMod-Ex.Rout.save to have some automatic testing
  • added field "Encoding: latin1" to all DESCRIPTION files in order to avoid problems with e.g. Windows locale when svn replaces $LastChangedDate
  • added TOBEDONE (sic!) files for each package (by accident also in trunc; these are empty so far)

INTERNALLY:

  • moved Distribution symmetry classes and corresponding methods/functions from distrMod to distr
    • in distrMod remove slots from class ProbFamily and L2ParamFamily -distrSymm (information is already in slot distr) -L2derivSymm (information will be in Random Variable L2deriv) -L2derivDistrSymm (information will be in DistrList L2derivDistr)
  • changed behaviour of mceCalc() and consequently of MCEstimator(), MDEstimator(), MLEstimator(): Instead of mapping unallowed parameter values into allowed ones by makeOKPar(), thereby pretending to optim/optimize that the unallowed parameters give reasonable criterion values, now always a penalty is returned whenever the parameter is not valid. For profiling though, we still keep the old behavior, i.e. map to allowed parameters by makeOKPar() in the returned criterion function.
  • in mceCalc naming is "more" unique (to avoid unintended name clashes)
  • class MCEstimate gains slot optimwarn to gather warnings issued in optimization; may be accessed with method optimwarn()
  • potentially, mleCalc now transports the value of the current parameter value theta as argument thetaPar to the optimization criterion; controlled for by argument withthetaPar (defaulting to FALSE) Hence, if desired, particular criterion functions could make use of this information, by, say computing the criterion differently for different parameter values We used it to check whether the numerically found optimum obeys first order conditions (i.e. sum (L2deriv(x_i))=0)
  • new utility: .deleteDim to delete /only/ dim attribute
  • to deal with nuisance parameters:
    • utility .validTrafo(), in presence of nuisance, covering coordinates p+1..k, now accepts for matrices either dim p x p or p x k and in case ncol(trafo==k)
    • correspondingly modified validity function slot in ParamFamParameter()
    • method trafo is changed for nuisance parameters:
      • for signature ParamFamily, ParamFamParameter now takes special care about presence of a nuisance parameter: if so it returns as mat item a matrix with corresponding zero-columns for the nuisance coordinates so that it has dim p x k where k=length(main)+length(nuisance)
      • .validTrafo calls in ParamFamParameter.R (in generating function ParamFamParameter, in trafo-methods signature ParamFamParameter, missing in main<- method for signature ParamFamParameter in trafo<- method for signature ParamFamParameter) are now prepended with necessary dimension
      • calculations in order to check whether its dim is pxp or pxk (see point ".validTrafo")
  • show methods for class Estimate are a bit more careful:
    • in principle they accept estimate slots with a dim attribute
    • special care is taken to whether untransformed.asvar is not NULL / NA-free
  • removed unnecessary "fixed" component of parameter in ExpScaleFamily

BUGFIXES:

  • inserted Symmetry information in demo modelExp3.R
  • simplified treatment of random variable L2deriv in L2ParamFamily.R
  • small modifications to make modifyModel work with matrices in calls
  • small correction needed for case trafo in R^(1 x k)
  • plot should now work for models with trafo - shows untransformed family
  • mceCalc was building a named call with arguments x and Distribution and hence MDEstimator did no longer work...
  • for MDEstimator, similarly, this is controlled by paramDepDist
  • there were problems in confint() when diag() was called with numeric of length one.
  • modified wrong use of "criterium" to "criterion"
  • a tiny buglet in prototype for trafo slot
  • yet another issue with "pretty printing", -> give default names "" if empty
  • the "dim"-issue:
    • estimate, untransformed.estimate, main, and nuisance from time to time did not return numerics (instead: items with dim attribute...)
    • accessors to [untransoformed.]asvar now coerce to matrix, but only so if the item is not NULL
    • in .process.meCalcRes delete dim attribute for slots [untransformed.]estimate unless already present in main (and nuisance)
  • yet another issue with accessor function to [untransformed.]estimate --- it ate the names....
  • setAs(,) was wrong for nuisance parameters

############## v 2.1 ##############

  • Rd-style:

    • several buglets detected with the fuzzier checking mechanism cf [Rd] More intensive checking of R help files, Prof Brian Ripley, 09.01.2009 10:25) [Rd] Warning: missing text for item ... in \describe? , Prof Brian Ripley,
  • MODELS

    • added mad.const to guarantee for mad-consistency in location scale model
    • loc/scale model: standardization by n not by (n-1) as in case of sd .
    • minor modification, L2derivDistr in case of location and scale families
    • some modifications such that LnormScaleFamily works properly ...
    • bug in LnormScaleFamily corrected ...
    • modifyModel gains argument .withL2derivDistr --- if false needs not be calculated (as e.g. this is done in a particular method calling the general method first...)
  • TRAFO

    • fixed some inconsistencies with slot trafo: now when trafo is a function, we try to keep it as a function under moves of the parametric model...
    • we introduce
      • a function trafo.fct() (see ?trafo.fct) to access the "function" aspect of trafo
      • a function trafoEst() which transforms an existing estimator of class "estimate" consistently (i.e. with corresponding untransfromed.estimate and untransformed.asvar information and transformed asvar) by a "trafo" function; see ?trafoEst
  • ESTIMATION

    • minor correction sqrt((n-1)/n)*sd(x)
    • enhanced Covariance calculation for CvMDist-MDE
    • modified output in show - Confint-class
  • PLOTTING

    • fixed issue with cex.inner
    • fixed bug in plot-methods for argument "inner" under use of to.draw.arg argument
    • realized suggestions by A. Unwin, Augsburg; plot for L2paramFamilies may be restricted to selected subplots;
    • L2ParamFamily plot in distrMod is now are as flexible as plot-methods in pkg distr
    • small changes in AllPlot.R in distrMod
    • plot-L2ParamFamily now also digests ... , in particular grid()
    • some fix in order to cover the case of argument panel.first=grid() in the ... argument (needs a delayed evaluation...)
  • BUGFIXES

    • some minor issues in L2GroupFamilies (if locscalename is missing)
    • fixed issue with MCE, MLE and MDE; these are also defined for ParamFamily class objects; so they need not have an Information slot
    • fixed a bug in L2GroupFamilies: it must be .getLogDeriv(centraldistribution) instead of .getLogDeriv(distribution)
    • a minor buglet [email protected] instead of trafo(object)

############## v 2.0.3 ##############

  • under the hood:
    • enhanced plotting (correct dispatch; opening of new device is controlled by option("newDevice") )
    • after JMC's changes: gone through setIs relations to ensure "correct" inheritance
  • moved license to LGPL-3
  • new plot()-methods capabilities comparable to those of plot()-methods in package distr():
    • plot-L2ParamFamily now also digests ... , in particular panel.first=grid()
  • corrected some buglets:
    • corrected small bug in SimpleL2ParamFamilies.R ...
    • corrected small bug in GumbelLocationFamily ...
    • small modifications to modifyModel.R ... modification of model a crucial step ... find a better way to do this???
  • new show() for 'confint'
  • new 'confint' methods for robust confidence intervals

############## v 2.0 ##############

  • start of the package
  • includes Parametric Models (with corresponding S4 classes)
  • parameter (realized as corresponding S4 class) is split up into
    +main part +nuisance part +fixed part may be transformed by user defined trafo function
  • includes Minimum Criterium Estimators (with corresponding S4 classes) ---with particular cases +Maximum Likelihood +Minimum Distance Estimators for Kolmogorov, Hellinger, Totalvariation, and Cramer von Mises distance
  • Minimum Criterum Estimators can (but do not need to) use method dispatch; this way particular methods beyond numerical optimization can be used without changing distrMod code
  • has Symmetry classes (useful for avoiding unnecessary integrations)
  • has biastype classes
  • has norm classes (to be used for differently standardized risks and ICs)
  • includes confint() methods for our Estimator classes
  • features risk classes (mainly used in RobASt packages, though)
  • includes demos/scripts

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("distrMod")

2.7.0 by Peter Ruckdeschel, 4 months ago


http://distr.r-forge.r-project.org/


Browse source code at https://github.com/cran/distrMod


Authors: Matthias Kohl [aut, cph] , Peter Ruckdeschel [cre, cph] , R Core Team [ctb, cph] (for source file 'format.perc')


Documentation:   PDF Manual  


Task views: Probability Distributions


LGPL-3 license


Imports startupmsg, sfsmisc, graphics, stats, grDevices

Depends on distr, distrEx, RandVar, MASS, stats4, methods

Suggests ismev, evd

Enhances RobExtremes


Imported by RobLoxBioC, distrDoc.

Depended on by ROptEst, RobAStBase, RobExtremes, RobLox.

Suggested by distrEllipse, distrRmetrics.


See at CRAN