[Distr-commits] r312 - in pkg/distrEx: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Oct 23 16:22:19 CEST 2008
Author: stamats
Date: 2008-10-23 16:22:19 +0200 (Thu, 23 Oct 2008)
New Revision: 312
Modified:
pkg/distrEx/DESCRIPTION
pkg/distrEx/NAMESPACE
pkg/distrEx/R/Gumbel.R
pkg/distrEx/man/Gumbel-class.Rd
Log:
new methods for Gumbel distribution ...
Modified: pkg/distrEx/DESCRIPTION
===================================================================
--- pkg/distrEx/DESCRIPTION 2008-10-15 21:06:56 UTC (rev 311)
+++ pkg/distrEx/DESCRIPTION 2008-10-23 14:22:19 UTC (rev 312)
@@ -1,6 +1,6 @@
Package: distrEx
Version: 2.0.2
-Date: 2008-10-14
+Date: 2008-10-23
Title: Extensions of package distr
Description: Extensions of package distr and some additional
functionality
Modified: pkg/distrEx/NAMESPACE
===================================================================
--- pkg/distrEx/NAMESPACE 2008-10-15 21:06:56 UTC (rev 311)
+++ pkg/distrEx/NAMESPACE 2008-10-23 14:22:19 UTC (rev 312)
@@ -27,7 +27,8 @@
"cond",
"Range",
"loc", "loc<-",
- "scale", "scale<-",
+ "scale", "scale<-",
+ "+", "*",
"name", "name<-",
"E", "var", "IQR", "skewness", "kurtosis",
"sd", "median", "mad",
Modified: pkg/distrEx/R/Gumbel.R
===================================================================
--- pkg/distrEx/R/Gumbel.R 2008-10-15 21:06:56 UTC (rev 311)
+++ pkg/distrEx/R/Gumbel.R 2008-10-23 14:22:19 UTC (rev 312)
@@ -29,3 +29,18 @@
stop("'value' has to be a single positive number")
new("Gumbel", loc = loc(object), scale = value)
})
+
+## extra methods for Gumbel distribution
+setMethod("+", c("Gumbel","numeric"),
+ function(e1, e2){
+ if (length(e2)>1) stop("length of operator must be 1")
+ new("Gumbel", loc = loc(e1) + e2, scale = scale(e1))
+ })
+
+setMethod("*", c("Gumbel","numeric"),
+ function(e1, e2){
+ if (length(e2)>1) stop("length of operator must be 1")
+ if (isTRUE(all.equal(e2,0)))
+ return(new("Dirac", location = 0, .withArith = TRUE))
+ new("Gumbel", loc = loc(e1) * e2, scale = scale(e1)*abs(e2))
+ })
Modified: pkg/distrEx/man/Gumbel-class.Rd
===================================================================
--- pkg/distrEx/man/Gumbel-class.Rd 2008-10-15 21:06:56 UTC (rev 311)
+++ pkg/distrEx/man/Gumbel-class.Rd 2008-10-23 14:22:19 UTC (rev 312)
@@ -6,6 +6,8 @@
\alias{loc<-,Gumbel-method}
\alias{scale,Gumbel-method}
\alias{scale<-,Gumbel-method}
+\alias{+,Gumbel,numeric-method}
+\alias{*,Gumbel,numeric-method}
\title{Gumbel distribution}
\description{The Gumbel cumulative distribution function with
@@ -40,18 +42,24 @@
\section{Methods}{
\describe{
\item{initialize}{\code{signature(.Object = "Gumbel")}: initialize method. }
-
+
\item{loc}{\code{signature(object = "Gumbel")}: wrapped access method for
slot \code{loc} of slot \code{param}. }
-
+
\item{scale}{\code{signature(x = "Gumbel")}: wrapped access method for
slot \code{scale} of slot \code{param}. }
-
+
\item{loc<-}{\code{signature(object = "Gumbel")}: wrapped replace method for
slot \code{loc} of slot \code{param}. }
-
+
\item{scale<-}{\code{signature(x = "Gumbel")}: wrapped replace method for
slot \code{scale} of slot \code{param}. }
+
+ \item{\code{+}}{\code{signature(e1 = "Gumbel", e2 = "numeric")}: result again of
+ class \code{"Gumbel"}; exact. }
+
+ \item{\code{*}}{\code{signature(e1 = "Gumbel", e2 = "numeric")}: result again of
+ class \code{"Gumbel"}; exact. }
}
}
\references{Johnson et al. (1995) \emph{Continuous Univariate Distributions. Vol. 2. 2nd ed.}
More information about the Distr-commits
mailing list