[Distr-commits] r560 - in branches/distr-2.2/pkg: distrEx/R distrEx/chm distrMod/R distrMod/chm distrMod/inst/scripts

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 1 06:28:18 CEST 2009


Author: ruckdeschel
Date: 2009-09-01 06:28:17 +0200 (Tue, 01 Sep 2009)
New Revision: 560

Modified:
   branches/distr-2.2/pkg/distrEx/R/Expectation.R
   branches/distr-2.2/pkg/distrEx/chm/distrEx.chm
   branches/distr-2.2/pkg/distrMod/R/setAs.R
   branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
   branches/distr-2.2/pkg/distrMod/inst/scripts/BetaFam.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/PoisFam.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample1.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/example_CvMMDE.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/examples2.R
   branches/distr-2.2/pkg/distrMod/inst/scripts/modelExp3.R
Log:
distrEx:
forgot deleting some print command
distrMod:
inserted R output as comments to scripts in /inst/scripts for later reference
setAs(<MCEstimate>,<mle>) was wrong for nuisance parameters

Modified: branches/distr-2.2/pkg/distrEx/R/Expectation.R
===================================================================
--- branches/distr-2.2/pkg/distrEx/R/Expectation.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrEx/R/Expectation.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -47,6 +47,7 @@
               upperTruncQuantile, IQR.fac)
         low <- Ib["low"]
         upp <- Ib["upp"]
+        #print(Ib)
         if(upp<low) return(0)
 
         return(distrExIntegrate(f = integrand, 

Modified: branches/distr-2.2/pkg/distrEx/chm/distrEx.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/distrMod/R/setAs.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/R/setAs.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/R/setAs.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -57,7 +57,9 @@
                             list(crit.f = crit.f0,
                                  startPar = start.f0))
       to at coef <- from at estimate
-      to at fullcoef <- c(from at estimate,from at fixed)
+      fe <- if(is.null(from at untransformed.estimate))
+               from at estimate else from at untransformed.estimate
+      to at fullcoef <- c(fe,from at fixed)
       to at vcov <- if(!is.null(from at asvar)) 
                  from at asvar/from at samplesize else matrix(NA,1,1)
       to at min <- from at criterion
@@ -67,9 +69,10 @@
 to})
 
 setMethod("profile", "MCEstimate",
-          function (fitted, which = 1:p, maxsteps = 100,
+          function (fitted, which = 1:length(fitted at estimate), maxsteps = 100,
                     alpha = 0.01, zmax = sqrt(qchisq(1 - alpha, 1L)),
                     del = zmax/5, trace = FALSE, ...){
-m.mle <- as(fitted,"mle") 
-profile(m.mle)
+m.mle <- as(fitted,"mle")
+profile(m.mle, which=which, maxsteps=maxsteps, alpha=alpha, zmax=zmax,
+del=del, trace=trace, ...)
 })

Modified: branches/distr-2.2/pkg/distrMod/chm/distrMod.chm
===================================================================
(Binary files differ)

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/BetaFam.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/BetaFam.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/BetaFam.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -8,8 +8,92 @@
 # generate data
 x <- r(B)(40)
 distroptions(DistrResolution = 1e-10)
+
 MDEstimator(x, B, distance = TotalVarDist)
+
+#Evaluations of Minimum total variation distance estimate:
+#---------------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = B, distance = TotalVarDist)
+#samplesize:   40
+#estimate:
+#  shape1   shape2
+#3.218402 6.134194
+#Criterion:
+#total variation distance
+#               0.7993998
+
 MDEstimator(x, B)
+
+#Evaluations of Minimum Kolmogorov distance estimate:
+#----------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = B)
+#samplesize:   40
+#estimate:
+#  shape1   shape2
+#1.419884 2.540196
+#Criterion:
+#Kolmogorov distance
+#         0.07407411
+
 MDEstimator(x, B, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = B, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+#samplesize:   40
+#estimate:
+#    shape1      shape2
+#  1.4895092   2.6895131
+# (0.3850902) (0.7462670)
+#asymptotic (co)variance (multiplied with samplesize):
+#         shape1    shape2
+#shape1 5.931779  8.230865
+#shape2 8.230865 22.276575
+#Criterion:
+#CvM distance
+#  0.03256456
+
 (MLE<-MLEstimator(x, B))
+
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = x, ParamFamily = B)
+#samplesize:   40
+#estimate:
+#    shape1      shape2
+#  1.6057134   2.9312042
+# (0.3320569) (0.6485889)
+#asymptotic (co)variance (multiplied with samplesize):
+#         shape1    shape2
+#shape1 4.410470  6.821746
+#shape2 6.821746 16.826704
+#Criterion:
+#negative log-likelihood
+#              -9.920826
+
 confint(MLE)
+
+#A[n] asymptotic (CLT-based) confidence interval:
+#          2.5 %   97.5 %
+#shape1 0.954894 2.256533
+#shape2 1.659993 4.202415
+#Type of estimator: Maximum likelihood estimate
+#samplesize:   40
+#Call by which estimate was produced:
+#MLEstimator(x = x, ParamFamily = B)
+
+
+
+
+
+
+
+

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/PoisFam.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/PoisFam.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/PoisFam.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -7,9 +7,84 @@
 # generate data
 x <- r(P)(40)
 MLEstimator(x,P)
+
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = x, ParamFamily = P)
+#samplesize:   40
+#estimate:
+#
+#  3.2000000
+# (0.2828427)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 3.2
+#Criterion:
+#negative log-likelihood
+#               78.23019
+
 MDEstimator(x,P)
