[r-cran-erm] 07/33: Import Debian patch 0.12-0-6
Andreas Tille
tille at debian.org
Mon Dec 12 11:19:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-erm.
commit c6f5406ee7d730769ea1f0848d720f04219448e6
Author: Julian Gilbey <jdg at debian.org>
Date: Tue Jun 1 11:35:33 2010 +0100
Import Debian patch 0.12-0-6
---
debian/README.Debian | 11 ++
debian/changelog | 11 ++
debian/patches/04_PathwayMap | 403 +++++++++++++++++++++++++------------------
3 files changed, 260 insertions(+), 165 deletions(-)
diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..2c62d96
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,11 @@
+README for Debian package r-cran-erm
+------------------------------------
+
+This version of the eRm package currently differs from upstream in
+having a few enhancements and bug-fixes to some of the plotting
+routines, and more significantly, the introduction of a new plotting
+function, plotPWMap, which plots Bond & Fox pathway maps. These have
+been offered to the upstream developers and are expected to appear in
+the next major release of the eRm package.
+
+ -- Julian Gilbey <jdg at debian.org>, Tue, 1 Jun 2010 11:49:31 +0100
diff --git a/debian/changelog b/debian/changelog
index de2c38c..7cf3dd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+erm (0.12-0-6) unstable; urgency=low
+
+ * Fix showstopping-bug in plotPathwayMap which broke the code if there
+ were any NA values in the data
+ * Rename plotPathwayMap to plotPWMap, following upstream's request
+ * plotPWMap enhancements requested by upstream: Offer options for colour
+ and size of confidence intervals allow plotting both persons and items
+ on same plot; allow not plotting confidence intervals;
+
+ -- Julian Gilbey <jdg at debian.org> Tue, 01 Jun 2010 11:35:33 +0100
+
erm (0.12-0-5) unstable; urgency=low
* Fixed incorrect Build-Depends; hopefully this will work, but can't be
diff --git a/debian/patches/04_PathwayMap b/debian/patches/04_PathwayMap
index 71c8d47..661286e 100644
--- a/debian/patches/04_PathwayMap
+++ b/debian/patches/04_PathwayMap
@@ -124,196 +124,244 @@ Last-Update: 2010-05-16
export(plotICC)
export(plotjointICC)
export(plotPImap)
-+export(plotPathwayMap)
++export(plotPWMap)
export(pmat)
export(Waldtest)
export(IC)
--- /dev/null
-+++ b/R/plotPathwayMap.R
-@@ -0,0 +1,180 @@
-+`plotPathwayMap` <-
-+function(object, pmap=FALSE, item.subset="all", person.subset="all",
++++ b/R/plotPWMap.R
+@@ -0,0 +1,228 @@
++`plotPWMap` <-
++function(object, pmap=FALSE, imap=TRUE, item.subset="all", person.subset="all",
+ mainitem="Item Map", mainperson="Person Map",
-+ latdim="Latent Dimension",
-+ tlab="Infit t statistic", pp=NULL, cex.gen=0.6)
++ mainboth="Item/Person Map", latdim="Latent Dimension",
++ tlab="Infit t statistic", pp=NULL, cex.gen=0.6,
++ person.pch=22, item.pch=23, personCI=NULL, itemCI=NULL)
+{
-+ def.par <- par(no.readonly = TRUE) # save default, for resetting...
++ def.par <- par(no.readonly = TRUE) ## save default, for resetting...
+
-+# Pathway map currently only for RM, PCM and RSM
++ ## Pathway map currently only for RM, PCM and RSM
+
-+ # The next part of the code finds locations and standard errors for
-+ # the item thresholds
-+ if ((object$model == "LLTM") || (object$model == "LRSM") || (object$model == "LPCM"))
-+ stop("Pathway Map can only be computed for RM, RSM, and PCM!")
++ ## The next part of the code finds locations and standard errors for
++ ## the item thresholds
++ if ((object$model == "LLTM") || (object$model == "LRSM") || (object$model == "LPCM"))
++ stop("Pathway Map can only be computed for RM, RSM, and PCM!")
+
-+# compute threshtable (from betapars for dichotomous models) and item names
-+ if (object$model == "RM" || max(object$X) < 2 ) { # dichotomous model
-+ dRm <- TRUE
++ if (!pmap && !imap)
++ stop("Pathway Map requires you to request at least one map (item or person)!")
+
-+ # betapars are easiness parameters; only the pars need negating
-+ threshtable<-cbind(object$betapar * -1, object$se.beta)
-+ rownames(threshtable) <- colnames(object$X)
++ ## compute threshtable (from betapars for dichotomous models) and item names
++ if (object$model == "RM" || max(object$X, na.rm=TRUE) < 2 ) { # dichotomous model
++ dRm <- TRUE
+
-+ # shorter synonym
-+ tt<-threshtable
-+ } else { # polytomous model
-+ dRm <- FALSE
++ ## betapars are easiness parameters; only the pars need negating
++ threshtable<-cbind(object$betapar * -1, object$se.beta)
++ rownames(threshtable) <- colnames(object$X)
+
-+ thresh <- thresholds(object)
-+ threshtable <- cbind(thresh$threshpar, thresh$se.thresh)
-+ tlevels<-apply(thresh$threshtable[[1]], 1,
-+ function(x) length(na.exclude(x))) - 1
-+ if (!(sum(tlevels)==nrow(threshtable)))
-+ stop("Threshtable rows not equal to number of thresholds - oops!")
++ ## shorter synonym
++ tt<-threshtable
++ } else { ## polytomous model
++ dRm <- FALSE
+
-+ ttl<-NULL # threshtable labels
-+ for (i in rownames(as.matrix(tlevels)))
-+ if (tlevels[i]==1)
-+ ttl<-c(ttl,i)
-+ else
-+ ttl<-c(ttl,paste(i,1:tlevels[i],sep=":"))
-+ rownames(threshtable)<-ttl
++ thresh <- thresholds(object)
++ threshtable <- cbind(thresh$threshpar, thresh$se.thresh)
++ tlevels<-apply(thresh$threshtable[[1]], 1,
++ function(x) length(na.exclude(x))) - 1
++ if (!(sum(tlevels)==nrow(threshtable)))
++ stop("Threshtable rows not equal to number of thresholds - oops!")
+
-+ # shorter synonyms
-+ tt<-threshtable
-+ tl<-tlevels
-+ }
++ ttl<-NULL ## threshtable labels
++ for (i in rownames(as.matrix(tlevels)))
++ if (tlevels[i]==1)
++ ttl<-c(ttl,i)
++ else
++ ttl<-c(ttl,paste(i,1:tlevels[i],sep=":"))
++ rownames(threshtable)<-ttl
++
++ ## shorter synonyms
++ tt<-threshtable
++ tl<-tlevels
++ }
+
-+ # Item subsetting is pretty ugly as there are multiple cases.
-+ if (!pmap && is.character(item.subset)) {
-+ # Case 1: item subsetting by item names
-+ if (dRm) {
-+ if (length(item.subset)>1 && all(item.subset %in% rownames(tt)))
-+ tt<-tt[item.subset,]
-+ else if(length(item.subset)!=1 || !(item.subset=="all"))
-+ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
-+ } else {
-+ if (length(item.subset)>1 && all(item.subset %in% rownames(as.matrix(tl)))) {
-+ keep.subset<-NULL
-+ tl<-tl[item.subset]
-+ for (i in rownames(as.matrix(tl)))
-+ if (tl[i]==1)
-+ keep.subset<-c(keep.subset,i)
-+ else
-+ keep.subset<-c(keep.subset,paste(i,1:tl[i],sep=":"))
-+ tt<-tt[keep.subset,]
-+ }
-+ else if(length(item.subset)!=1 || !(item.subset=="all"))
-+ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
++ ## Item subsetting is pretty ugly as there are multiple cases.
++ if (imap && is.character(item.subset)) {
++ ## Case 1: item subsetting by item names
++ if (dRm) {
++ if (length(item.subset)>1 && all(item.subset %in% rownames(tt)))
++ tt<-tt[item.subset,]
++ else if(length(item.subset)!=1 || !(item.subset=="all"))
++ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
++ } else {
++ if (length(item.subset)>1 && all(item.subset %in% rownames(as.matrix(tl)))) {
++ keep.subset<-NULL
++ tl<-tl[item.subset]
++ for (i in rownames(as.matrix(tl)))
++ if (tl[i]==1)
++ keep.subset<-c(keep.subset,i)
++ else
++ keep.subset<-c(keep.subset,paste(i,1:tl[i],sep=":"))
++ tt<-tt[keep.subset,]
+ }
-+ } else if (!pmap) {
-+ # Case 2: item subsetting by item numbers
-+ if (dRM) {
-+ if (length(item.subset)>1 && all(item.subset %in% 1:nrow(tt)))
-+ tt<-tt[item.subset,]
-+ else
-+ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
-+ }
-+ else {
-+ if (length(item.subset)>1 && all(item.subset %in% 1:length(tl))) {
-+ tl<-tl[item.subset]
-+ for (i in rownames(as.matrix(tl)))
-+ if (tl[i]==1)
-+ keep.subset<-c(keep.subset,i)
-+ else
-+ keep.subset<-c(keep.subset,paste(i,1:tl[i],sep=":"))
-+ tt<-tt[keep.subset,]
-+ }
-+ else
-+ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
++ else if(length(item.subset)!=1 || !(item.subset=="all"))
++ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
++ }
++ } else if (imap) {
++ ## Case 2: item subsetting by item numbers
++ if (dRM) {
++ if (length(item.subset)>1 && all(item.subset %in% 1:nrow(tt)))
++ tt<-tt[item.subset,]
++ else
++ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
++ }
++ else {
++ if (length(item.subset)>1 && all(item.subset %in% 1:length(tl))) {
++ tl<-tl[item.subset]
++ for (i in rownames(as.matrix(tl)))
++ if (tl[i]==1)
++ keep.subset<-c(keep.subset,i)
++ else
++ keep.subset<-c(keep.subset,paste(i,1:tl[i],sep=":"))
++ tt<-tt[keep.subset,]
+ }
++ else
++ stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
+ }
++ }
+
-+ # We have to postpone the person subsetting code until after we have
-+ # done the person plot calculations
++ ## We have to postpone the person subsetting code until after we have
++ ## done the person plot calculations
+
-+ if (is.null(pp))
-+ suppressWarnings(pp<-person.parameter(object))
-+ else if (class(pp) != "ppar" || !identical(pp$X,object$X))
-+ stop("pp is not a person.parameter object which matches the main Rasch data object!")
++ if (is.null(pp))
++ suppressWarnings(pp<-person.parameter(object))
++ else if (class(pp) != "ppar" || !identical(pp$X,object$X))
++ stop("pp is not a person.parameter object which matches the main Rasch data object!")
+
-+ # We plot the infit data versus the parameters for both items and persons
-+ iloc<-tt[,1]
-+ ise<-tt[,2]
-+ ifit <- itemfit(pp)
-+ ifitZ <- ifit$i.infitZ
++ ## We plot the infit data versus the parameters for both items and persons
++ iloc<-tt[,1]
++ ise<-tt[,2]
++ ifit <- itemfit(pp)
++ ifitZ <- ifit$i.infitZ
+
-+ ploc <- as.matrix(pp$theta.table['Person Parameter'])
-+ pse <- as.matrix(pp$se.theta[[1]])
-+ pfit <- personfit(pp)
-+ pfitZ <- pfit$p.infitZ
++ ploc <- as.matrix(pp$theta.table['Person Parameter'])
++ pse <- unlist(pp$se.theta, recursive=FALSE)
++ names(pse) <- sub("^NAgroup[0-9]*\\.","",names(pse))
++ pse <- as.matrix(pse)
++ pfit <- personfit(pp)
++ pfitZ <- pfit$p.infitZ
+
-+ # We can now do person subsetting; this is significantly easier than
-+ # item subsetting, as there is no dRM/eRm distinction.
-+ if (pmap && is.character(person.subset)) {
-+ # Case 1: person subsetting by person names
-+ if (length(person.subset)>1 && all(person.subset %in% rownames(ploc))) {
-+ ploc<-ploc[person.subset,]
-+ pse<-pse[person.subset,]
-+ pfitZ<-pfitZ[person.subset]
-+ }
-+ else if(length(person.subset)!=1 || !(person.subset=="all"))
-+ stop("person.subset misspecified. Use 'all' or vector of at least two valid person indices/names.")
-+ } else if (pmap) {
-+ # Case 2: person subsetting by person numbers
-+ if (length(person.subset)>1 && all(person.subset %in% 1:nrow(ploc))) {
-+ ploc<-ploc[person.subset,]
-+ pse<-pse[person.subset,]
-+ pfitZ<-pfitZ[person.subset]
-+ }
-+ else
-+ stop("person.subset misspecified. Use 'all' or vector of at least two valid person indices/names.")
++ ## We can now do person subsetting; this is significantly easier than
++ ## item subsetting, as there is no dRM/eRm distinction.
++ if (pmap && is.character(person.subset)) {
++ ## Case 1: person subsetting by person names
++ if (length(person.subset)>1 && all(person.subset %in% rownames(ploc))) {
++ ploc<-ploc[person.subset,]
++ pse<-pse[person.subset,]
++ pfitZ<-pfitZ[person.subset]
++ }
++ else if(length(person.subset)!=1 || !(person.subset=="all"))
++ stop("person.subset misspecified. Use 'all' or vector of at least two valid person indices/names.")
++ } else if (pmap) {
++ ## Case 2: person subsetting by person numbers
++ if (length(person.subset)>1 && all(person.subset %in% 1:nrow(ploc))) {
++ ploc<-ploc[person.subset,]
++ pse<-pse[person.subset,]
++ pfitZ<-pfitZ[person.subset]
+ }
++ else
++ stop("person.subset misspecified. Use 'all' or vector of at least two valid person indices/names.")
++ }
++
++ ## Confidence intervals for persons and items
++ ##
++ ## Need defaults for multiple of standard error for purpose of range
++ ## calculation; these are zero as default is not to draw confidence
++ ## intervals
++ pci=0
++ ici=0
+
-+ # Now we can plot the Pathway Map
++ ## Our calculation is simplistic; we use the normal distribution to
++ ## estimate our confidence interval from our standard error. However,
++ ## since this is likely to only be approximate and indicative anyway, we
++ ## are not concerned by this.
++ if(pmap && !is.null(personCI)) {
++ if(is.null(personCI$clevel)) personCI$clevel <- 0.95
++ if(is.null(personCI$col)) personCI$col <- "orange"
++ if(is.null(personCI$lty)) personCI$lty <- "dotted"
++ pci <- qnorm((1-personCI$clevel)/2, lower.tail=FALSE)
++ }
++ if(imap && !is.null(itemCI)) {
++ if(is.null(itemCI$clevel)) itemCI$clevel <- 0.95
++ if(is.null(itemCI$col)) itemCI$col <- "red"
++ if(is.null(itemCI$lty)) itemCI$lty <- "dotted"
++ ici <- qnorm((1-itemCI$clevel)/2, lower.tail=FALSE)
++ }
++
++ ## Now we can plot the Pathway Map
+
-+ if (pmap) { # person map
-+ xrange <- range(pfitZ,na.rm=TRUE)
-+ xrange[1] <- min(-2.5,xrange[1])
-+ xrange[2] <- max(2.5,xrange[2]+1) # need space for labels
-+ yrange<-range(ploc,na.rm=TRUE)
-+ yrange[1]<-yrange[1]-max(pse)
-+ yrange[2]<-yrange[2]+max(pse)
-+ maintitle = mainperson
-+ } else { # item map
-+ xrange <- range(ifitZ,na.rm=TRUE)
-+ xrange[1] <- min(-2.5,xrange[1])
-+ xrange[2] <- max(2.5,xrange[2]+1) # need space for labels
-+ yrange<-range(iloc,na.rm=TRUE)
-+ yrange[1]<-yrange[1]-max(ise)
-+ yrange[2]<-yrange[2]+max(ise)
-+ maintitle = mainitem
-+ }
++ if (pmap) { ## person map
++ xrange.pmap <- range(pfitZ,na.rm=TRUE)
++ xrange.pmap[1] <- min(-2.5,xrange.pmap[1])
++ xrange.pmap[2] <- max(2.5,xrange.pmap[2]+1) ## need space for labels
++ yrange.pmap<-range(ploc,na.rm=TRUE)
++ yrange.pmap[1]<-yrange.pmap[1]-pci*max(pse)
++ yrange.pmap[2]<-yrange.pmap[2]+pci*max(pse)
++ }
++ if (imap) { ## item map
++ xrange.imap <- range(ifitZ,na.rm=TRUE)
++ xrange.imap[1] <- min(-2.5,xrange.imap[1])
++ xrange.imap[2] <- max(2.5,xrange.imap[2]+1) ## need space for labels
++ yrange.imap<-range(iloc,na.rm=TRUE)
++ yrange.imap[1]<-yrange.imap[1]-ici*max(ise)
++ yrange.imap[2]<-yrange.imap[2]+ici*max(ise)
++ }
+
-+ par(mar=c(5,4,4,2))
-+ plot(xrange,yrange, xlim=xrange, ylim=yrange, main=maintitle,
-+ ylab=latdim, xlab=tlab, type="n")
-+ abline(v=c(-2,2),col="lightgreen")
++ if (pmap && !imap) {
++ xrange = xrange.pmap
++ yrange = yrange.pmap
++ maintitle = mainperson
++ } else if (!pmap && imap) {
++ xrange = xrange.imap
++ yrange = yrange.imap
++ maintitle = mainitem
++ } else {
++ xrange[1] <- min(xrange.pmap[1], xrange.imap[1])
++ xrange[2] <- max(xrange.pmap[2], xrange.imap[2])
++ yrange[1] <- min(yrange.pmap[1], yrange.imap[1])
++ yrange[2] <- max(yrange.pmap[2], yrange.imap[2])
++ maintitle = mainboth
++ }
++
++ par(mar=c(5,4,4,2))
++ plot(xrange,yrange, xlim=xrange, ylim=yrange, main=maintitle,
++ ylab=latdim, xlab=tlab, type="n")
++ abline(v=c(-2,2),col="lightgreen")
+
-+ if (pmap) { # person map
-+ zt <- pfitZ
-+ arrows(zt,ploc+pse, zt,ploc-pse, angle=90, code=3, length=0.04,
-+ col="orange")
-+ points(zt,ploc,pch=20,cex=0.6)
-+ text(zt,ploc,rownames(ploc),cex=cex.gen,pos=4)
-+ } else { # item map
-+ if (dRm)
-+ zt <- ifitZ
-+ else
-+ zt <- rep(ifitZ,times=tl)
++ if (pmap) { ## person map
++ zt <- pfitZ
++ if (pci>0) ## draw confidence intervals
++ arrows(zt,ploc+pci*pse, zt,ploc-pci*pse, angle=90, code=3, length=0.04,
++ col=personCI$col, lty=personCI$lty)
++ points(zt,ploc,pch=person.pch,cex=0.6)
++ text(zt,ploc,rownames(ploc),cex=cex.gen,pos=4)
++ }
++ if (imap) { ## item map
++ if (dRm)
++ zt <- ifitZ
++ else
++ zt <- rep(ifitZ,times=tl)
+
-+ arrows(zt,iloc+ise, zt,iloc-ise, angle=90, code=3, length=0.04,
-+ col="orange")
-+ points(zt,iloc,pch=20,cex=0.6)
-+ text(zt,iloc,rownames(tt),cex=cex.gen,pos=4)
-+ }
++ if (ici>0) ## draw confidence intervals
++ arrows(zt,iloc+ici*ise, zt,iloc-ici*ise, angle=90, code=3, length=0.04,
++ col=itemCI$col, lty=itemCI$lty)
++ points(zt,iloc,pch=item.pch,cex=0.6)
++ text(zt,iloc,rownames(tt),cex=cex.gen,pos=4)
++ }
+
-+ par(def.par)
++ par(def.par)
+}
-+
--- /dev/null
-+++ b/man/plotPathwayMap.Rd
-@@ -0,0 +1,80 @@
++++ b/man/plotPWMap.Rd
+@@ -0,0 +1,105 @@
+\name{plotPathwayMap}
+\alias{plotPathwayMap}
+\title{Pathway Map}
@@ -325,17 +373,22 @@ Last-Update: 2010-05-16
+ -2 and +2, and these values are marked.
+}
+\usage{
-+plotPathwayMap(object, pmap = FALSE,
++plotPathwayMap(object, pmap = FALSE, imap=TRUE,
+ item.subset = "all", person.subset = "all",
+ mainitem = "Item Map", mainperson = "Person Map",
+ latdim = "Latent Dimension",
+ tlab = "Infit t statistic",
-+ pp = NULL, cex.gen = 0.6)
++ pp = NULL, cex.gen = 0.6,
++ person.pch = 22, item.pcm = 23,
++ personCI = NULL, itemCI = NULL)
+}
+\arguments{
+ \item{object}{Object of class \code{Rm} or \code{dRm}}
-+ \item{pmap}{If \code{FALSE} (the default), plot an item map; if
-+ \code{TRUE}, plot a person map.}
++ \item{pmap}{Plot a person map if \code{TRUE}; the default is
++ \code{FALSE}.}
++ \item{imap}{Plot an item map if \code{TRUE} (the default); do not plot
++ if \code{FALSE}. At least one of \code{pmap} and \code{imap} must
++ be \code{TRUE}.}
+ \item{item.subset}{Subset of items to be plotted for an item map.
+ Either a numeric vector indicating the item numbers or a character
+ vector indicating the item names. If \code{"all"}, all items are
@@ -346,6 +399,7 @@ Last-Update: 2010-05-16
+ plotted. The number of persons to be plotted must be > 1.}
+ \item{mainitem}{Main title of an item plot.}
+ \item{mainperson}{Main title of a person plot.}
++ \item{mainboth}{Main title of a person/item joint plot.}
+ \item{latdim}{Label of the y-axis, i.e., the latent dimension.}
+ \item{tlab}{Label of the x-axis, i.e., the t-statistic dimension.}
+ \item{pp}{If non-\code{NULL}, this contains the
@@ -356,12 +410,31 @@ Last-Update: 2010-05-16
+ text and symbols should be magnified relative to the
+ default. Here \code{cex.gen} applies to all text labels. The
+ default is 0.6.}
++ \item{person.pch, item.pch}{Specifies the symbol used for plotting
++ person data and item data respectively; the defaults are 22 and 23
++ respectively. See \code{\link{points}} for more information
++ about \code{pch} values.}
++ \item{personCI, itemCI}{Plotting confidence intervals for the the
++ person abilities and item difficulties. If \code{personCI=NULL}
++ (the default) no confidence intervals are drawn for person
++ abilities. Otherwise, specifying \code{personCI} draws
++ approximate confidence intervals for each person's ability.
++ \code{personCI} must be specified as a list, and the optional
++ elements of this list are \code{gamma}, the confidence level,
++ \code{col}, colour, and \code{lty}, line type. If \code{personCI}
++ is specified as an empty list, or not all of the list items are
++ specified, the default values
++ \code{personCI=list(gamma=0.95,col="orange",lty="dotted")} will be
++ used.
++
++ The same goes for \code{itemCI}, except that the default settings
++ are \code{itemCI=list(gamma=0.95,col="red",lty="dotted")}.}
+}
+\details{
+ This code uses vertical error bars rather than circles or boxes to
-+ indicate standard errors. It also only allows the plotting of either
-+ item or person data, but not both on the same map; this considerably
-+ simplifies the reading of the plots for large datasets.
++ indicate standard errors. It also offers the possibility of plotting
++ item or person data on it own; this can considerably simplify the
++ reading of the plots for large datasets.
+}
+%\value{}
+\references{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-erm.git
More information about the debian-science-commits
mailing list