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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 19 21:22:44 CET 2008


Author: ruckdeschel
Date: 2008-02-19 21:22:43 +0100 (Tue, 19 Feb 2008)
New Revision: 77

Added:
   pkg/distrEx/R/vonMisesDist.R
   pkg/distrEx/chm/vonMisesDist.html
   pkg/distrEx/man/vonMisesDist.Rd
Modified:
   pkg/distrEx/NAMESPACE
   pkg/distrEx/R/AllGeneric.R
   pkg/distrEx/chm/00Index.html
   pkg/distrEx/chm/0distrEx-package.html
   pkg/distrEx/chm/distrEx.chm
   pkg/distrEx/chm/distrEx.hhp
   pkg/distrEx/chm/distrEx.toc
   pkg/distrEx/man/0distrEx-package.Rd
   pkg/distrMod/man/MDEstimator.Rd
Log:
included von Mises distance and additional examples for corresponding MD-estimator

Modified: pkg/distrEx/NAMESPACE
===================================================================
--- pkg/distrEx/NAMESPACE	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/NAMESPACE	2008-02-19 20:22:43 UTC (rev 77)
@@ -21,7 +21,8 @@
               "ContaminationSize", 
               "TotalVarDist", 
               "KolmogorovDist", 
-              "HellingerDist") 
+              "HellingerDist",
+              "vonMisesDist") 
 exportMethods("support", 
               "cond", 
               "Range",

Modified: pkg/distrEx/R/AllGeneric.R
===================================================================
--- pkg/distrEx/R/AllGeneric.R	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/R/AllGeneric.R	2008-02-19 20:22:43 UTC (rev 77)
@@ -127,6 +127,11 @@
    setGeneric("HellingerDist", 
                function(e1, e2, ...) standardGeneric("HellingerDist"))
 }
+if(!isGeneric("vonMisesDist")){
+   setGeneric("vonMisesDist", 
+               function(e1, e2, ...) standardGeneric("vonMisesDist"))
+}
+
 if(!isGeneric("ConvexContamination")){ 
    setGeneric("ConvexContamination", 
                function(e1, e2, size) standardGeneric("ConvexContamination"))

Added: pkg/distrEx/R/vonMisesDist.R
===================================================================
--- pkg/distrEx/R/vonMisesDist.R	                        (rev 0)
+++ pkg/distrEx/R/vonMisesDist.R	2008-02-19 20:22:43 UTC (rev 77)
@@ -0,0 +1,25 @@
+###############################################################################
+## Method: vonMisesDist
+## von Mises distance of two distributions
+###############################################################################
+setMethod("vonMisesDist", signature(e1 = "UnivariateDistribution",
+                                    e2 = "UnivariateDistribution"),
+    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
+        names(res) <- "vonMises distance"
+        options(warn = owarn)
+        return(res)
+    })
+
+## 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)
+    })
+

Modified: pkg/distrEx/chm/00Index.html
===================================================================
--- pkg/distrEx/chm/00Index.html	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/chm/00Index.html	2008-02-19 20:22:43 UTC (rev 77)
@@ -727,5 +727,13 @@
 <td>Generic Functions for the Computation of Functionals</td></tr>
 <tr><td width="25%"><a href="Var.html">var-methods</a></td>
 <td>Generic Functions for the Computation of Functionals</td></tr>
+<tr><td width="25%"><a href="vonMisesDist.html">vonMisesDist</a></td>
+<td>Generic function for the computation of the vonMises distance of two distributions</td></tr>
+<tr><td width="25%"><a href="vonMisesDist.html">vonMisesDist,numeric,UnivariateDistribution-method</a></td>
+<td>Generic function for the computation of the vonMises distance of two distributions</td></tr>
+<tr><td width="25%"><a href="vonMisesDist.html">vonMisesDist,UnivariateDistribution,UnivariateDistribution-method</a></td>
+<td>Generic function for the computation of the vonMises distance of two distributions</td></tr>
+<tr><td width="25%"><a href="vonMisesDist.html">vonMisesDist-methods</a></td>
+<td>Generic function for the computation of the vonMises distance of two distributions</td></tr>
 </table>
 </body></html>

