[Gmm-commits] r154 - in pkg/gmm4: . R man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 19 21:10:24 CET 2019


Author: chaussep
Date: 2019-11-19 21:10:23 +0100 (Tue, 19 Nov 2019)
New Revision: 154

Modified:
   pkg/gmm4/NAMESPACE
   pkg/gmm4/R/gelModels-methods.R
   pkg/gmm4/R/gelfit-methods.R
   pkg/gmm4/R/gmmfit-methods.R
   pkg/gmm4/man/confint-methods.Rd
   pkg/gmm4/man/plot-methods.Rd
   pkg/gmm4/vignettes/gelS4.Rnw
   pkg/gmm4/vignettes/gelS4.pdf
   pkg/gmm4/vignettes/gmmS4.pdf
Log:
added 2D confidence regions and fixed vignettes

Modified: pkg/gmm4/NAMESPACE
===================================================================
--- pkg/gmm4/NAMESPACE	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/NAMESPACE	2019-11-19 20:10:23 UTC (rev 154)
@@ -5,7 +5,7 @@
 
 importFrom("parallel", mclapply)
 
-importFrom("graphics", plot, polygon, grid)
+importFrom("graphics", plot, polygon, grid, points)
 
 importFrom("utils", capture.output)
 
@@ -14,7 +14,7 @@
            "D", "numericDeriv", "sd", "optim", "lm", "pf", "coef", "update",
            "fitted", "lm.fit", "pchisq", "pnorm", "printCoefmat", "anova",
            "model.frame", "reformulate", "formula", "nlminb", "kernapply",
-           "constrOptim", "kernel", "confint", "qnorm", "uniroot", "getCall")
+           "constrOptim", "kernel", "confint", "qnorm", "uniroot", "getCall", "qchisq")
 importFrom("sandwich", "vcovHAC", "estfun","kernHAC","vcovCL", "meatCL",
            "bread","bwAndrews","bwNeweyWest","weightsAndrews",
            "weightsLumley", "vcovHC")

Modified: pkg/gmm4/R/gelModels-methods.R
===================================================================
--- pkg/gmm4/R/gelModels-methods.R	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/R/gelModels-methods.R	2019-11-19 20:10:23 UTC (rev 154)
@@ -314,7 +314,7 @@
               arg <- list(...)                          
               allowed <- c("vcov","vcovOptions", "centeredVcov",
                            "gelType", "rhoFct")
-              arg <- arg[na.omit(match(allowed, names(arg)))]
+              arg <- arg[na.omit(match(allowed, names(arg)))]           
               if (length(arg) == 0)
                   return(object)
               gelType <- if (is.null(arg$gelType))

Modified: pkg/gmm4/R/gelfit-methods.R
===================================================================
--- pkg/gmm4/R/gelfit-methods.R	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/R/gelfit-methods.R	2019-11-19 20:10:23 UTC (rev 154)
@@ -3,6 +3,53 @@
 
 ### Hidden functions
 