+
+#Evaluations of Minimum Kolmogorov distance estimate:
+#----------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P)
+#samplesize:   40
+#estimate:
+#  lambda
+#3.265427
+#Criterion:
+#Kolmogorov distance
+#         0.03800172
+
 MDEstimator(x,P, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+#samplesize:   40
+#estimate:
+#    lambda
+#  3.3311598
+# (0.4070559)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 6.627779
+#Criterion:
+#CvM distance
+#  0.02660172
+
 MDEstimator(x,P, distance = CvMDist, mu = Norm())
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P, distance = CvMDist, mu = Norm())
+#samplesize:   40
+#estimate:
+#  lambda
+#3.067493
+#Criterion:
+#CvM distance
+#  0.00967911
+
 MDEstimator(x,P, distance = TotalVarDist)
 
+#Evaluations of Minimum total variation distance estimate:
+#---------------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P, distance = TotalVarDist)
+#samplesize:   40
+#estimate:
+#  lambda
+#3.113106
+#Criterion:
+#total variation distance
+#               0.1097785
 
+

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/censoredPois.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -19,14 +19,14 @@
 
     ## mapping theta -> P_theta
     modifyParam <- function(theta){
-                      Truncate(Pois(lambda = theta), lower = trunc.pt)}
+                      P <- Pois(lambda = theta)
+                      Truncate(P, lower = trunc.pt)}
 
     ## search interval for reasonable parameters
     startPar <- function(x,...) c(.Machine$double.eps,max(x))
 
     ## what to do in case of leaving the parameter domain
-    makeOKPar <- function(param) {if(param<=0) return(.Machine$double.eps)
-                                  return(param)}
+    makeOKPar <- function(param) max(param,.Machine$double.eps^.4)
 
     ## mapping theta -> Lambda_theta
     L2deriv.fct <- function(param){
@@ -59,19 +59,140 @@
 
 ## MLE
 (m<- MLEstimator(CP.data, CP))
+
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = CP.data, ParamFamily = CP)
+#samplesize:   40
+#estimate:
+#    lambda
+#  2.6221186
+# (0.2737858)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 2.998346
+#Criterion:
+#negative log-likelihood
+#               59.45028
+
 confint(m)
+
+#A[n] asymptotic (CLT-based) confidence interval:
+#          2.5 %   97.5 %
+#lambda 2.085508 3.158729
+#Type of estimator: Maximum likelihood estimate
+#samplesize:   40
+#Call by which estimate was produced:
+#MLEstimator(x = CP.data, ParamFamily = CP)
+
 plot(profile(m))
 
 ## MDE
 (md.kolm<- MDEstimator(CP.data, CP))
