[Distr-commits] r78 - in pkg: distrEx/R distrEx/chm distrEx/man distrMod/chm

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 19 23:31:33 CET 2008


Author: ruckdeschel
Date: 2008-02-19 23:31:32 +0100 (Tue, 19 Feb 2008)
New Revision: 78

Modified:
   pkg/distrEx/R/vonMisesDist.R
   pkg/distrEx/chm/distrEx.chm
   pkg/distrEx/chm/vonMisesDist.html
   pkg/distrEx/man/vonMisesDist.Rd
   pkg/distrMod/chm/MDEstimator.html
   pkg/distrMod/chm/distrMod.chm
Log:
modified definition of von Mises distance function in order to get better performance; useApply = FALSE reduced system.time from 5.0 sec to 0.8 sec...

Modified: pkg/distrEx/R/vonMisesDist.R
===================================================================
--- pkg/distrEx/R/vonMisesDist.R	2008-02-19 20:22:43 UTC (rev 77)
+++ pkg/distrEx/R/vonMisesDist.R	2008-02-19 22:31:32 UTC (rev 78)
@@ -4,9 +4,9 @@
 ###############################################################################
 setMethod("vonMisesDist", signature(e1 = "UnivariateDistribution",
                                     e2 = "UnivariateDistribution"),
-    function(e1, e2, mu = e2){
+    function(e1, e2, mu = e2, ... ){
         owarn <- getOption("warn"); options(warn = -1)
-        res <- E(mu, fun = function(t) (p(e1)(t)-p(e2)(t))^2)^.5
+        res <- E(mu, fun = function(t) {(p(e1)(t)-p(e2)(t))^2}, useApply = FALSE, ...)^.5
         names(res) <- "vonMises distance"
         options(warn = owarn)
         return(res)
@@ -15,11 +15,11 @@
 ## vonMises distance
 setMethod("vonMisesDist", signature(e1 = "numeric",
                                     e2 = "UnivariateDistribution"),
-    function(e1, e2, mu = e2){
-        owarn <- getOption("warn"); options(warn = -1)
-        res <- E(mu, fun = function(t) ((ecdf(e1))(t)-p(e2)(t))^2)^.5
-        names(res) <- "vonMises distance"
-        options(warn = owarn)
-        return(res)
-    })
+    function(e1, e2, mu = e2, ...)
+        {owarn <- getOption("warn"); options(warn = -1)
+          e10 <- DiscreteDistribution(e1)       
+          options(warn = owarn)
+          vonMisesDist(e1 = e10, e2 = e2, mu = mu, ...)
+         }
+    )
 

Modified: pkg/distrEx/chm/distrEx.chm
===================================================================
(Binary files differ)

Modified: pkg/distrEx/chm/vonMisesDist.html
===================================================================
--- pkg/distrEx/chm/vonMisesDist.html	2008-02-19 20:22:43 UTC (rev 77)
+++ pkg/distrEx/chm/vonMisesDist.html	2008-02-19 22:31:32 UTC (rev 78)
@@ -35,10 +35,10 @@
 vonMisesDist(e1, e2, ...)
 ## S4 method for signature 'UnivariateDistribution,
 ##   UnivariateDistribution':
-vonMisesDist(e1, e2, mu = e2)
+vonMisesDist(e1, e2, mu = e2, ...)
 ## S4 method for signature 'numeric,
 ##   UnivariateDistribution':
-vonMisesDist(e1, e2, mu = e2)
+vonMisesDist(e1, e2, mu = e2, ...)
 </pre>
 
 
@@ -53,7 +53,7 @@
 object of class <code>"Distribution"</code> </td></tr>
 <tr valign="top"><td><code>...</code></td>
 <td>
-further arguments to be used in particular methods (not in package <span class="pkg">distrEx</span>)</td></tr>
+further arguments to be used e.g. by <code>E()</code></td></tr>
 <tr valign="top"><td><code>mu</code></td>
 <td>
 object of class <code>"Distribution"</code>; integration measure; defaulting to <code>e2</code> </td></tr>

Modified: pkg/distrEx/man/vonMisesDist.Rd
===================================================================
--- pkg/distrEx/man/vonMisesDist.Rd	2008-02-19 20:22:43 UTC (rev 77)
+++ pkg/distrEx/man/vonMisesDist.Rd	2008-02-19 22:31:32 UTC (rev 78)
@@ -17,13 +17,13 @@
 }
 \usage{
 vonMisesDist(e1, e2, ...)
-\S4method{vonMisesDist}{UnivariateDistribution,UnivariateDistribution}(e1, e2, mu = e2)
-\S4method{vonMisesDist}{numeric,UnivariateDistribution}(e1, e2, mu = e2)
+\S4method{vonMisesDist}{UnivariateDistribution,UnivariateDistribution}(e1, e2, mu = e2, ...)
+\S4method{vonMisesDist}{numeric,UnivariateDistribution}(e1, e2, mu = e2, ...)
 }
 \arguments{
   \item{e1}{ object of class \code{"Distribution"} or class \code{"numeric"} }
   \item{e2}{ object of class \code{"Distribution"} }
-  \item{\dots}{ further arguments to be used in particular methods (not in package \pkg{distrEx})}
+  \item{\dots}{ further arguments to be used e.g. by \code{E()}}
   \item{mu}{ object of class \code{"Distribution"}; integration measure; defaulting to \code{e2} }
 }
 %\details{}

Modified: pkg/distrMod/chm/MDEstimator.html
===================================================================
--- pkg/distrMod/chm/MDEstimator.html	2008-02-19 20:22:43 UTC (rev 77)
+++ pkg/distrMod/chm/MDEstimator.html	2008-02-19 22:31:32 UTC (rev 78)
@@ -130,6 +130,12 @@
 ## Kolmogorov(-Smirnov) minimum distance estimator
 MDEstimator(x = x, ParamFamily = G, distance = KolmogorovDist)
 
+## von Mises minimum distance estimator with default mu
+MDEstimator(x = x, ParamFamily = G, distance = vonMisesDist)
+
+## von Mises minimum distance estimator with mu = N(0,1)
+MDEstimator(x = x, ParamFamily = G, distance = vonMisesDist, mu = Norm())
+
 ## Total variation minimum distance estimator
 ## gamma distributions are discretized
 MDEstimator(x = x, ParamFamily = G, distance = TotalVarDist)

Modified: pkg/distrMod/chm/distrMod.chm
===================================================================
(Binary files differ)



More information about the Distr-commits mailing list