fix the musoSensi variance bug

This commit is contained in:
hollorol 2018-05-14 09:52:50 +02:00
parent 1de761a27c
commit d2fce92741
4 changed files with 13 additions and 8 deletions

View File

@ -17,7 +17,8 @@ Imports:
Rcpp,
magrittr,
dplyr,
ggplot2
ggplot2,
rmarkdown
LinkingTo: Rcpp
Maintainer: Roland Hollo's <hollorol@gmail.com>
RoxygenNote: 6.0.1

View File

@ -12,6 +12,7 @@ export(musoMapping)
export(musoMonte)
export(musoRandomizer)
export(musoSensi)
export(paramSweepŰ)
export(plotMuso)
export(rungetMuso)
export(setupMuso)

View File

@ -25,7 +25,7 @@ musoSensi <- function(monteCarloFile = NULL,
settings = NULL,
parametersFromFile=FALSE,
inputDir = "./",
outLoc = "./calib",
outLoc = "./calib",
iterations = 30,
preTag = "mont-",
outputType = "moreCsv",
@ -56,11 +56,13 @@ musoSensi <- function(monteCarloFile = NULL,
varNames<- colnames(M)[1:npar]
w <- lm(y~M)$coefficients[-1]
Sv <- apply(M,2,var)
overalVar <- sum(Sv^2*w^2)
overalVar <- sum(Sv*w^2)
S=numeric(npar)
for(i in 1:npar){
S[i] <- ((w[i]^2*Sv[i]^2)/overalVar)*100
S[i] <- ((w[i]^2*Sv[i])/(overalVar))*100
}
S <- round(S)
names(S)<-varNames
write.csv(file = outputFile, x = S)

View File

@ -4,10 +4,11 @@
\alias{musoSensi}
\title{musoSensi}
\usage{
musoSensi(monteCarloFile = NULL, parameters, settings = NULL,
inputDir = "./", outLoc = "./calib", iterations = 30,
preTag = "mont-", outputType = "moreCsv", fun = mean, varIndex = 1,
outputFile = "sensitivity.csv", plotName = "sensitivity")
musoSensi(monteCarloFile = NULL, parameters = NULL, settings = NULL,
parametersFromFile = FALSE, inputDir = "./", outLoc = "./calib",
iterations = 30, preTag = "mont-", outputType = "moreCsv", fun = mean,
varIndex = 1, outputFile = "sensitivity.csv",
plotName = "sensitivity.png", plotTitle = "Sensitivity", dpi = 300)
}
\arguments{
\item{monteCarloFile}{If you run musoMonte function previously, you did not have to rerun the monteCarlo, just provide the preservedEpc.csv file with its path. If you do not set this parameter, musoSensi will fun the musoMonte function to get all of the information.}