+
+#Evaluations of Minimum Kolmogorov distance estimate:
+#----------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = CP.data, ParamFamily = CP)
+#samplesize:   40
+#estimate:
+#  lambda
+#2.756499
+#Criterion:
+#Kolmogorov distance
+#         0.04190892
+
+
 (md.CvM<-  MDEstimator(CP.data, CP, distance = CvMDist,
            asvar.fct = distrMod:::.CvMMDCovariance))
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = CP.data, ParamFamily = CP, distance = CvMDist,
+#    asvar.fct = distrMod:::.CvMMDCovariance)
+#samplesize:   40
+#estimate:
+#    lambda
+#  2.701491
+# (1.926043)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 148.3857
+#Criterion:
+#CvM distance
+#  0.03700009
+
+
 confint(md.CvM)
+
+#A[n] asymptotic (CLT-based) confidence interval:
+#           2.5 %   97.5 %
+#lambda -1.073484 6.476466
+#Type of estimator: Minimum CvM distance estimate
+#samplesize:   40
+#Call by which estimate was produced:
+#MDEstimator(x = CP.data, ParamFamily = CP, distance = CvMDist,
+#    asvar.fct = distrMod:::.CvMMDCovariance)
+
+###--->PROBLEM:
 plot(profile(md.CvM))
 
 if(require(ROptEst)){
 CP.data0 <- r(CP)(10000)
 CP.data1 <- CP.data0; CP.data1[sample(1:100,10)] <- NA
-(md.ropt<- roptest(CP.data0, CP, eps=0.1, initial.est=md.CvM))
+print(md.ropt<- roptest(CP.data0, CP, eps=0.1, initial.est=md.CvM))
 confint(md.ropt,symmetricBias())
-}
\ No newline at end of file
+}
+
+#Evaluations of 1-step estimate:
+#-------------------------------
+#An object of class “Estimate”
+#generated by call
+#  roptest(x = CP.data0, L2Fam = CP, eps = 0.1, initial.est = md.CvM)
+#samplesize:   10000
+#estimate:
+#     lambda
+#  2.87822794
+# (0.01379214)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 1.902231
+#Infos:
+#     method    message
+#[1,] "roptest" "1-step estimate for Censored Poisson family"
+#[2,] "roptest" "computation of IC, asvar and asbias via useLast = FALSE"
+#asymptotic bias:
+#[1] 16.28873
+#(partial) influence curve:
+#An object of class “ContIC”
+#### name:        IC of contamination type
+#
+#### L2-differentiable parametric family:         Censored Poisson family
+#### param:      An object of class "ParamFamParameter"
+#name:   positive mean
+#lambda: 2.70149127445287
+#
+#### neighborhood radius:         10
+#
+#### clip:       [1] 1.628873
+#### cent:       [1] -99.29597
+#### stand:
+#         [,1]
+#[1,] 267.2244
+#
+#### Infos:
+#     method  message
+#[1,] "optIC" "optimally robust IC for ‘asMSE’"
+#steps:
+#[1] 1
+#A[n] asymptotic (LAN-based), uniform (bias-aware)
+# confidence interval:
+#for symmetric Bias
+#          2.5 %   97.5 %
+#lambda 2.626539 3.129917
+#Type of estimator: 1-step estimate
+#samplesize:   10000
+#Call by which estimate was produced:
+#roptest(x = CP.data0, L2Fam = CP, eps = 0.1, initial.est = md.CvM)

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -108,6 +108,31 @@
                   modifyParam = function(theta){ SkewNorm(loc = theta, scale = 1, shape = 1) })
 SNL
 