+.minvTest <- function (object, which = 1:2, fact = 2, npoints=30, level=0.95,
+                       type=c("LR", "LM", "J"), cores=8) 
+{
+    type <- match.arg(type)
+    if (length(which) != 2) 
+        stop("You must select 2 coefficients")
+    if (length(coef(object)) < 2) 
+        stop("You need at least two coefficients")
+    W <- confint(object, parm=which, level=level, area=TRUE, npoints=npoints,
+                 fact=fact, type="Wald")
+    p <- W at areaPoints
+    spec <- modelDims(object at model)
+    df <- spec$q-spec$k
+    if (df > 0)
+    {
+        test0 <- c(specTest(object, type=type)@test)
+        test0 <- test0[1]
+    } else {
+        test0 <- 0
+    }    
+    f <- function(delta, pti, obj, which, type, test0, level)
+    {
+        b <- coef(obj)[which]
+        pti <- b*(1-delta) + pti*delta
+        R <- paste(names(b), "=", pti, sep="")
+        if (obj at call[[1]] == "gel4")
+        {
+            fit <- suppressWarnings(update(obj, cstLHS=R))
+        } else {
+            mod <- restModel(obj at model, R)
+            fit <- suppressWarnings(update(obj, newModel=mod))
+        }
+        test <- c(specTest(fit, type=type)@test)[1]-test0
+        test-qchisq(level, 2)
+    }
+    res <- try(mclapply(1:nrow(p), function(i) {
+        r <- try(uniroot(f, c(0,fact), pti=p[i,], obj=object, which=which, type=type,
+                         test0=test0, level=level), silent=TRUE)
+        b <- coef(object)[which]
+        if (class(r) == "try-error")
+            c(NA,NA)
+        else
+            b*(1-r$root) + p[i,]*r$root        
+    }, mc.cores=cores))
+    do.call(rbind, res)
+}
+
 .invTest <- function(object, which, level = 0.95, fact = 3,
                      type=c("LR", "LM", "J"), corr=NULL, ...)
 {
@@ -23,26 +70,17 @@
     coef <- coef(object)[which]
     int1 <- c(coef, coef + fact*sdcoef)
     int2 <- c(coef - fact*sdcoef, coef)
-    if (length(coef(object)) == 2)
-    {
-        sd1 <- sqrt(v[-which])
-        coef1 <- coef(object)[-which]
-        rang <- c(coef1 - 2*fact*sd1, coef + 2*fact*sd1)
-    } else {
-        rang <- NULL
-    }
     fct <- function(coef, which, type, fit, level, test0, corr=NULL, rang)
     {
         spec <- modelDims(fit at model)
         ncoef <- spec$parNames[which]
         R <- paste(ncoef, "=", coef)
-        model <- restModel(fit at model, R)
-        if (length(coef(fit))==2)
+        if (fit at call[[1]] == "gel4")           
         {
-            tControl <- list(method="Brent", lower=rang[1], upper=rang[2])
-            fit2 <- suppressWarnings(update(fit, newModel=model, tControl=tControl,
+            fit2 <- suppressWarnings(update(fit, cstLHS=R,
                                             theta0=coef(fit)[-which]))
         } else {
+            model <- restModel(fit at model, R)
             fit2 <- suppressWarnings(update(fit, newModel=model,
                                             theta0=coef(fit)[-which]))
         }
@@ -53,10 +91,10 @@
             level - pchisq(test/corr, 1)
     }
     res1 <- try(uniroot(fct, int1, which = which, type=type, level=level,
-                        fit=object, test0=test0, corr=corr, rang=rang),
+                        fit=object, test0=test0, corr=corr),
                 silent=TRUE)
     res2 <- try(uniroot(fct, int2, which = which, type=type, level=level,
-                        fit=object, test0=test0, corr=corr, rang=rang),
+                        fit=object, test0=test0, corr=corr),
                 silent=TRUE)
     if (any(c(class(res1), class(res2)) == "try-error"))
     {
@@ -238,9 +276,12 @@
 setMethod("confint", "gelfit",
           function (object, parm, level = 0.95, lambda = FALSE,
                     type = c("Wald", "invLR", "invLM", "invJ"),
-                    fact = 3, corr = NULL, vcov=NULL, ...) 
+                    fact = 3, corr = NULL, vcov=NULL,
+                    area = FALSE, npoints = 20, cores = 4, ...) 
           {
               type <- match.arg(type)
+              if(.Platform$OS.type == "windows")
+                  cores <- 1L
               spec <- modelDims(object at model)
               n <- spec$n
               theta <- coef(object)
@@ -281,8 +322,8 @@
                   if (is.null(vcov))
                       v <-  vcov(object, ...)
                   return(getMethod("confint", "gmmfit")(object, parm, level,
-                      vcov=v$vcov_par))
-              } else {
+                      vcov=v$vcov_par, area=area, npoints=npoints))
+              } else {                  
                   if (missing(parm)) 
                       parm <- 1:length(theta)
                   ntheta <- spec$parNames
@@ -290,15 +331,24 @@
                       parm <- sort(unique(match(parm, ntheta)))
                   ntheta <- ntheta[parm]
                   type <- strsplit(type, "v")[[1]][2]
-                  ntest <- paste("Confidence interval based on the inversion of the ", 
-                                 type, " test", sep = "")
-                  ans <- lapply(parm, function(w)
-                      .invTest(object, w, level = level, 
-                               fact = fact, type = type, corr = corr, ...))
-                  ans <- do.call(rbind, ans)
-                  dimnames(ans) <- list(ntheta, c((1 - level)/2, 0.5 + level/2))
+                  if (!area)
+                  {
+                      ntest <- paste("Confidence interval based on the inversion of the ", 
+                                     type, " test", sep = "")
+                      ans <- lapply(parm, function(w)
+                          .invTest(object, w, level = level, 
+                                   fact = fact, type = type, corr = corr, ...))
+                      ans <- do.call(rbind, ans)
+                      dimnames(ans) <- list(ntheta, c((1 - level)/2, 0.5 + level/2))
+                  } else {
+                      ntest <-  paste(type, " type confidence region", sep="")
+                      ans <- .minvTest(object, parm, fact, npoints, level, type, cores)
+                  }
               }
