[r-cran-erm] 01/33: Import Debian patch 0.12-0-1

Andreas Tille tille at debian.org
Mon Dec 12 11:19:32 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 6fa3be10f8212fbc2c7461c44e1b34ff3a99ddbb
Author: Julian Gilbey <jdg at debian.org>
Date:   Sun May 16 17:13:21 2010 +0100

    Import Debian patch 0.12-0-1
---
 debian/changelog                            |  10 +
 debian/compat                               |   1 +
 debian/control                              |  24 ++
 debian/copyright                            |  17 ++
 debian/overrides                            |   1 +
 debian/patches/01_plotPImap-fix-item-subset |  32 +++
 debian/patches/02_plotPImap-pp-reuse        |  49 ++++
 debian/patches/03_plotPImap-prettify        |  72 +++++
 debian/patches/04_PathwayMap                | 393 ++++++++++++++++++++++++++++
 debian/patches/series                       |   4 +
 debian/rules                                |   8 +
 debian/source/format                        |   1 +
 debian/watch                                |   2 +
 13 files changed, 614 insertions(+)

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..5b4cabf
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,10 @@
+erm (0.12-0-1) unstable; urgency=low
+
+  * Initial Debian release (Closes: #544402)
+  * Fixed subsetting bugs in plotPImap code, and allowed reuse of
+    person.parameter calculations
+  * Added Infit and Outfit t statistics, as per Rating Scale Analysis by
+    Wright and Masters
+  * Added ability to plot (slightly modified) Bond-and-Fox Pathway Maps
+
+ -- Julian Gilbey <jdg at debian.org>  Sun, 16 May 2010 17:13:21 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..0a1721f
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,24 @@
+Source: erm
+Section: gnu-r
+Priority: optional
+Maintainer: Julian Gilbey <jdg at debian.org>
+Build-Depends: debhelper (>> 7), r-base-dev (>= 2.9.0-4), cdbs, r-cran-rocr,
+ r-cran-raschsampler
+Standards-Version: 3.8.4
+Homepage: http://cran.r-project.org/web/packages/eRm/index.html
+
+Package: r-cran-erm
+Architecture: any
+Depends: r-base-core (>= 2.8.1), r-cran-gtools, r-cran-rocr,
+ r-cran-raschsampler, ${shlibs:Depends}, ${misc:Depends}
+Description: GNU R package for 'extended Rasch modelling'
+ eRm fits Rasch models (RM), linear logistic test models (LLTM),
+ rating scale model (RSM), linear rating scale models (LRSM), partial
+ credit models (PCM), and linear partial credit models (LPCM). Missing
+ values are allowed in the data matrix. Additional features are the ML
+ estimation of the person parameters, Andersen's LR-test,
+ item-specific Wald test, itemfit and personfit statistics including
+ infit and outfit measures, various ICC and related plots, automated
+ stepwise item elimination, simulation module for various binary data
+ matrices. An eRm platform is provided at R-forge (see URL).
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e466a7d
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,17 @@
+This is the Debian GNU/Linux r-cran-erm package of eRm, a package
+providing 'extended Rasch modeling' for GNU R.  eRm was written by
+Patrick Mairand Reinhold Hatzinger.
+
+This package was created by Julian Gilbey <jdg at debian.org>.
+The sources were downloaded from 
+	http://cran.r-project.org/web/packages/eRm/index.html
+
+The package was renamed from its upstream name 'eRm' to 'r-cran-erm'
+to fit the pattern of Debian CRAN (and non-CRAN) packages for R.
+
+Copyright (C) 2007 Patrick Mair and Reinhold Hatzinger
+
+License: GPL version 2
+
+On a Debian GNU/Linux system, the GPL license is included in the file
+/usr/share/common-licenses/GPL-2
diff --git a/debian/overrides b/debian/overrides
new file mode 100644
index 0000000..0c463a1
--- /dev/null
+++ b/debian/overrides
@@ -0,0 +1 @@
+r-cran-erm binary: image-file-in-usr-lib
diff --git a/debian/patches/01_plotPImap-fix-item-subset b/debian/patches/01_plotPImap-fix-item-subset
new file mode 100644
index 0000000..f5f13c7
--- /dev/null
+++ b/debian/patches/01_plotPImap-fix-item-subset
@@ -0,0 +1,32 @@
+Description: Correct item.subset checks in plotPImap
+ Accidentally used ncol instead of nrow and got brackets wrong; also
+ forgot to exclude case of exactly one item given as a character list;
+ this patch attempts to fix these problems!
+Author: Julian Gilbey <jdg at debian.org>
+Origin: other
+Forwarded: no
+Last-Update: 2010-05-16
+
+--- a/R/plotPImap.R
++++ b/R/plotPImap.R
+@@ -21,15 +21,15 @@
+     }
+     tr<-as.matrix(threshtable)
+     if (is.character(item.subset)){
+-       if ( all(item.subset %in% rownames(threshtable)))
++       if (length(item.subset)>1 && all(item.subset %in% rownames(threshtable)))
+           tr<-tr[item.subset,]
+-       else if(!(item.subset=="all"))
+-          stop("item.subset misspecified. Use 'all' or vector of valid item indices.")
++       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 ( all(item.subset %in% 1:ncol(tr)) && length(item.subset>1))
++       if (length(item.subset)>1 && all(item.subset %in% 1:nrow(tr)))
+           tr<-tr[item.subset,]
+        else
+-          stop("item.subset misspecified. Use 'all' or vector of valid item indices.")
++          stop("item.subset misspecified. Use 'all' or vector of at least two valid item indices/names.")
+     }
+ 
+     if (sorted)
diff --git a/debian/patches/02_plotPImap-pp-reuse b/debian/patches/02_plotPImap-pp-reuse
new file mode 100644
index 0000000..e252ff0
--- /dev/null
+++ b/debian/patches/02_plotPImap-pp-reuse
@@ -0,0 +1,49 @@
+Description: Allow plotPImap to reuse person.parameter data
+ plotPImap recalculates person.parameter data; this patch allows the
+ function to reuse a previously calculated data set.
+Author: Julian Gilbey <jdg at debian.org>
+Origin: other
+Forwarded: no
+Last-Update: 2010-05-13
+
+--- a/R/plotPImap.R
++++ b/R/plotPImap.R
+@@ -1,7 +1,7 @@
+ `plotPImap` <-
+ function(object, item.subset="all", sorted = FALSE, main="Person-Item Map",
+                  latdim="Latent Dimension", pplabel="Person\nParameter\nDistribution",
+-                 cex.gen=0.7, xrange=NULL, warn.ord=TRUE, irug=TRUE)
++                 cex.gen=0.7, xrange=NULL, warn.ord=TRUE, irug=TRUE, pp=NULL)
+ {
+     def.par <- par(no.readonly = TRUE) # save default, for resetting...
+ 
+@@ -39,7 +39,7 @@
+     tr<-as.matrix(tr[,-1])
+ 
+     # person parameters unlist in case of several for NA groups
+-    suppressWarnings(pp<-person.parameter(object))
++    if (is.null(pp)) suppressWarnings(pp<-person.parameter(object))
+     theta<-unlist(pp$thetapar)
+ 
+     tt<-table(theta)
+--- a/man/plotPImap.Rd
++++ b/man/plotPImap.Rd
+@@ -14,7 +14,7 @@
+ plotPImap(object, item.subset = "all", sorted = FALSE,
+    main = "Person-Item Map", latdim = "Latent Dimension",
+    pplabel = "Person\nParameter\nDistribution", cex.gen = 0.7,
+-   xrange = NULL, warn.ord = TRUE, irug = TRUE)
++   xrange = NULL, warn.ord = TRUE, irug = TRUE, pp = NULL)
+ }
+ \arguments{
+   \item{object}{Object of class \code{Rm} or \code{dRm}}
+@@ -34,6 +34,9 @@
+        panel to indicate nonordinal threshold locations for polytomous items.}
+   \item{irug}{If \code{TRUE} (the default), all thresholds are plotted below the person distribution
+        to indicate where the included items are most informative.}
++  \item{pp}{If non-\code{NULL}, this contains the
++    \code{person.parameter} data of the data object, avoiding the
++    need to recalculate it.}
+ }
+ \details{
+   Item locations are displayed with bullets, threshold locations with circles.
diff --git a/debian/patches/03_plotPImap-prettify b/debian/patches/03_plotPImap-prettify
new file mode 100644
index 0000000..23c4659
--- /dev/null
+++ b/debian/patches/03_plotPImap-prettify
@@ -0,0 +1,72 @@
+Description: Prettify the plotPImap output
+ Offers an option to color items which are misordered in addition to
+ warning with a *.
+Author: Julian Gilbey <jdg at debian.org>
+Origin: other
+Forwarded: no
+Last-Update: 2010-05-13
+
+--- a/R/plotPImap.R
++++ b/R/plotPImap.R
+@@ -1,7 +1,8 @@
+ `plotPImap` <-
+ function(object, item.subset="all", sorted = FALSE, main="Person-Item Map",
+                  latdim="Latent Dimension", pplabel="Person\nParameter\nDistribution",
+-                 cex.gen=0.7, xrange=NULL, warn.ord=TRUE, irug=TRUE, pp=NULL)
++                 cex.gen=0.7, xrange=NULL, warn.ord=TRUE, warn.ord.colour=FALSE,
++                 irug=TRUE, pp=NULL)
+ {
+     def.par <- par(no.readonly = TRUE) # save default, for resetting...
+ 
+@@ -79,18 +80,23 @@
+       i<-nrow(tr)+1-j
+       assign("trpoints",tr[i,!is.na(tr[i,])])
+       npnts<-length(trpoints)
+-      points(sort(trpoints),rep(j,npnts),type="b")
++      if (warn.ord.colour && !dRM) {
++        if(!all(sort(trpoints)==trpoints)) ptcol="blue" else ptcol="black"
++      } else
++         ptcol="black"
++      if(npnts>1) points(sort(trpoints),rep(j,npnts),type="b",cex=1,col=ptcol)
+       if (dRm) {
+          lines(xrange*1.5,rep(j,2),lty="dotted")
+-         text(sort(trpoints),rep(j,npnts),rownames(tr)[i], cex=cex.gen,pos=3) # different labelling for dRm
++         text(sort(trpoints),rep(j,npnts),rownames(tr)[i], cex=cex.gen,pos=3,col=ptcol) # different labelling for dRm
+       } else {
+          #lines(xrange*1.5,rep(j,2),lty="dotted")
+-         text(sort(trpoints),rep(j,npnts),(1:npnts)[order(trpoints)],cex=cex.gen,pos=1)
++         if(npnts>1)
++            text(sort(trpoints),rep(j,npnts),(1:npnts)[order(trpoints)],cex=cex.gen,pos=1,col=ptcol)
+          if(!all(sort(trpoints)==trpoints)) warn[j]<-"*"
+ 
+       }
+-      points(loc[i],j,pch=20,cex=1.5) # plot item locations
+-      text(loc[i],j,rev(rownames(tr)[i]),cex=cex.gen,pos=3)
++      points(loc[i],j,pch=20,cex=1.5,col=ptcol) # plot item locations
++      text(loc[i],j,rev(rownames(tr)[i]),cex=cex.gen,pos=3,col=ptcol)
+ 
+     }
+     if (warn.ord) axis(4,at=1:nrow(tr),tick=FALSE, labels=warn, padj=-1.5)#,cex.axis=cex.gen)
+--- a/man/plotPImap.Rd
++++ b/man/plotPImap.Rd
+@@ -14,7 +14,8 @@
+ plotPImap(object, item.subset = "all", sorted = FALSE,
+    main = "Person-Item Map", latdim = "Latent Dimension",
+    pplabel = "Person\nParameter\nDistribution", cex.gen = 0.7,
+-   xrange = NULL, warn.ord = TRUE, irug = TRUE, pp = NULL)
++   xrange = NULL, warn.ord = TRUE, warn.ord.colour = FALSE,
++   irug = TRUE, pp = NULL)
+ }
+ \arguments{
+   \item{object}{Object of class \code{Rm} or \code{dRm}}
+@@ -32,6 +33,10 @@
+   \item{xrange}{Range for the x-axis}
+   \item{warn.ord}{If \code{TRUE} (the default) asterisks are displayed in the right margin of the lower
+        panel to indicate nonordinal threshold locations for polytomous items.}
++  \item{warn.ord.colour}{If \code{TRUE} nonordinal threshold locations
++    for polytomous items are also coloured blue to make them even more
++    visible.  This is especially useful when there are many items so
++    that the plot is quite dense.}
+   \item{irug}{If \code{TRUE} (the default), all thresholds are plotted below the person distribution
+        to indicate where the included items are most informative.}
+   \item{pp}{If non-\code{NULL}, this contains the
diff --git a/debian/patches/04_PathwayMap b/debian/patches/04_PathwayMap
new file mode 100644
index 0000000..81f352d
--- /dev/null
+++ b/debian/patches/04_PathwayMap
@@ -0,0 +1,393 @@
+Description: Produce a Bond-and-Fox Pathway Map
+ Calculates the infit and outfit t values, and produces Bond-and-Fox
+ Pathway Maps from a data set, that is plots of either item
+ difficulties or person abilities against infit t values.  To do this,
+ it is necessary to add to the internal calculations in the itemfit
+ and personfit parts of the code to calculate the kurtosis of the
+ standardized residuals in addition to their variance.  We do not
+ attempt to put both items and persons on the same plot.
+Author: Julian Gilbey <jdg at debian.org>
+Origin: other
+Forwarded: no
+Last-Update: 2010-05-16
+
+--- a/R/personfit.ppar.R
++++ b/R/personfit.ppar.R
+@@ -18,6 +18,7 @@
+   VE <- pifit.internal(object)                  #compute expectation and variance term
+   Emat <- VE$Emat
+   Vmat <- VE$Vmat
++  Cmat <- VE$Cmat
+ 
+   st.res <- (X-Emat)/sqrt(Vmat)
+   #st.res <- (X[!TFrow,]-Emat)/sqrt(Vmat)
+@@ -31,11 +32,21 @@
+ 
+   p.outfitMSQ <- pfit/pdf
+ 
++  qsq.outfitMSQ <- (rowSums(sq.res/Vmat^2, na.rm=TRUE)/pdf^2) - 1/pdf
++  q.outfitMSQ <- sqrt(qsq.outfitMSQ)
++
+   psumVmat<-rowSums(Vmat)
+   p.infitMSQ <- rowSums(sq.res*Vmat, na.rm = TRUE)/psumVmat
+ 
++  qsq.infitMSQ <- rowSums(Cmat-Vmat^2, na.rm=TRUE)/psumVmat^2
++  q.infitMSQ <- sqrt(qsq.infitMSQ)
++
++  p.outfitZ <- (sqrt(p.outfitMSQ)-1)*(3/q.outfitMSQ)+(q.outfitMSQ/3)
++  p.infitZ <- (sqrt(p.infitMSQ)-1)*(3/q.infitMSQ)+(q.infitMSQ/3)
++
+   result <- list(p.fit = pfit, p.df = pdf, st.res = st.res, p.outfitMSQ = p.outfitMSQ,
+-                 p.infitMSQ = p.infitMSQ)
++                 p.infitMSQ = p.infitMSQ,
++                 p.outfitZ = p.outfitZ, p.infitZ = p.infitZ)
+   class(result) <- "pfit"
+   result
+ }
+--- a/R/pifit.internal.r
++++ b/R/pifit.internal.r
+@@ -35,6 +35,11 @@
+   V.list <- tapply(1:length(mt_ind0),mt_ind0, function(ind) {rowSums(Vmat.cat[,ind],na.rm=TRUE)})
+   Vmat <- matrix(unlist(V.list),ncol=dim(X)[2],dimnames=list(rownames(pmat),colnames(X)))
+ 
+-  result <- list(Emat=Emat,Vmat=Vmat)
++  #------------------------kurtosis term for standardized residuals------
++  Cmat.cat <- (Emat0)^4*pmat0
++  C.list <- tapply(1:length(mt_ind0),mt_ind0, function(ind) {rowSums(Cmat.cat[,ind],na.rm=TRUE)})
++  Cmat <- matrix(unlist(C.list),ncol=dim(X)[2],dimnames=list(rownames(pmat),colnames(X)))
++
++  result <- list(Emat=Emat,Vmat=Vmat,Cmat=Cmat)
+ 
+ }
+--- a/R/itemfit.ppar.r
++++ b/R/itemfit.ppar.r
+@@ -12,6 +12,7 @@
+   VE <- pifit.internal(object)                  #compute expectation and variance term
+   Emat <- VE$Emat
+   Vmat <- VE$Vmat
++  Cmat <- VE$Cmat
+ 
+   st.res <- (X-Emat)/sqrt(Vmat)
+   sq.res <- st.res^2                            #squared standardized residuals
+@@ -21,11 +22,20 @@
+ 
+   i.outfitMSQ <- ifit/idf
+ 
++  qsq.outfitMSQ <- (colSums(sq.res/Vmat^2, na.rm=TRUE)/idf^2) - 1/idf
++  q.outfitMSQ <- sqrt(qsq.outfitMSQ)
++
+   isumVmat<-colSums(Vmat)
+   i.infitMSQ <- colSums(sq.res*Vmat, na.rm = TRUE)/isumVmat
+ 
+-  result <- list(i.fit=ifit,i.df=idf,st.res=st.res,i.outfitMSQ=i.outfitMSQ,i.infitMSQ=i.infitMSQ)
++  qsq.infitMSQ <- colSums(Cmat-Vmat^2, na.rm=TRUE)/isumVmat^2
++  q.infitMSQ <- sqrt(qsq.infitMSQ)
++
++  i.outfitZ <- (sqrt(i.outfitMSQ)-1)*(3/q.outfitMSQ)+(q.outfitMSQ/3)
++  i.infitZ <- (sqrt(i.infitMSQ)-1)*(3/q.infitMSQ)+(q.infitMSQ/3)
++
++  result <- list(i.fit=ifit,i.df=idf,st.res=st.res,i.outfitMSQ=i.outfitMSQ,i.infitMSQ=i.infitMSQ,i.outfitZ=i.outfitZ,i.infitZ=i.infitZ)
++
+   class(result) <- "ifit"
+   result
+ }
+-
+--- a/R/print.ifit.R
++++ b/R/print.ifit.R
+@@ -4,8 +4,8 @@
+ # x...object of class "ifit" from (itemfit)
+ {
+   pvalues <- 1-pchisq(x$i.fit,x$i.df-1)  # df correction rh 10-01-20
+-  coef.table <- cbind(round(x$i.fit,3),x$i.df-1,round(pvalues,3),round(x$i.outfitMSQ,3),round(x$i.infitMSQ,3))
+-  colnames(coef.table) <- c("Chisq","df","p-value","Outfit MSQ", "Infit MSQ" )
++  coef.table <- cbind(round(x$i.fit,3),x$i.df-1,round(pvalues,3),round(x$i.outfitMSQ,3),round(x$i.infitMSQ,3),round(x$i.outfitZ,2),round(x$i.infitZ,2))
++  colnames(coef.table) <- c("Chisq","df","p-value","Outfit MSQ", "Infit MSQ", "Outfit t", "Infit t" )
+   rownames(coef.table) <- names(x$i.fit)
+   if (visible){       # added rh 10-01-20
+     cat("\nItemfit Statistics: \n")
+--- a/R/print.pfit.R
++++ b/R/print.pfit.R
+@@ -4,8 +4,8 @@
+ # x...object of class "pfit" from (personfit)
+ {
+   pvalues <- 1-pchisq(x$p.fit,x$p.df-1)  # df correction rh 10-01-20
+-  coef.table <- cbind(round(x$p.fit,3),x$p.df-1,round(pvalues,3),round(x$p.outfitMSQ,3),round(x$p.infitMSQ,3))
+-  colnames(coef.table) <- c("Chisq","df","p-value","Outfit MSQ", "Infit MSQ" )
++  coef.table <- cbind(round(x$p.fit,3),x$p.df-1,round(pvalues,3),round(x$p.outfitMSQ,3),round(x$p.infitMSQ,3),round(x$p.outfitZ,2),round(x$p.infitZ,2))
++  colnames(coef.table) <- c("Chisq","df","p-value","Outfit MSQ", "Infit MSQ", "Outfit t", "Infit t" )
+   rownames(coef.table) <- names(x$p.fit)
+   if (visible){       # added rh 10-01-20
+      cat("\nPersonfit Statistics: \n")
+--- a/NAMESPACE
++++ b/NAMESPACE
+@@ -15,6 +15,7 @@
+ export(plotICC)
+ export(plotjointICC)
+ export(plotPImap)
++export(plotPathwayMap)
+ export(pmat)
+ export(Waldtest)
+ export(IC)
+--- /dev/null
++++ b/R/plotPathwayMap.R
+@@ -0,0 +1,177 @@
++`plotPathwayMap` <-
++function(object, pmap=FALSE, 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)
++{
++    def.par <- par(no.readonly = TRUE) # save default, for resetting...
++
++# 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!")
++
++# compute threshtable (from betapars for dichotomous models) and item names
++    if (object$model == "RM" || max(object$X) < 2 ) { # dichotomous model
++      dRm <- TRUE
++
++      # betapars are easiness parameters; only the pars need negating
++      threshtable<-cbind(object$betapar * -1, object$se.beta)
++      rownames(threshtable) <- colnames(pcm$X)
++
++      # shorter synonym
++      tt<-threshtable
++    } else { # polytomous model
++      dRm <- FALSE
++
++      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!")
++
++      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.")
++      }
++    } 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.")
++      }
++    }
++
++    # We have to postpone the person subsetting code until after we have
++    # done the person plot calculations
++
++    # 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
++
++    if (is.null(pp)) pp<-person.parameter(object)
++    
++    ploc <- as.matrix(pp$theta.table['Person Parameter'])
++    pse <- as.matrix(pp$se.theta[[1]])
++    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.")
++    }
++
++    # 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
++    }
++
++    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)
++
++      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)      
++    }
++    
++    par(def.par)
++}
++
+--- /dev/null
++++ b/man/plotPathwayMap.Rd
+@@ -0,0 +1,80 @@
++\name{plotPathwayMap}
++\alias{plotPathwayMap}
++\title{Pathway Map}
++\description{
++    A Bond-and-Fox Pathway Map displays the location of each item or
++    each person against its infit t-statistic.  Pathway maps are useful
++    for identifying misfitting items or misfitting persons.  Items or
++    people should ideally have a infit t-statistic lying between about
++    -2 and +2, and these values are marked.
++}
++\usage{
++plotPathwayMap(object, pmap = FALSE,
++                 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)
++}
++\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{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
++    plotted. The number of items to be plotted must be > 1.}
++  \item{person.subset}{Subset of persons to be plotted for a person map.
++    Either a numeric vector indicating the person numbers or a character
++    vector indicating the person names.  If \code{"all"}, all persons are
++    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{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
++    \code{person.parameter} data of the data object, avoiding the
++    need to recalculate it.}
++  \item{cex.gen}{\code{cex} as a graphical parameter
++    specifies a numerical value giving the amount by which plotting
++    text and symbols should be magnified relative to the
++    default. Here \code{cex.gen} applies to all text labels. The
++    default is 0.6.}
++}
++\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.
++}
++%\value{}
++\references{
++  Bond T.G., Fox C.M. (2007) \emph{Applying the Rasch Model: Fundamental
++  Measurement in the Human Sciences} (2nd ed.) chapter 3, Lawrence
++  Erlbaum Associates, Inc.
++
++  Linacre J.M., Wright B.D. (1994) Dichotomous Infit and
++  Outfit Mean-Square Fit Statistics / Chi-Square Fit Statistics.
++  \emph{Rasch Measurement Transactions} \bold{8:2} p. 350,
++  \url{http://www.rasch.org/rmt/rmt82a.htm}
++
++  Linacre J.M. (2002) What do Infit and Outfit, Mean-square and
++  Standardized mean?  \emph{Rasch Measurement Transactions} \bold{16:2}
++  p. 878, \url{http://www.rasch.org/rmt/rmt162f.htm}
++
++  Wright B.D., Masters G.N. (1990) Computation of OUTFIT and INFIT
++  Statistics.  \emph{Rasch Measurement Transactions} \bold{3:4}
++  p. 84--85, \url{http://www.rasch.org/rmt/rmt34e.htm}
++
++}
++\author{Julian Gilbey}
++%\note{}
++%\seealso{}
++\examples{
++data(pcmdat)
++res<-PCM(pcmdat)
++pparm<-person.parameter(res)
++plotPathwayMap(res, pp=pparm)
++plotPathwayMap(res, pp=pparm, pmap=TRUE)
++}
++\keyword{models}
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..382b7f4
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,4 @@
+01_plotPImap-fix-item-subset
+02_plotPImap-pp-reuse
+03_plotPImap-prettify
+04_PathwayMap
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..14fc53d
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+# debian/rules file for the Debian/GNU Linux r-cran-* packages
+
+include /usr/share/R/debian/r-cran.mk
+
+# Fix the borken permissions :-(
+install/r-cran-erm::
+	chmod a-x debian/r-cran-erm/usr/lib/R/site-library/eRm/doc/*
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..b6e3297
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://cran.r-project.org/src/contrib/eRm_([-0-9\.]*).tar.gz

-- 
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