+#An object of class "ParamFamily"
+#### name:       Skew normal location family
+#
+#### distribution:       Distribution Object of Class: SkewNorm
+# loc: 0
+# scale: 1
+# shape: 1
+#
+#### param:      An object of class "ParamFamParameter"
+#name:   location parameter
+#loc:    0
+
+
 x <- r(SN)(50)
 est <- MLEstimator(x, SNL)
 
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = x, ParamFamily = SNL)
+#samplesize:   50
+#estimate:
+#       loc
+#-0.0891984
+#Criterion:
+#negative log-likelihood
+#              -7.901378

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample1.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample1.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/distrModExample1.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -96,10 +96,36 @@
                   modifyParam = function(theta){ SkewNorm(loc = theta, scale = 1, shape = 1) })
 SNL
 
+#An object of class "ParamFamily"
+#### name:       Skew normal location family
+#
+#### distribution:       Distribution Object of Class: SkewNorm
+# loc: 0
+# scale: 1
+# shape: 1
+#
+#### param:      An object of class "ParamFamParameter"
+#name:   location parameter
+#loc:    0
+
+
 ## some data
 x <- rnorm(50)
-est <- MLEstimator(x, SNL)
+(est <- MLEstimator(x, SNL))
 
+#An object of class "ParamFamily"
+#### name:       Skew normal location family
+#
+#### distribution:       Distribution Object of Class: SkewNorm
+# loc: 0
+# scale: 1
+# shape: 1
+#
+#### param:      An object of class "ParamFamParameter"
+#name:   location parameter
+#loc:    0
+
+
 ## error!
 r(SN)(50)
 

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/example_CvMMDE.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/example_CvMMDE.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/example_CvMMDE.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -7,15 +7,119 @@
 NF <- NormLocationScaleFamily()
 
 system.time(print(MDEstimator(x,NF,CvMDist)))
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = NF, distance = CvMDist)
+#samplesize:   30
+#estimate:
+#      mean         sd
+#0.08533113 1.40693795
+#Criterion:
+#CvM distance
+#  0.04340385
+#   user  system elapsed
+#   1.94    0.00    1.94
+
 #with useApply
 system.time(print(MDEstimator(x,NF,CvMDist,useApply=TRUE)))
 
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = NF, distance = CvMDist, useApply = TRUE)
+#samplesize:   30
+#estimate:
+#      mean         sd
+#0.08533113 1.40693795
+#Criterion:
+#CvM distance
+#  0.04340385
+#   user  system elapsed
+#  12.12    0.01   12.19
+
+
 MDEstimator(rnorm(30),NF,CvMDist)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = rnorm(30), ParamFamily = NF, distance = CvMDist)
+#samplesize:   30
+#estimate:
+#      mean         sd
+#0.03446453 1.03476194
+#Criterion:
+#CvM distance
+#  0.03514274
+
 #another sample
 MDEstimator(rnorm(30),NF,CvMDist)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = rnorm(30), ParamFamily = NF, distance = CvMDist)
+#samplesize:   30
+#estimate:
+#       mean          sd
+#-0.06154767  1.20988270
+#Criterion:
+#CvM distance
+#  0.03146225
+
+
 # larger sample size
 MDEstimator(rnorm(300),NF,CvMDist)
 
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = rnorm(300), ParamFamily = NF, distance = CvMDist)
+#samplesize:   300
+#estimate:
+#       mean          sd
+#-0.08629963  1.03697176
+#Criterion:
+#CvM distance
+# 0.009871934
+
 MDEstimator(rnorm(300,mean=2,sd=2),NF,CvMDist)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = rnorm(300, mean = 2, sd = 2), ParamFamily = NF,
+#    distance = CvMDist)
+#samplesize:   300
+#estimate:
+#    mean       sd
+#2.164488 1.952065
+#Criterion:
+#CvM distance
+#  0.01002004
+
+
 #another sample
 MDEstimator(rnorm(300,mean=2,sd=2),NF,CvMDist)