Modified: pkg/distrEx/chm/0distrEx-package.html
===================================================================
--- pkg/distrEx/chm/0distrEx-package.html	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/chm/0distrEx-package.html	2008-02-19 20:22:43 UTC (rev 77)
@@ -162,6 +162,8 @@
                         Kolmogorov distance of two distributions
 TotalVarDist            Generic function for the computation of the
                         total variation distance of two distributions
+vonMisesDist            Generic function for the computation of the
+                        von Mises distance of two distributions
 
 liesInSupport           Generic function for testing the support of a
                         distribution

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

Modified: pkg/distrEx/chm/distrEx.hhp
===================================================================
--- pkg/distrEx/chm/distrEx.hhp	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/chm/distrEx.hhp	2008-02-19 20:22:43 UTC (rev 77)
@@ -46,3 +46,4 @@
 m1df.html
 m2df.html
 make01.html
+vonMisesDist.html

Modified: pkg/distrEx/chm/distrEx.toc
===================================================================
--- pkg/distrEx/chm/distrEx.toc	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/chm/distrEx.toc	2008-02-19 20:22:43 UTC (rev 77)
@@ -1221,6 +1221,22 @@
 <param name="Name" value="var-methods">
 <param name="Local" value="Var.html">
 </OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="vonMisesDist">
+<param name="Local" value="vonMisesDist.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="vonMisesDist,numeric,UnivariateDistribution-method">
+<param name="Local" value="vonMisesDist.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="vonMisesDist,UnivariateDistribution,UnivariateDistribution-method">
+<param name="Local" value="vonMisesDist.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
+<param name="Name" value="vonMisesDist-methods">
+<param name="Local" value="vonMisesDist.html">
+</OBJECT>
 </UL>
 <LI> <OBJECT type="text/sitemap">
 <param name="Name" value="Package distrEx:  Titles">
@@ -1323,6 +1339,10 @@
 <param name="Local" value="TotalVarDist.html">
 </OBJECT>
 <LI> <OBJECT type="text/sitemap">
+<param name="Name" value="Generic function for the computation of the vonMises distance of two distributions">
+<param name="Local" value="vonMisesDist.html">
+</OBJECT>
+<LI> <OBJECT type="text/sitemap">
 <param name="Name" value="Generic Functions for the Computation of Functionals">
 <param name="Local" value="Var.html">
 </OBJECT>