-              new("confint", interval=ans, type=ntest, level=level)
+              if (!area)
+                  new("confint", interval=ans, type=ntest, level=level)
+              else
+                  new("mconfint", areaPoints=ans, type=ntest, level=level)
           })
 
 setMethod("confint", "numeric",
@@ -325,41 +375,14 @@
                   ans
               })
 
-
-.lineInterval <- function(obj, slope, which=1:2, ...)
-    {
-        if (length(which)!=2)
-            stop("You must select 2 coefficients")        
-        if (length(coef(obj))<2)
-            stop("You need at least two coefficients")
-        mu <- coef(obj)[which]
-        b <- mu[2]-slope*mu[1]
-        cst <- paste(names(mu)[2],"=",slope,"*",names(mu)[1],"+",b)
-        mod <- restModel(obj at model, cst)
-        
-        if (length(coef(obj)==2))
-            cont <- list(method="Brent", lower=mu[1]-1, upper=mu[1]+1)
-        else 
-            cont <- list()
-        fit <- modelFit(mod, tControl=cont)
-        ci <- confint(fit, names(mu)[1], ...)
-        low <- coef(mod, ci at interval[1,1])
-        up <- coef(mod, ci at interval[1,2])
-        ans <- rbind(low, up)
-        colnames(ans) <- names(mu)
-        rownames(ans) <- c("low","up")
-        ans
-    }
-
 setMethod("confint", "data.frame",
           function (object, parm, level = 0.95, gelType="EL", 
                     type = c("Wald", "invLR", "invLM", "invJ"),
-                    fact = 3, vcov="iid", n=10, cores=4, ...) 
+                    fact = 3, vcov="iid", npoints=10, cores=4, ...) 
               {
                   type <- match.arg(type)
                   if(.Platform$OS.type == "windows")
                       cores <- 1L
-                  n <- floor(n/2)
                   if (missing(parm))
                       parm <- 1
                   if (length(parm) == 1)
@@ -379,36 +402,20 @@
                   names(theta0) <- parNames
                   mod <- gelModel(g, gelType=gelType, vcov=vcov, data=object,
                                   theta0=theta0)
-                  fit <- modelFit(mod, ...)   
-                  mu <- coef(fit)
-                  c1 <- confint(fit,1:2,level, type=type, fact=fact)@interval
-                  delta <- seq(1,0,length.out=n+2)[-c(1,n+2)]
-                  p1 <- c(mu[1],c1[2,2])
-                  p2 <- c(c1[1,2], mu[2])
-                  p3 <- c(mu[1],c1[2,1])
-                  p4 <- c(c1[1,1],mu[2])
-                  slU <- sapply(delta, function(d) {
-                      p <- (p1*d + p2*(1-d))
-                      (p[2]-mu[2])/(p[1]-mu[1])})
-                  slD <- sapply(delta, function(d) {
-                      p <- (p2*d + p3*(1-d))
-                      (p[2]-mu[2])/(p[1]-mu[1])})                      
-                  slope <- c(slU, slD)
-                  resU <- mclapply(slU, function(s) .lineInterval(fit, s, ...),
-                                   mc.cores=cores)
-                  resD <- mclapply(slD, function(s) .lineInterval(fit, s, ...),
-                                   mc.cores=cores)
-                  Q1 <- cbind(p3, sapply(resU, function(l) l[1,]))
-                  Q2 <- cbind(p4, sapply(resD, function(l) l[1,]))
-                  Q3 <- cbind(p1, sapply(resU, function(l) l[2,]))
-                  Q4 <- cbind(p2, sapply(resD, function(l) l[2,]))
-                  ans <- rbind(t(Q1),t(Q2), t(Q3), t(Q4))
-                  colnames(ans) <- names(mu)
-                  rownames(ans) <- NULL
-                  type <- paste("2D ", type, " confidence region", sep="")
-                  new("mconfint", areaPoints=ans, type=type, level=level)
+                  fit <- modelFit(mod, ...)
+                  confint(fit, parm=1:2, level=level, lambda=FALSE,
+                          type=type, fact=fact, corr=NULL, vcov=NULL, area=TRUE,
+                          npoints=npoints, cores=cores)
               })