+
+Evaluations of Minimum CvM distance estimate:
+---------------------------------------------
+An object of class “Estimate”
+generated by call
+  MDEstimator(x = rnorm(300, mean = 2, sd = 2), ParamFamily = NF,
+    distance = CvMDist)
+samplesize:   300
+estimate:
+    mean       sd
+1.877466 1.990109
+Criterion:
+CvM distance
+ 0.009298052
\ No newline at end of file

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/examples2.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/examples2.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/examples2.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -7,11 +7,85 @@
 # generate data
 x <- r(P)(40)
 MLEstimator(x,P)
+
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = x, ParamFamily = P)
+#samplesize:   40
+#estimate:
+#
+#  3.050000
+# (0.276134)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 3.05
+#Criterion:
+#negative log-likelihood
+#               82.92266
+
 MDEstimator(x,P)
+
+#Evaluations of Minimum Kolmogorov distance estimate:
+#----------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P)
+#samplesize:   40
+#estimate:
+#  lambda
+#3.049777
+#Criterion:
+#Kolmogorov distance
+#         0.08891945
+
 MDEstimator(x,P, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+#samplesize:   40
+#estimate:
+#    lambda
+#  2.9561034
+# (0.3855664)
+#asymptotic (co)variance (multiplied with samplesize):
+#[1] 5.946458
+#Criterion:
+#CvM distance
+#  0.04909021
+
 MDEstimator(x,P, distance = CvMDist, mu = Norm())
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P, distance = CvMDist, mu = Norm())
+#samplesize:   40
+#estimate:
+#  lambda
+#2.840035
+#Criterion:
+#CvM distance
+#  0.02739709
+
 MDEstimator(x,P, distance = TotalVarDist)
 
+#Evaluations of Minimum total variation distance estimate:
+#---------------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = P, distance = TotalVarDist)
+#samplesize:   40
+#estimate:
+#  lambda
+#2.987849
+#Criterion:
+#total variation distance
+#               0.2543123
 
 ### Beta Family
 B <- BetaFamily(2,4)
@@ -19,11 +93,86 @@
 x <- r(B)(40)
 distroptions(DistrResolution = 1e-10)
 MDEstimator(x, B, distance = TotalVarDist)
+
+#Evaluations of Minimum total variation distance estimate:
+#---------------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = B, distance = TotalVarDist)
+#samplesize:   40
+#estimate:
+#  shape1   shape2
+#3.843629 7.338333
+#Criterion:
+#total variation distance
+#               0.7421599
+
 MDEstimator(x, B)
+
+#Evaluations of Minimum Kolmogorov distance estimate:
+#----------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = B)
+#samplesize:   40
+#estimate:
+#  shape1   shape2
+#4.140942 8.612960
+#Criterion:
+#Kolmogorov distance
+#          0.0881627
+
 MDEstimator(x, B, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = B, distance = CvMDist, asvar.fct = distrMod:::.CvMMDCovariance)
+#samplesize:   40
+#estimate:
+#    shape1     shape2
+#  4.362062   9.021663
+# (1.175868) (2.501083)
+#asymptotic (co)variance (multiplied with samplesize):
+#          shape1   shape2
+#shape1  55.30661 105.8183
+#shape2 105.81828 250.2166
+#Criterion:
+#CvM distance
+#  0.03793965
+
 (MLE<-MLEstimator(x, B))
+
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = x, ParamFamily = B)
+#samplesize:   40
+#estimate:
+#    shape1      shape2
+#  3.8799534   8.3454158
+# (0.8356662) (1.8607859)
+#asymptotic (co)variance (multiplied with samplesize):
+#         shape1    shape2
+#shape1 27.93352  56.60962
+#shape2 56.60962 138.50097
+#Criterion:
+#negative log-likelihood
+#              -26.44365
+
 confint(MLE)
 
+#A[n] asymptotic (CLT-based) confidence interval:
+#          2.5 %    97.5 %
+#shape1 2.242078  5.517829
+#shape2 4.698342 11.992489
+#Type of estimator: Maximum likelihood estimate
+#samplesize:   40
+#Call by which estimate was produced:
+#MLEstimator(x = x, ParamFamily = B)
+
 ### a new central distribution
 my3d <- AbscontDistribution( d = function(x) exp(-abs(x)^3), withS = TRUE)
 plot(my3d)
