[Distr-commits] r1280 - in branches/distr-2.8/pkg/distr: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 16 13:05:27 CEST 2018
Author: ruckdeschel
Date: 2018-08-16 13:05:27 +0200 (Thu, 16 Aug 2018)
New Revision: 1280
Modified:
branches/distr-2.8/pkg/distr/R/AllGenerics.R
branches/distr-2.8/pkg/distr/R/liesInSupport.R
branches/distr-2.8/pkg/distr/inst/NEWS
branches/distr-2.8/pkg/distr/man/liesInSupport.Rd
Log:
[distr] branch 2.8
+ liesInSupport:
* taken out checkFin from definition of the generic
* particular methods for all implemented (particular) a.c. distributions
Modified: branches/distr-2.8/pkg/distr/R/AllGenerics.R
===================================================================
--- branches/distr-2.8/pkg/distr/R/AllGenerics.R 2018-08-16 08:00:48 UTC (rev 1279)
+++ branches/distr-2.8/pkg/distr/R/AllGenerics.R 2018-08-16 11:05:27 UTC (rev 1280)
@@ -300,7 +300,7 @@
setGeneric("liesIn", function(object, x) standardGeneric("liesIn"))
if(!isGeneric("liesInSupport"))
- setGeneric("liesInSupport", function(object, x, checkFin = FALSE)
+ setGeneric("liesInSupport", function(object, x,...)
standardGeneric("liesInSupport"))
if(!isGeneric("convpow"))
setGeneric("convpow", function(D1, ...) standardGeneric("convpow"))
Modified: branches/distr-2.8/pkg/distr/R/liesInSupport.R
===================================================================
--- branches/distr-2.8/pkg/distr/R/liesInSupport.R 2018-08-16 08:00:48 UTC (rev 1279)
+++ branches/distr-2.8/pkg/distr/R/liesInSupport.R 2018-08-16 11:05:27 UTC (rev 1280)
@@ -99,3 +99,34 @@
obj <- flat.mix(object)
return(liesInSupport(obj,x,checkFin))
})
+
+.alwaysInSupp <- function(object, x, checkFin = TRUE) is.finite(x)
+.posInSupp <- function(object, x, checkFin = TRUE) (x>=0)
+.stricposInSupp <- function(object, x, checkFin = TRUE) (x>0)
+
+setMethod("liesInSupport", signature(object = "ExpOrGammaOrChisq",
+ x = "numeric"),.posInSupp)
+setMethod("liesInSupport", signature(object = "Lnorm",
+ x = "numeric"),.posInSupp)
+setMethod("liesInSupport", signature(object = "Fd",
+ x = "numeric"),.posInSupp)
+
+setMethod("liesInSupport", signature(object = "Norm",
+ x = "numeric"),.alwaysInSupp)
+setMethod("liesInSupport", signature(object = "DExp",
+ x = "numeric"),.alwaysInSupp)
+setMethod("liesInSupport", signature(object = "Cauchy",
+ x = "numeric"),.alwaysInSupp)
+setMethod("liesInSupport", signature(object = "Td",
+ x = "numeric"),.alwaysInSupp)
+setMethod("liesInSupport", signature(object = "Logis",
+ x = "numeric"),.alwaysInSupp)
+setMethod("liesInSupport", signature(object = "Weibull",
+ x = "numeric"),.alwaysInSupp)
+
+setMethod("liesInSupport", signature(object = "Unif",
+ x = "numeric"),
+ function(object, x, checkFin = TRUE){(x>=Min(object))&(x<=Max(object))})
+setMethod("liesInSupport", signature(object = "Beta",
+ x = "numeric"),
+ function(object, x, checkFin = TRUE){(x>=0)&(x<=1)})
Modified: branches/distr-2.8/pkg/distr/inst/NEWS
===================================================================
--- branches/distr-2.8/pkg/distr/inst/NEWS 2018-08-16 08:00:48 UTC (rev 1279)
+++ branches/distr-2.8/pkg/distr/inst/NEWS 2018-08-16 11:05:27 UTC (rev 1280)
@@ -33,7 +33,8 @@
from ifelse expressions to index operations to avoid warnings
+ in distr::solve only try base::solve if arg "a" has no dim or if it has then
if nrow(a)==nrow(b); otherwise directly use MASS::ginv
-
++ introduced particular liesInSupport methods for all specific abs.cont distributions in distr
+
bug fixes
+ fixed a (newly introduced) bug in exp() for DiscreteDistribution -- forgot to return obj ...
Modified: branches/distr-2.8/pkg/distr/man/liesInSupport.Rd
===================================================================
--- branches/distr-2.8/pkg/distr/man/liesInSupport.Rd 2018-08-16 08:00:48 UTC (rev 1279)
+++ branches/distr-2.8/pkg/distr/man/liesInSupport.Rd 2018-08-16 11:05:27 UTC (rev 1280)
@@ -7,14 +7,43 @@
\alias{liesInSupport,DiscreteDistribution,numeric-method}
\alias{liesInSupport,Distribution,matrix-method}
\alias{liesInSupport,AbscontDistribution,numeric-method}
+\alias{liesInSupport,ExpOrGammaOrChisq,numeric-method}
+\alias{liesInSupport,Lnorm,numeric-method}
+\alias{liesInSupport,Fd,numeric-method}
+\alias{liesInSupport,Norm,numeric-method}
+\alias{liesInSupport,DExp,numeric-method}
+\alias{liesInSupport,Cauchy,numeric-method}
+\alias{liesInSupport,Td,numeric-method}
+\alias{liesInSupport,Logis,numeric-method}
+\alias{liesInSupport,Weibull,numeric-method}
+\alias{liesInSupport,Unif,numeric-method}
+\alias{liesInSupport,Beta,numeric-method}
+
\title{Generic Function for Testing the Support of a Distribution }
\description{
The function tests if \code{x} lies in the support of the
distribution \code{object}.
}
\usage{
-liesInSupport(object, x, checkFin = FALSE)
+liesInSupport(object, x, ...)
+\S4method{liesInSupport}{UnivarLebDecDistribution,numeric}(object,x, checkFin = FALSE)
+\S4method{liesInSupport}{UnivarMixingDistribution,numeric}(object,x, checkFin = FALSE)
+\S4method{liesInSupport}{LatticeDistribution,numeric}(object,x, checkFin = FALSE)
+\S4method{liesInSupport}{DiscreteDistribution,numeric}(object,x, checkFin = FALSE)
+\S4method{liesInSupport}{AbscontDistribution,numeric}(object,x, checkFin = FALSE)
+\S4method{liesInSupport}{Distribution,matrix}(object,x, checkFin = FALSE)
+\S4method{liesInSupport}{ExpOrGammaOrChisq,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Lnorm,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Fd,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Norm,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{DExp,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Cauchy,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Td,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Logis,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Weibull,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Unif,numeric}(object,x, checkFin = TRUE)
+\S4method{liesInSupport}{Beta,numeric}(object,x, checkFin = TRUE)
}
\arguments{
\item{object}{ object of class \code{"Distribution"} }
@@ -26,6 +55,7 @@
and by using slot \code{.finSupport} / the return values of \code{q.l(object)}
in \code{0} and \code{1}. This is only used on discrete (parts of)
distributions).}
+ \item{\dots}{ used for specific arguments to particular methods. }
}
%\details{}
\value{logical vector}
More information about the Distr-commits
mailing list