-                                                                    
+
+setMethod("confint", "matrix",
+          function(object, parm, level=0.95, ...)
+          {
+              object <- as.data.frame(object)
+              confint(object, parm, level, ...)
+          })
+                   
+
 setMethod("confint", "ANY",
           function (object, parm, level = 0.95, ...) 
           {
@@ -437,18 +444,29 @@
 setGeneric("plot")
 
 setMethod("plot", "mconfint", function(x, y, main=NULL, xlab=NULL, ylab=NULL, 
-                                       pch=21, bg=1, ...)
+                                       pch=21, bg=1, Pcol=1, ylim=NULL, xlim=NULL,
+                                       add=FALSE, ...)
 {
     v <- colnames(x at areaPoints)
-    if (is.null(main))
-        main <- paste(100*x at level, "% confidence region for ", v[1], " and ", v[2],
-                      sep="")
-    if (is.null(xlab))
-        xlab <- v[1]
-    if (is.null(ylab))
-        ylab <- v[2]
-    plot(x at areaPoints, xlab=xlab, ylab=ylab, main=main, pch=pch, bg=bg)
-    grid()
+    if (!add)
+        {
+            if (is.null(main))
+                main <- paste(100*x at level, "% confidence region for ", v[1], " and ", v[2],
+                              sep="")
+            if (is.null(xlab))
+                xlab <- v[1]
+            if (is.null(ylab))
+                ylab <- v[2]
+            if (is.null(ylim))
+                ylim <- range(x at areaPoints[,2])
+            if (is.null(xlim))
+                xlim <- range(x at areaPoints[,1])            
+            plot(x at areaPoints, xlab=xlab, ylab=ylab, main=main, pch=pch, bg=bg,
+                 ylim=ylim, xlim=xlim, col=Pcol)
+            grid()
+        } else {
+            points(x at areaPoints[,1],x at areaPoints[,2],pch=pch, bg=bg, col=Pcol)
+        }
     polygon(x at areaPoints[,1], x at areaPoints[,2], ...)
     invisible()
 })
@@ -540,16 +558,19 @@
               if (is.null(call <- getCall(object)))
                   stop("No call argument")
               arg <- list(...)
-              model <- if(is.null(newModel))
-                           object at model
-                       else
-                           newModel
-              model <- update(model, ...)
               ev <- new.env(parent.frame())
-              ev[["model"]] <- model
-              call[["object"]] <- quote(model)
-              arg <- arg[which(is.na(match(names(arg),
-                                           c("rhoFct", slotNames(model)))))]
+              if (object at call[[1]] != "gel4")
+              {
+                  model <- if(is.null(newModel))
+                               object at model
+                           else
+                               newModel
+                  model <- update(model, ...)
+                  ev[["model"]] <- model
+                  call[["object"]] <- quote(model)
+                  arg <- arg[which(is.na(match(names(arg),
+                                               c("rhoFct", slotNames(model)))))]
+              }
               if (length(arg) > 0) 
                   for (n in names(arg)) call[[n]] <- arg[[n]]
               if (evaluate)

Modified: pkg/gmm4/R/gmmfit-methods.R
===================================================================
--- pkg/gmm4/R/gmmfit-methods.R	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/R/gmmfit-methods.R	2019-11-19 20:10:23 UTC (rev 154)
@@ -203,28 +203,44 @@
 ## confint
 
 setGeneric("confint")
-setMethod("confint", "gmmfit",
-          function(object, parm, level = 0.95, vcov=NULL, ...)
+
+setMethod("confint","gmmfit", 
+          function (object, parm, level = 0.95, vcov=NULL, area=FALSE,
+                    npoints=50, ...) 
           {
-              ntest <- "Wald type confidence interval"
-              if (is.null(vcov))
+              if (is.null(vcov)) 
                   vcov <- vcov(object, ...)
-              se <- sqrt(diag(vcov))
               theta <- coef(object)
-              if (missing(parm))
+              if (missing(parm)) 
                   parm <- 1:length(theta)
-              if (is.character(parm))
+              if (is.character(parm)) 
                   parm <- sort(unique(match(parm, names(theta))))
+              if (area)
+              {
+                  if (length(parm) != 2)
+                      stop("For confidence region, length(parm) must be 2")
+                  ntest <- "Wald type confidence region"
+                  r <- sqrt(qchisq(level, 2))
+                  v <- chol(vcov[parm,parm])
+                  ang <- seq(0, 2*pi, length.out=npoints)
+                  c1  <- rbind(r*cos(ang), r*sin(ang))
+                  p2 <- t(crossprod(v,c1) + theta[parm])
+                  colnames(p2) <- names(theta)[parm]
+                  rownames(p2) <- NULL
+                  obj <- new("mconfint", areaPoints=p2, type=ntest, level=level)
+                  return(obj)
+              }                  
+              se <- sqrt(diag(vcov)[parm])
+              ntest <- "Wald type confidence interval"
               theta <- theta[parm]
-              se <- se[parm]
-              zs <- qnorm((1 - level)/2, lower.tail = FALSE)              
+              zs <- qnorm((1 - level)/2, lower.tail = FALSE)
               ch <- zs * se
-              ans <- cbind(theta - ch, theta + ch)              
-              dimnames(ans) <- list(names(theta), c((1 - level)/2, 0.5 + level/2))
-              new("confint", interval=ans, type=ntest, level=level)
-              })
+              ans <- cbind(theta - ch, theta + ch)
+              dimnames(ans) <- list(names(theta), c((1 - level)/2, 
+                                                    0.5 + level/2))
+              new("confint", interval = ans, type = ntest, level = level)
+          })
 
