[Distr-commits] r372 - branches/distr-2.1/pkg/distrEx/R branches/distr-2.1/pkg/distrMod/R branches/distr-2.1/pkg/distrMod/man pkg/utils

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 9 20:59:58 CET 2008


Author: ruckdeschel
Date: 2008-12-09 20:59:58 +0100 (Tue, 09 Dec 2008)
New Revision: 372

Modified:
   branches/distr-2.1/pkg/distrEx/R/Internalfunctions.R
   branches/distr-2.1/pkg/distrMod/R/mleCalc-methods.R
   branches/distr-2.1/pkg/distrMod/man/MLEstimator.Rd
   pkg/utils/DESCRIPTIONutils.R
Log:
copied today's changes to branch 2.1 and upload of a "new" version of DESCRIPTIONutils.R

Modified: branches/distr-2.1/pkg/distrEx/R/Internalfunctions.R
===================================================================
--- branches/distr-2.1/pkg/distrEx/R/Internalfunctions.R	2008-12-09 14:24:40 UTC (rev 371)
+++ branches/distr-2.1/pkg/distrEx/R/Internalfunctions.R	2008-12-09 19:59:58 UTC (rev 372)
@@ -2,7 +2,7 @@
 
 ## discretize distributions
 .discretizeDistr <- function(D, x, lower, upper, n){
-    print(list(D, x, lower, upper, n))
+#    print(list(D, x, lower, upper, n))
     y <- seq(from = lower, to = upper, length = n)
     x <- x[x<=upper & x>=lower]
     supp <- y[-1]-(y[2]-y[1])/2

Modified: branches/distr-2.1/pkg/distrMod/R/mleCalc-methods.R
===================================================================
--- branches/distr-2.1/pkg/distrMod/R/mleCalc-methods.R	2008-12-09 14:24:40 UTC (rev 371)
+++ branches/distr-2.1/pkg/distrMod/R/mleCalc-methods.R	2008-12-09 19:59:58 UTC (rev 372)
@@ -177,7 +177,8 @@
 
 setMethod("mleCalc", signature(x = "numeric", PFam = "NormScaleFamily"),
            function(x, PFam, ...){
-           theta <- sd(x); mn <- mean(distribution(PFam))
+           n <- length(x)
+           theta <- sqrt((n-1)/n)*sd(x); mn <- mean(distribution(PFam))
            ll <- -sum(dnorm(x, mean=mn, sd = theta, log=TRUE))
            names(ll) <- "neg.Loglikelihood"
            crit.fct <- function(sd)
@@ -190,7 +191,8 @@
 
 setMethod("mleCalc", signature(x = "numeric", PFam = "NormLocationScaleFamily"),
            function(x, PFam, ...){
-           sd0 <- sd(x); mn <- mean(x); 
+           n <- length(x)
+           sd0 <- sqrt((n-1)/n)*sd(x); mn <- mean(x); 
            theta <- c(mn, sd0); 
            names(theta) <- c("mean", "sd")
            ll <- -sum(dnorm(x, mean = mn, sd = sd0, log = TRUE))

Modified: branches/distr-2.1/pkg/distrMod/man/MLEstimator.Rd
===================================================================
--- branches/distr-2.1/pkg/distrMod/man/MLEstimator.Rd	2008-12-09 14:24:40 UTC (rev 371)
+++ branches/distr-2.1/pkg/distrMod/man/MLEstimator.Rd	2008-12-09 19:59:58 UTC (rev 372)
@@ -44,13 +44,13 @@
         Peter Ruckdeschel \email{Peter.Ruckdeschel at itwm.fraunhofer.de}}
 %\note{}
 \seealso{\code{\link{ParamFamily-class}}, \code{\link{ParamFamily}}, 
-         \code{\link{MCEstimator}, \code{\link{MCEstimate-class}}},
-\code{\link[MASS]{fitdistr}} }
+         \code{\link{MCEstimator}}, \code{\link{MCEstimate-class}},
+         \code{\link[MASS]{fitdistr}}, \code{\link[stats4]{mle}} }
 \examples{
 #############################
 ## 1. Binomial data
 #############################
-## generate a sample of contaminated data
+## (empirical) data
 x <- rbinom(100, size=25, prob=.25)
 
 ## ML-estimate
@@ -72,7 +72,7 @@
 #############################
 ## 3. Normal (Gaussian) location and scale
 #############################
-## Generate a contaminated sample
+## (empirical) data
 x <- rnorm(100)
 
 ## ML-estimate
@@ -84,7 +84,7 @@
 #############################
 ## 4. Gamma model
 #############################
-## (empirical) Data
+## (empirical) data
 x <- rgamma(50, scale = 0.5, shape = 3)
 
 ## parametric family of probability measures
@@ -149,11 +149,12 @@
 ## 5. Cauchy Location Scale model
 #############################
 (C <- CauchyLocationScaleFamily())
-loc.true <- 1; scl.true <- 2
+loc.true <- 1
+scl.true <- 2
 
-## (empirical) Data
+## (empirical) data
 x <- rcauchy(50, location = loc.true, scale = scl.true)
- 
+
 ## Maximum likelihood estimator
 (res <- MLEstimator(x = x, ParamFamily = C))
 ## Asymptotic (CLT-based) confidence interval

Modified: pkg/utils/DESCRIPTIONutils.R
===================================================================
--- pkg/utils/DESCRIPTIONutils.R	2008-12-09 14:24:40 UTC (rev 371)
+++ pkg/utils/DESCRIPTIONutils.R	2008-12-09 19:59:58 UTC (rev 372)
@@ -80,15 +80,23 @@
 colnames(Values) <- Pkgs
 rownames(Values) <- Names
 
-Pkgs <- "distrMod"
+Pkgs <- "distrTEst"
 Names <- c("Version", "Date")
 Values <- matrix(c("2.0.4",
                              format(Sys.time(), format="%Y-%m-%d")),2,length(Pkgs))
 colnames(Values) <- Pkgs
 rownames(Values) <- Names
 changeDescription(startDir = "C:/rtest/distr",names=Names,
-                  pkgs=c("distrMod"), values=Values)
+                  pkgs=c("distrTEst"), values=Values)
 
+Pkgs <- "RobAStBase"
+Names <- c("Version", "Date")
+Values <- matrix(c("0.1.4",
+                             format(Sys.time(), format="%Y-%m-%d")),2,length(Pkgs))
+colnames(Values) <- Pkgs
+rownames(Values) <- Names
+changeDescription(startDir = "C:/rtest/robast",names=Names,
+                  pkgs=Pkgs, values=Values)
 
 
 changeDescription(startDir = "C:/rtest/distr",names="Date", 



More information about the Distr-commits mailing list