Added: pkg/distrEx/chm/vonMisesDist.html
===================================================================
--- pkg/distrEx/chm/vonMisesDist.html	                        (rev 0)
+++ pkg/distrEx/chm/vonMisesDist.html	2008-02-19 20:22:43 UTC (rev 77)
@@ -0,0 +1,128 @@
+<html><head><title>Generic function for the computation of the vonMises distance of two distributions</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" type="text/css" href="Rchm.css">
+</head>
+<body>
+
+<table width="100%"><tr><td>vonMisesDist(distrEx)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
+<param name="keyword" value="R:   vonMisesDist">
+<param name="keyword" value="R:   vonMisesDist-methods">
+<param name="keyword" value="R:   vonMisesDist,UnivariateDistribution,UnivariateDistribution-method">
+<param name="keyword" value="R:   vonMisesDist,numeric,UnivariateDistribution-method">
+<param name="keyword" value=" Generic function for the computation of the vonMises distance of two distributions">
+</object>
+
+
+<h2>Generic function for the computation of the vonMises distance of two distributions</h2>
+
+
+<h3>Description</h3>
+
+<p>
+Generic function for the computation of the von Mises distance <i>d_{mu}</i>
+of two distributions <i>P</i> and <i>Q</i> where the distributions are defined 
+on a finite-dimensional Euclidean space <i>(R^m, B^m)</i>
+with <i>B^m</i> the Borel-<i>sigma</i>-algebra on <i>R^m</i>.
+The von Mises distance is defined as
+</p><p align="center"><i>d_{mu}(P,Q)^2=int (P({y in R^m | y &lt;= x})-Q({y in R^m | y &lt;= x}))^2 mu(dx)</i></p><p>
+where <i>&lt;=</i> is coordinatewise on <i>R^m</i>.
+</p>
+
+
+<h3>Usage</h3>
+
+<pre>
+vonMisesDist(e1, e2, ...)
+## S4 method for signature 'UnivariateDistribution,
+##   UnivariateDistribution':
+vonMisesDist(e1, e2, mu = e2)
+## S4 method for signature 'numeric,
+##   UnivariateDistribution':
+vonMisesDist(e1, e2, mu = e2)
+</pre>
+
+
+<h3>Arguments</h3>
+
+<table summary="R argblock">
+<tr valign="top"><td><code>e1</code></td>
+<td>
+object of class <code>"Distribution"</code> or class <code>"numeric"</code> </td></tr>
+<tr valign="top"><td><code>e2</code></td>
+<td>
+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>
+<tr valign="top"><td><code>mu</code></td>
+<td>
+object of class <code>"Distribution"</code>; integration measure; defaulting to <code>e2</code> </td></tr>
+</table>
+
+<h3>Value</h3>
+
+<p>
+von Mises distance of <code>e1</code> and <code>e2</code></p>
+
+<h3>Methods</h3>
+
+<dl>
+<dt>e1 = "UnivariateDistribution", e2 = "UnivariateDistribution":</dt><dd>von Mises distance of two univariate distributions.
+</dd>
+<dt>e1 = "numeric", e2 = "UnivariateDistribution":</dt><dd>von Mises distance between the empirical formed from a data set (e1) and a 
+univariate distribution. 
+</dd>
+</dl>
+
+<h3>Author(s)</h3>
+
+<p>
+Matthias Kohl <a href="mailto:Matthias.Kohl at stamats.de">Matthias.Kohl at stamats.de</a>,<br>
+Peter Ruckdeschel <a href="mailto:Peter.Ruckdeschel at uni-bayreuth.de">Peter.Ruckdeschel at uni-bayreuth.de</a>
+</p>
+
+
+<h3>References</h3>
+
+<p>
+Rieder, H. (1994) <EM>Robust Asymptotic Statistics</EM>. New York: Springer.
+</p>
+
+
+<h3>See Also</h3>
+
+<p>
+<code><a href="ContaminationSize.html">ContaminationSize</a></code>, <code><a href="TotalVarDist.html">TotalVarDist</a></code>, 
+<code><a href="HellingerDist.html">HellingerDist</a></code>, <code><a href="KolmogorovDist.html">KolmogorovDist</a></code>,
+<code><a onclick="findlink('distr', 'Distribution-class.html')" style="text-decoration: underline; color: blue; cursor: hand">Distribution-class</a></code>
+</p>
+
+
+<h3>Examples</h3>
+
+<pre>
+vonMisesDist(Norm(), Gumbel())
+vonMisesDist(Norm(), Gumbel(), mu = Norm())
+vonMisesDist(Norm(), Td(10))
+vonMisesDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100))
+vonMisesDist(Pois(10), Binom(size = 20)) 
+vonMisesDist(rnorm(100),Norm())
+vonMisesDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm())
+vonMisesDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
+vonMisesDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), mu = Pois())
+</pre>
+
+<script Language="JScript">
+function findlink(pkg, fn) {
+var Y, link;
+Y = location.href.lastIndexOf("\\") + 1;
+link = location.href.substring(0, Y);
+link = link + "../../" + pkg + "/chtml/" + pkg + ".chm::/" + fn;
+location.href = link;
+}
+</script>
+
+
+<hr><div align="center">[Package <em>distrEx</em> version 2.0 <a href="00Index.html">Index]</a></div>
+
+</body></html>

Modified: pkg/distrEx/man/0distrEx-package.Rd
===================================================================
--- pkg/distrEx/man/0distrEx-package.Rd	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrEx/man/0distrEx-package.Rd	2008-02-19 20:22:43 UTC (rev 77)
@@ -116,6 +116,8 @@
                         Kolmogorov distance of two distributions
 TotalVarDist            Generic function for the computation of the
                         total variation distance of two distributions
+vonMisesDist            Generic function for the computation of the
+                        von Mises distance of two distributions
 
 liesInSupport           Generic function for testing the support of a
                         distribution