-
 ## Its print method
 
 setMethod("print", "confint",

Modified: pkg/gmm4/man/confint-methods.Rd
===================================================================
--- pkg/gmm4/man/confint-methods.Rd	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/man/confint-methods.Rd	2019-11-19 20:10:23 UTC (rev 154)
@@ -6,6 +6,7 @@
 \alias{confint,gmmfit-method}
 \alias{confint,numeric-method}
 \alias{confint,data.frame-method}
+\alias{confint,matrix-method}
 \alias{confint,ANY-method}
 \title{ ~~ Methods for Function \code{confint} in Package \pkg{stats} ~~}
 \description{
@@ -14,17 +15,25 @@
 }
 
 \usage{
-\S4method{confint}{gmmfit}(object, parm, level = 0.95, vcov=NULL, \dots)
+\S4method{confint}{gmmfit}(object, parm, level = 0.95, vcov=NULL,
+                    area=FALSE, npoints=50, \dots)
 
 \S4method{confint}{gelfit}(object, parm, level = 0.95, lambda = FALSE,
                     type = c("Wald", "invLR", "invLM", "invJ"),
-                    fact = 3, corr = NULL, vcov=NULL, \dots)
+                    fact = 3, corr = NULL, vcov=NULL,
+                    area = FALSE, npoints = 20, cores=4, \dots)
 
+\S4method{confint}{numeric}(object, parm, level = 0.95, gelType="EL", 
+                    type = c("Wald", "invLR", "invLM", "invJ"),
+                    fact = 3, vcov="iid", ...) 
+
 \S4method{confint}{data.frame}(object, parm, level = 0.95, gelType="EL", 
                     type = c("Wald", "invLR", "invLM", "invJ"),
-                    fact = 3, vcov="iid", n=10, 
+                    fact = 3, vcov="iid", npoints=10, 
                     cores=4, \dots) 
 
+\S4method{confint}{matrix}(object, parm, level = 0.95, \dots) 
+
 \S4method{confint}{ANY}(object, parm, level = 0.95, \dots)
 }
 
@@ -52,7 +61,8 @@
   \item{corr}{Correction to apply to the specification tests}
   
   \item{vcov}{For Wald intervals, an optional covariance matrix can be
-    provided}
+    provided. For \code{"numeric"} or \code{"data.frame"}, it specifies
+    the type of observations.}
 
   \item{cores}{The number of cores for \code{\link{mclapply}}. It is set
     to 1 for Windows OS.}
@@ -59,8 +69,12 @@
 
   \item{gelType}{Type of GEL confidence interval.}
 
-  \item{n}{Number of lines to construct the confidence region.}
+  \item{npoints}{Number of equally spaced points for the confidence
+    region}
 
+  \item{area}{If TRUE, a cnnfidence region is computed. The length of
+  \code{"parm"} must be 2 in that case.}
+
   \item{\dots}{Other arguments to pass to \code{\link{modelFit}}}
 }
 
@@ -86,11 +100,12 @@
 \item{\code{signature(object = "data.frame")}}{
   It computes the 2D GEL confidence region for the means of two
   variables.
-  
 }
 
+\item{\code{signature(object = "matrix")}}{
+  It converts the object into a data.frame and call its method.
+}
 
-
 }}
 \keyword{methods}
 \keyword{Confidence Intervals}

