Skip to content

Commit

Permalink
Merge pull request #3 from LAPKB/v1.9.3
Browse files Browse the repository at this point in the history
V1.9.3
  • Loading branch information
mnneely authored Apr 15, 2020
2 parents cf000c7 + 40df60a commit 3daf3b4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Description: Parametric and non-parametric
which used to be available on CRAN.
Authors@R: person("Michael", "Neely",
email = "mneely@usc.edu", role = c("aut", "cre"))
Version: 1.9.2
Version: 1.9.3
URL: http://www.lapk.org
Date: 2020-02-29
Depends:
Expand Down
3 changes: 1 addition & 2 deletions R/PMreport.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ PMreport <- function(wd, rdata, icen = "median", type = "NPAG", parallel = F) {
writeHTML("<label for=\"tab4\">Parameter Values</label>")
writeHTML("<div id=\"tab-content4\" class=\"tab-content\">")
if (!all(is.null(final))) {
report.table <- data.frame(mean = final$popMean, sd = final$popSD, CV = final$popCV, var = final$popVar,
median = final$popMedian, shrink = 100 * final$shrinkage$shrinkage)
report.table <- data.frame(mean = t(final$popMean), sd = t(final$popSD), CV = t(final$popCV), var = t(final$popVar), median = t(final$popMedian), shrink = t(100 * final$shrinkage))
names(report.table) <- c("Mean", "SD", "CV%", "Var", "Median", "Shrink%")
if (reportType == 1) {
#only for NPAG
Expand Down
30 changes: 23 additions & 7 deletions R/makeFinal.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ makeFinal <- function(data){
}
#summarize weighted corden
wParVol <- prod(data$ab[,2]-data$ab[,1]) / gridpts
if (nrow(data$corden)>1) {popMean <- colSums(data$corden[,1:data$nvar] * data$corden[,data$nvar+1] ) * wParVol} else {
if (nrow(data$corden)>1) {
popMean <- colSums(data$corden[,1:data$nvar] * data$corden[,data$nvar+1] ) * wParVol
} else {
popMean <- data$corden[1:data$nvar] * data$corden[data$nvar+1] * wParVol
}

names(popMean) <- data$par

if(nrow(data$corden)>1){
popCov <- matrix(NA,ncol=data$nvar,nrow=data$nvar)
for (i in 1:data$nvar){
Expand All @@ -86,15 +90,17 @@ makeFinal <- function(data){
popCor <- matrix(rep(NA,data$nvar**2),nrow=data$nvar)
diag(popCor) <- rep(1,data$nvar)
}
popMean <- data.frame(t(popMean))



popPoints <- data.frame(data$corden)
names(popPoints) <- c(data$par,"prob")
popPoints$prob <- popPoints$prob*wParVol
class(popPoints) <- c("popPoints","data.frame")

names(popMean) <- data$par
dimnames(popCov) <- list(data$par,data$par)
if (all(!is.na(popCor))) dimnames(popCor) <- list(data$par,data$par)



if(length(data$postden)>0){
# temp1 <- melt(data$postden)
Expand All @@ -121,7 +127,7 @@ makeFinal <- function(data){
popMedian <- pointSum[pointSum$parameter=="WtMed" & pointSum$percentile==0.5,1:length(data$par)]
names(popMedian) <- data$par

popVar <- diag(popCov)
popVar <- data.frame(t(diag(popCov)))
names(popVar) <- data$par

popSD <- sqrt(popVar)
Expand Down Expand Up @@ -156,13 +162,18 @@ makeFinal <- function(data){
#shrinkage
varEBD <- apply(postVar[,-1],2,mean)
sh <- varEBD/popVar
sh.DF <- data.frame(par=data$par,shrinkage=sh)
sh.DF <- data.frame(sh)

if(is.null(data$nranfix)) data$nranfix <- 0
if(data$nranfix>0){
popRanFix <- data$valranfix
names(popRanFix) <- data$parranfix
} else {popRanFix <- NULL}

popCov <- data.frame(popCov, row.names = data$par)
popCor <- data.frame(popCor, row.names = data$par)
names(popCov) <- data$par
if (all(!is.na(popCor))) names(popCor) <- data$par


outlist <- list(popPoints=popPoints,popMean=popMean,popSD=popSD,popCV=popCV,popVar=popVar,
Expand Down Expand Up @@ -205,7 +216,12 @@ makeFinal <- function(data){
#shrinkage
varEBD <- apply(postVar[,-1],2,mean)
sh <- varEBD/popVar
sh.DF <- data.frame(par=data$par,shrinkage=sh)
sh.DF <- data.frame(sh)

popCov <- data.frame(popCov, row.names = data$par)
popCor <- data.frame(popCor, row.names = data$par)
names(popCov) <- data$par
if (all(!is.na(popCor))) names(popCor) <- data$par


outlist <- list(popMean=popMean,popSD=popSD,popCV=popCV,popVar=popVar,
Expand Down
9 changes: 9 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
\name{NEWS}
\title{NEWS file for the Pmetrics package}

\section{Changes in version 1.9.3}{

\subsection{BUG FIXES}{
\itemize{
\item A bug that made some tables in the report have wrong headers was fixed.
}
}
}

\section{Changes in version 1.9.2}{

\subsection{NEW FEATURES}{
Expand Down

0 comments on commit 3daf3b4

Please sign in to comment.