Added: pkg/distrEx/man/vonMisesDist.Rd
===================================================================
--- pkg/distrEx/man/vonMisesDist.Rd	                        (rev 0)
+++ pkg/distrEx/man/vonMisesDist.Rd	2008-02-19 20:22:43 UTC (rev 77)
@@ -0,0 +1,62 @@
+\name{vonMisesDist}
+\alias{vonMisesDist}
+\alias{vonMisesDist-methods}
+\alias{vonMisesDist,UnivariateDistribution,UnivariateDistribution-method}
+\alias{vonMisesDist,numeric,UnivariateDistribution-method}
+
+\title{Generic function for the computation of the vonMises distance of two distributions}
+\description{
+  Generic function for the computation of the von Mises distance \eqn{d_\mu}{d_{mu}}
+  of two distributions \eqn{P} and \eqn{Q} where the distributions are defined 
+  on a finite-dimensional Euclidean space \eqn{(\R^m,{\cal B}^m)}{(R^m, B^m)}
+  with \eqn{ {\cal B}^m }{B^m} the Borel-\eqn{\sigma}{sigma}-algebra on \eqn{R^m}.
+  The von Mises distance is defined as
+  \deqn{d_\mu(P,Q)^2=\int\,(P(\{y\in\R^m\,|\,y\le x\})-Q(\{y\in\R^m\,|\,y\le x\}))^2\,\mu(dx)}{
+  d_{mu}(P,Q)^2=\int (P(\{y in R^m | y <= x\})-Q(\{y in R^m | y <= x\}))^2 mu(dx)}
+  where \eqn{\le}{<=} is coordinatewise on \eqn{\R^m}{R^m}.
+}
+\usage{
+vonMisesDist(e1, 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{mu}{ object of class \code{"Distribution"}; integration measure; defaulting to \code{e2} }
+}
+%\details{}
+\value{ von Mises distance of \code{e1} and \code{e2} }
+\section{Methods}{
+\describe{
+  \item{e1 = "UnivariateDistribution", e2 = "UnivariateDistribution":}{
+    von Mises distance of two univariate distributions.
+  }
+  \item{e1 = "numeric", e2 = "UnivariateDistribution":}{
+    von Mises distance between the empirical formed from a data set (e1) and a 
+    univariate distribution. 
+  }
+}}
+\references{
+    Rieder, H. (1994) \emph{Robust Asymptotic Statistics}. New York: Springer.
+}
+\author{Matthias Kohl \email{Matthias.Kohl at stamats.de},\cr
+        Peter Ruckdeschel \email{Peter.Ruckdeschel at uni-bayreuth.de}}
+%\note{ ~~further notes~~ }
+\seealso{\code{\link{ContaminationSize}}, \code{\link{TotalVarDist}}, 
+    \code{\link{HellingerDist}}, \code{\link{KolmogorovDist}},
+    \code{\link[distr]{Distribution-class}}}
+\examples{
+vonMisesDist(Norm(), Gumbel())
+vonMisesDist(Norm(), Gumbel(), mu = Norm())
+vonMisesDist(Norm(), Td(10))
+vonMisesDist(Norm(mean = 50, sd = sqrt(25)), Binom(size = 100))
+vonMisesDist(Pois(10), Binom(size = 20)) 
+vonMisesDist(rnorm(100),Norm())
+vonMisesDist((rbinom(50, size = 20, prob = 0.5)-10)/sqrt(5), Norm())
+vonMisesDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5))
+vonMisesDist(rbinom(50, size = 20, prob = 0.5), Binom(size = 20, prob = 0.5), mu = Pois())
+}
+\concept{distance}
+\keyword{distribution}

Modified: pkg/distrMod/man/MDEstimator.Rd
===================================================================
--- pkg/distrMod/man/MDEstimator.Rd	2008-02-19 07:45:26 UTC (rev 76)
+++ pkg/distrMod/man/MDEstimator.Rd	2008-02-19 20:22:43 UTC (rev 77)
@@ -64,6 +64,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)



More information about the Distr-commits mailing list