Modified: pkg/gmm4/man/plot-methods.Rd
===================================================================
--- pkg/gmm4/man/plot-methods.Rd	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/man/plot-methods.Rd	2019-11-19 20:10:23 UTC (rev 154)
@@ -12,7 +12,8 @@
 \S4method{plot}{ANY}(x, y, ...) 
 
 \S4method{plot}{mconfint}(x, y, main=NULL, xlab=NULL, ylab=NULL, 
-                          pch=21, bg=1, \dots)
+                          pch=21, bg=1, Pcol=1, ylim=NULL, xlim=NULL,
+                          add=FALSE, \dots)
 }
 
 \arguments{
@@ -30,6 +31,15 @@
 
   \item{bg}{Background color for points.}
 
+  \item{Pcol}{The color for the points. If col is used, it is passed to
+    \code{\link{polygon}}}
+
+  \item{xlim}{Optional range for the x-axis.}
+ 
+  \item{ylim}{Optional range for the y-axis.}
+
+  \item{add}{If TRUE, the region is added to an existing plot.}
+
   \item{\dots}{Arguments to pass to \code{\link{polygon}}}
   }
 

Modified: pkg/gmm4/vignettes/gelS4.Rnw
===================================================================
--- pkg/gmm4/vignettes/gelS4.Rnw	2019-11-15 22:49:10 UTC (rev 153)
+++ pkg/gmm4/vignettes/gelS4.Rnw	2019-11-19 20:10:23 UTC (rev 154)
@@ -1096,7 +1096,7 @@
 Which can also be done using the method for ``data.frame'':
 
 <<>>=
-confint(simData, "x2", gelType="EL")
+confint(simData, "x2", gelType="EL", npoints=20)
 @ 
 
 The arguments ``level'', ``fact'' and ``type'' are as for the method
@@ -1107,17 +1107,15 @@
 for weakly dependent processes.  
 
 For ``data.frame'' and two variables, an object of class ``mconfint''
-is created. The argument ``n'' is the number of lines to use to
-construct the region. The number of equally spaced points around the
-region is $2(n+2)$ because a vertical and horizontal lines are
-added. The arguments ``cores'' is for the number of cores to use with
-mclapply(). For Windows operating systems, it is set to 1. The
-following shows how to use the \textit{print} and \textit{plot}
-methods for that class. In the following, the Wald region is computed
-instead, to avoid having a vignette that takes to much time to compile.
+is created. The argument ``npoints'' is the number of points to use to
+construct the region. The arguments ``cores'' is for the number of
+cores to use with mclapply(). For Windows operating systems, it is set
+to 1. The following shows how to use the \textit{print} and
+\textit{plot} methods for that class. Here is an example which
+compares Wald and LR confidence regions.
 
 <<>>=
-res <- confint(simData, c("x2","y"))
+res <- confint(simData, c("x2","y"), npoints=20)
 res
 @ 
 
@@ -1124,14 +1122,22 @@
 \begin{center}
 \begin{minipage}{.7\textwidth}
 <<fig.height=5>>=
-plot(res, pch=20, bg=2, col=rainbow(7, alpha=.3)[3])
+res2 <- confint(simData, c("x2","y"), type="invLR", npoints=20)
+c1 <- col2rgb("darkorange2")/255
+c1 <- rgb(c1[1],c1[2],c1[3],.5)
+c2 <- col2rgb("lightblue2")/255
+c2 <- rgb(c2[1],c2[2],c2[3],.5)
+plot(res, pch=20, bg=c1, Pcol=c1, col=c1, ylim=c(3.5,6.5),
+     xlim=c(4.8,7.5))
+plot(res2, pch=20, bg=c2, Pcol=c2, col=c2, add=TRUE)
+legend("topright", c("Wald","LR"), col=c(c1,c2), pch=20 , bty="n")
 @ 
 \end{minipage}
 \end{center}
 
-The arguments ``main'', ``xlab'' ``ylab'', ``pch'' and ``bg'' are
-passed to plot.default(), and all other arguments are passed to
-polygon().
+The arguments ``main'', ``xlab'' ``ylab'', ``pch'', ``ylim'',
+``xlim'', ``Pcol'' (the color of the points) and ``bg'' are passed to
+plot.default(), and all other arguments are passed to polygon().
 
 \bibliography{empir}
 \pagebreak

Modified: pkg/gmm4/vignettes/gelS4.pdf
===================================================================
(Binary files differ)

Modified: pkg/gmm4/vignettes/gmmS4.pdf
===================================================================
(Binary files differ)



More information about the Gmm-commits mailing list