@@ -36,9 +185,41 @@
 x <- r(my3dF)(40)*3+2
 ### evaluate the MLE:
 MLEstimator(x,my3dF)
-MDE = MDEstimator(x = x, ParamFamily = my3dF, distance = CvMDist)
 
-MDE.asvar <- distrMod:::.CvMMDCovariance(my3dF, 
-                 param = ParamFamParameter(main= estimate(MDE)),
-                 expon = 2, withplot = TRUE)
+#Evaluations of Maximum likelihood estimate:
+#-------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MLEstimator(x = x, ParamFamily = my3dF)
+#samplesize:   40
+#estimate:
+#      loc        scale
+#  1.8536010   3.3710549
+# (0.3060706) (0.3077495)
+#asymptotic (co)variance (multiplied with samplesize):
+#           loc    scale
+#loc   3.747169 0.000000
+#scale 0.000000 3.788389
+#Criterion:
+#negative log-likelihood
+#               85.14204
 
+(MDE <- MDEstimator(x = x, ParamFamily = my3dF, distance = CvMDist))
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = my3dF, distance = CvMDist)
+#samplesize:   40
+#estimate:
+#     loc    scale
+#1.991751 3.758789
+#Criterion:
+#CvM distance
+#  0.03114585
+#
+#MDE.asvar <- distrMod:::.CvMMDCovariance(my3dF,
+#                 param = ParamFamParameter(main= estimate(MDE)),
+#                 expon = 2, withplot = TRUE)
+

Modified: branches/distr-2.2/pkg/distrMod/inst/scripts/modelExp3.R
===================================================================
--- branches/distr-2.2/pkg/distrMod/inst/scripts/modelExp3.R	2009-08-31 17:01:41 UTC (rev 559)
+++ branches/distr-2.2/pkg/distrMod/inst/scripts/modelExp3.R	2009-09-01 04:28:17 UTC (rev 560)
@@ -29,10 +29,56 @@
 # a confidence interval
 confint(mledistrMod)
 
-(mde.kolm <- (x = x, ParamFamily = my3dF))
+#A[n] asymptotic (CLT-based) confidence interval:
+#         2.5 %   97.5 %
+#loc   2.785576 3.391666
+#scale 1.398247 2.007662
+#Type of estimator: Maximum likelihood estimate
+#samplesize:   40
+#Call by which estimate was produced:
+#MLEstimator(x = x, ParamFamily = my3dF)
+
+(mde.kolm <- MDEstimator(x = x, ParamFamily = my3dF))
+
+#Evaluations of Minimum Kolmogorov distance estimate:
+#----------------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = my3dF)
+#samplesize:   40
+#estimate:
+#     loc    scale
+#3.110172 1.857230
+#Criterion:
+#Kolmogorov distance
+#         0.05978152
+
 (mde.CvM <- MDEstimator(x = x, ParamFamily = my3dF, distance = CvMDist))
+
+#Evaluations of Minimum CvM distance estimate:
+#---------------------------------------------
+#An object of class “Estimate”
+#generated by call
+#  MDEstimator(x = x, ParamFamily = my3dF, distance = CvMDist)
+#samplesize:   40
+#estimate:
+#     loc    scale
+#3.124343 1.817609
+#Criterion:
+#CvM distance
+#  0.02527883
+
 asvar(mde.CvM) <- distrMod:::.CvMMDCovariance(my3dF, 
                   param = ParamFamParameter(main= estimate(MDE)),
                   expon = 2, withplot = TRUE)
 # a confidence interval
 confint(mde.CvM)
+
+#A[n] asymptotic (CLT-based) confidence interval:
+#          2.5 %   97.5 %
+#loc   1.9488691 4.299817
+#scale 0.9260041 2.709214
+#Type of estimator: Minimum CvM distance estimate
+#samplesize:   40
+#Call by which estimate was produced:
+#MDEstimator(x = x, ParamFamily = my3dF, distance = CvMDist)



More information about the Distr-commits mailing list