From bc7c3ef5a4cc95d2fc874760c2f96281a700cdf1 Mon Sep 17 00:00:00 2001 From: Robin Clark Date: Tue, 24 Mar 2020 21:31:07 +0000 Subject: [PATCH] Logistic Regression Analysis module --- SilveR.IntegrationTests/xunit.runner.json | 2 +- SilveR/Controllers/AnalysesController.cs | 6 + .../Scripts/ChiSquaredAndFishersExactTest.R | 16 +- SilveR/Scripts/Common_Functions.R | 32 +- ...onOfMeansPowerAnalysisDatasetBasedInputs.R | 15 +- ...risonOfMeansPowerAnalysisUserBasedInputs.R | 15 +- SilveR/Scripts/CorrelationAnalysis.R | 18 +- ...seResponseAndNonLinearRegressionAnalysis.R | 15 +- SilveR/Scripts/GraphicalAnalysis.R | 23 +- .../IncompleteFactorialParametricAnalysis.R | 15 +- SilveR/Scripts/LinearRegressionAnalysis.R | 15 +- SilveR/Scripts/LogisticRegressionAnalysis.R | 2155 +++++++++++++++++ SilveR/Scripts/MultivariateAnalysis.R | 13 +- SilveR/Scripts/NestedDesignAnalysis.R | 15 +- SilveR/Scripts/NonParametricAnalysis.R | 63 +- SilveR/Scripts/OneSampleTTestAnalysis.R | 15 +- ...eWayANOVAPowerAnalysisDatasetBasedInputs.R | 15 +- .../OneWayANOVAPowerAnalysisUserBasedInputs.R | 15 +- .../PValueAdjustmentDatasetBasedInputs.R | 15 +- .../Scripts/PValueAdjustmentUserBasedInputs.R | 15 +- SilveR/Scripts/PairedTTestAnalysis.R | 24 +- .../RepeatedMeasuresParametricAnalysis.R | 15 +- .../SingleMeasuresParametricAnalysis.R | 15 +- SilveR/Scripts/SummaryStatistics.R | 15 +- SilveR/Scripts/SurvivalAnalysis.R | 15 +- SilveR/Scripts/UnpairedTTestAnalysis.R | 15 +- SilveR/SilveR.csproj | 7 +- SilveR/Startup.cs | 13 +- SilveR/StatsModels/AnalysisFactory.cs | 3 + .../LogisticRegressionAnalysisModel.cs | 420 ++++ .../LogisticRegressionAnalysisValidator.cs | 159 ++ .../Analyses/LinearRegressionAnalysis.cshtml | 2 +- .../LogisticRegressionAnalysis.cshtml | 202 ++ .../RepeatedMeasuresParametricAnalysis.cshtml | 2 +- SilveR/Views/Shared/_Layout.cshtml | 1 + SilveR/bundleconfig.json | 7 + .../js/stats/logisticRegressionAnalysis.js | 185 ++ .../stats/logisticRegressionAnalysis.min.js | 1 + Silver.UnitTests/Helpers/PdfGeneratorTests.cs | 23 - .../LogisticRegressionAnalysisModelTests.cs | 573 +++++ azure-pipelines.yml | 34 +- 41 files changed, 4120 insertions(+), 104 deletions(-) create mode 100644 SilveR/Scripts/LogisticRegressionAnalysis.R create mode 100644 SilveR/StatsModels/LogisticRegressionAnalysisModel.cs create mode 100644 SilveR/Validators/LogisticRegressionAnalysisValidator.cs create mode 100644 SilveR/Views/Analyses/LogisticRegressionAnalysis.cshtml create mode 100644 SilveR/wwwroot/js/stats/logisticRegressionAnalysis.js create mode 100644 SilveR/wwwroot/js/stats/logisticRegressionAnalysis.min.js delete mode 100644 Silver.UnitTests/Helpers/PdfGeneratorTests.cs create mode 100644 Silver.UnitTests/StatsModels/LogisticRegressionAnalysisModelTests.cs diff --git a/SilveR.IntegrationTests/xunit.runner.json b/SilveR.IntegrationTests/xunit.runner.json index a293c3a88..6805878e2 100644 --- a/SilveR.IntegrationTests/xunit.runner.json +++ b/SilveR.IntegrationTests/xunit.runner.json @@ -1,3 +1,3 @@ { - "parallelizeTestCollections": true + "parallelizeTestCollections": false } \ No newline at end of file diff --git a/SilveR/Controllers/AnalysesController.cs b/SilveR/Controllers/AnalysesController.cs index 4edaff9f5..416690470 100644 --- a/SilveR/Controllers/AnalysesController.cs +++ b/SilveR/Controllers/AnalysesController.cs @@ -181,6 +181,12 @@ public async Task LinearRegressionAnalysis(LinearRegressionAnalys return await RunAnalysis(model, ignoreWarnings); } + [HttpPost] + public async Task LogisticRegressionAnalysis(LogisticRegressionAnalysisModel model, bool ignoreWarnings) + { + return await RunAnalysis(model, ignoreWarnings); + } + [HttpPost] public async Task DoseResponseAndNonLinearRegressionAnalysis(DoseResponseAndNonLinearRegressionAnalysisModel model, bool ignoreWarnings) { diff --git a/SilveR/Scripts/ChiSquaredAndFishersExactTest.R b/SilveR/Scripts/ChiSquaredAndFishersExactTest.R index 6348b304c..993c78e71 100644 --- a/SilveR/Scripts/ChiSquaredAndFishersExactTest.R +++ b/SilveR/Scripts/ChiSquaredAndFishersExactTest.R @@ -437,7 +437,13 @@ if (BarnardsExactTest == "Y") { #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(BarnardsExactTest == "Y" && row == 2 && col == 2) @@ -445,7 +451,13 @@ if(BarnardsExactTest == "Y" && row == 2 && col == 2) HTML("Lydersen, S., Fagerland, M.W. and Laake, P. (2009). Recommended tests for association in 2 x 2 tables. Statistics in Medicine, 28, 1159-1175.", align="left") } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} + HTML(Ref_list$R_ref , align="left") HTML(Ref_list$R2HTML_ref, align="left") diff --git a/SilveR/Scripts/Common_Functions.R b/SilveR/Scripts/Common_Functions.R index ca773a4c3..53826dea9 100644 --- a/SilveR/Scripts/Common_Functions.R +++ b/SilveR/Scripts/Common_Functions.R @@ -2,6 +2,9 @@ #branding <- "InVivoStat (beta version)" branding <- "InVivoStat" +#Software update +UpdateIVS <- "N" + #Beta warning Betawarn <- "N" BetaMessage <- "This output has been generated using the beta test version of InVivoStat. Care should be taken when making decisions based on the output." @@ -947,7 +950,6 @@ NONCAT_CPP <- function() { g <- ggplot(graphdata, aes(Time_IVS, yvarrr_IVS)) + theme_map + mytheme + - theme(legend.position = "none") + ylab(YAxisTitle) + xlab(XAxisTitle) + ggtitle(MainTitle2) + @@ -956,6 +958,14 @@ NONCAT_CPP <- function() { geom_point(aes(colour = Animal_IVS), size = 3, shape = 16) + geom_line(aes(group = Animal_IVS, color = Animal_IVS), size = Line_size) + if (UpdateIVS == "N") { + g <- g + theme(legend.position = "none") + } + if (UpdateIVS == "Y") { + g <- g + theme(legend.position = "Gr_legend_pos") + + labs(fill = "Animal_IVS") + } + if (ReferenceLine != "NULL") { g1 <- g + geom_hline(yintercept = Gr_intercept, lty = Gr_line_typeint, size = Line_size, colour = Gr_line) } else { @@ -969,7 +979,6 @@ ONECATSEP_CPP <- function() { g <- ggplot(graphdata, aes(Time_IVS, yvarrr_IVS)) + theme_map + mytheme + - theme(legend.position = "none") + ylab(YAxisTitle) + xlab(XAxisTitle) + ggtitle(MainTitle2) + @@ -978,6 +987,14 @@ ONECATSEP_CPP <- function() { geom_point(aes(colour = Animal_IVS), size = 3, shape = 16) + facet_wrap(~l_l) + if (UpdateIVS == "N") { + g <- g + theme(legend.position = "none") + } + if (UpdateIVS == "Y") { + g <- g + theme(legend.position = "Gr_legend_pos") + + labs(fill = "Animal_IVS") + } + if (ReferenceLine != "NULL") { g1 <- g + geom_hline(yintercept = Gr_intercept, lty = Gr_line_typeint, size = Line_size, colour = Gr_line) } else { @@ -991,7 +1008,6 @@ TWOCATSEP_CPP <- function() { g <- ggplot(graphdata, aes(Time_IVS, yvarrr_IVS)) + theme_map + mytheme + - theme(legend.position = "none") + ylab(YAxisTitle) + xlab(XAxisTitle) + ggtitle(MainTitle2) + @@ -1000,6 +1016,13 @@ TWOCATSEP_CPP <- function() { geom_point(aes(colour = Animal_IVS), size = 3, shape = 16) + facet_grid(firstcatvarrr_IVS ~ secondcatvarrr_IVS) + if (UpdateIVS == "N") { + g <- g + theme(legend.position = "none") + } + if (UpdateIVS == "Y") { + g <- g + theme(legend.position = "Gr_legend_pos") + + labs(fill = "Animal_IVS") + } if (ReferenceLine != "NULL") { g1 <- g + geom_hline(yintercept = Gr_intercept, lty = Gr_line_typeint, size = Line_size, colour = Gr_line) } else { @@ -1657,9 +1680,10 @@ R_refs <- function() { Barnard_ref <- "Peter Calhoun (2013). Exact: Unconditional Exact Test. R package version 1.4. http://CRAN.R-project.org/package=Exact." power_ref <- "Stephane Champely (2018). pwr: Basic Functions for Power Analysis. R package version 1.2-2. https://CRAN.R-project.org/package=pwr" - + IVS_ref <- "When referring to InVivoStat, please cite 'InVivoStat, version 4.1'." Refs <- list( + IVS_ref = IVS_ref, R_ref = R_ref, mtvnorm_ref = mtvnorm_ref, GridExtra_ref = GridExtra_ref, diff --git a/SilveR/Scripts/ComparisonOfMeansPowerAnalysisDatasetBasedInputs.R b/SilveR/Scripts/ComparisonOfMeansPowerAnalysisDatasetBasedInputs.R index 9de11642f..a11dd58cb 100644 --- a/SilveR/Scripts/ComparisonOfMeansPowerAnalysisDatasetBasedInputs.R +++ b/SilveR/Scripts/ComparisonOfMeansPowerAnalysisDatasetBasedInputs.R @@ -542,11 +542,22 @@ HTML("Biologically relevant effect: The size of effect that is of scientific int #=================================================================================================================== Ref_list <- R_refs() -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") #HTML("Harrison, D.A. and Brady, A.R. (2004). Sample size and power calculations using the noncentral t-distribution. The Stata Journal, 4(2), 142-153.", align = "left") -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") HTML(Ref_list$RColorBrewers_ref, align = "left") diff --git a/SilveR/Scripts/ComparisonOfMeansPowerAnalysisUserBasedInputs.R b/SilveR/Scripts/ComparisonOfMeansPowerAnalysisUserBasedInputs.R index 5361c3f7e..b0a7f2676 100644 --- a/SilveR/Scripts/ComparisonOfMeansPowerAnalysisUserBasedInputs.R +++ b/SilveR/Scripts/ComparisonOfMeansPowerAnalysisUserBasedInputs.R @@ -542,11 +542,22 @@ HTML("Biologically relevant effect: The size of effect that is of scientific int #=================================================================================================================== Ref_list <- R_refs() -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") #HTML("Harrison, D.A. and Brady, A.R. (2004). Sample size and power calculations using the noncentral t-distribution. The Stata Journal, 4(2), 142-153.", align = "left") -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") HTML(Ref_list$RColorBrewers_ref, align = "left") diff --git a/SilveR/Scripts/CorrelationAnalysis.R b/SilveR/Scripts/CorrelationAnalysis.R index c0ec9b054..5a7a68949 100644 --- a/SilveR/Scripts/CorrelationAnalysis.R +++ b/SilveR/Scripts/CorrelationAnalysis.R @@ -894,8 +894,15 @@ Ref_list<-R_refs() #Bate and Clark comment HTML(refxx, align="left") -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") + if (method == "Pearson") { HTML("Snedecor, G.W. and Cochran, W.G. (1989). Statistical Methods. 8th edition; Iowa State University Press, Iowa, USA.", align="left") } @@ -905,7 +912,14 @@ if (method == "Spearman") { if (method == "Spearman" || method == "Kendall") { HTML("Hollander, M. and Wolfe, D.A. (1973). Nonparametric Statistical Methods. New York: John Wiley & Sons. P185-194. ", align="left") } -HTML.title("R references", HR=2, align="left") + +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} + HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/DoseResponseAndNonLinearRegressionAnalysis.R b/SilveR/Scripts/DoseResponseAndNonLinearRegressionAnalysis.R index 199449663..a93ec5f00 100644 --- a/SilveR/Scripts/DoseResponseAndNonLinearRegressionAnalysis.R +++ b/SilveR/Scripts/DoseResponseAndNonLinearRegressionAnalysis.R @@ -1024,10 +1024,21 @@ if (DoseResponseType == "FourParameter") { #=================================================================================================================== Ref_list <- R_refs() -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$mtvnorm_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") diff --git a/SilveR/Scripts/GraphicalAnalysis.R b/SilveR/Scripts/GraphicalAnalysis.R index a67b7ce94..0a6c7cad8 100644 --- a/SilveR/Scripts/GraphicalAnalysis.R +++ b/SilveR/Scripts/GraphicalAnalysis.R @@ -926,7 +926,13 @@ if(CaseProfilesPlot == "Y" && FirstCatFactor == "NULL" && SecondCatFactor == "NU graphdata$Animal_IVS<-as.factor(eval(parse(text = paste("graphdata$", CaseIDFactor)))) graphdata<-graphdata[order(graphdata$Animal_IVS, graphdata$Time_IVS), ] } else { - graphdata$Animal_IVS<-paste(graphdata$l_l , "=" , as.factor(eval(parse(text = paste("graphdata$", CaseIDFactor)))), sep = "") + + if (UpdateIVS =="N") { + graphdata$Animal_IVS<-paste(graphdata$l_l , "=" , as.factor(eval(parse(text = paste("graphdata$", CaseIDFactor)))), sep = "") + } + if (UpdateIVS =="Y") { + graphdata$Animal_IVS<-paste(as.factor(eval(parse(text = paste("graphdata$", CaseIDFactor)))), " (", graphdata$l_l , ")", sep = "") + } graphdata<-graphdata[order(graphdata$Animal_IVS, graphdata$Time_IVS), ] } @@ -1737,14 +1743,25 @@ Ref_list <- R_refs() #Bate and Clark comment HTML(refxx, align = "left") -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") if (BoxPlot == "Y" && is.numeric(graphdata$yvarrr_IVS) == TRUE) { HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365. ", align = "left") } -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") HTML(Ref_list$RColorBrewers_ref, align = "left") diff --git a/SilveR/Scripts/IncompleteFactorialParametricAnalysis.R b/SilveR/Scripts/IncompleteFactorialParametricAnalysis.R index 7d7548fe2..c5707b08c 100644 --- a/SilveR/Scripts/IncompleteFactorialParametricAnalysis.R +++ b/SilveR/Scripts/IncompleteFactorialParametricAnalysis.R @@ -2038,7 +2038,13 @@ Ref_list<-R_refs() #Bate and Clark comment HTML(refxx, align="left") -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(showANOVA=="Y") { @@ -2083,7 +2089,12 @@ if (allPairwiseTest != "NULL" | backToControlTest !="NULL") { } } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/LinearRegressionAnalysis.R b/SilveR/Scripts/LinearRegressionAnalysis.R index 49f308615..de0b30692 100644 --- a/SilveR/Scripts/LinearRegressionAnalysis.R +++ b/SilveR/Scripts/LinearRegressionAnalysis.R @@ -1146,7 +1146,13 @@ Ref_list<-R_refs() #Bate and Clark comment HTML(refxx, align="left") -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(showANOVA=="Y") { @@ -1159,7 +1165,12 @@ if(covariatelist != "NULL") { HTML("Morris, T.R. (1999). Experimental Design and Analysis in Animal Sciences. CABI publishing. Wallingford, Oxon (UK).", align="left") } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/LogisticRegressionAnalysis.R b/SilveR/Scripts/LogisticRegressionAnalysis.R new file mode 100644 index 000000000..27317ed54 --- /dev/null +++ b/SilveR/Scripts/LogisticRegressionAnalysis.R @@ -0,0 +1,2155 @@ +#R Libraries + +suppressWarnings(library(multcomp)) +suppressWarnings(library(multcompView)) +suppressWarnings(library(car)) +suppressWarnings(library(R2HTML)) +suppressWarnings(library(lsmeans)) + +#=================================================================================================================== +# retrieve args +Args <- commandArgs(TRUE) + +#Read in data +statdata <- read.csv(Args[3], header=TRUE, sep=",") + +#Copy Args +model <- Args[4] +scatterplotModel <- as.formula(Args[5]) +covariates <- Args[6] +responseTransform <- Args[7] +covariateTransform <- Args[8] +FirstCatFactor <- Args[9] +treatFactors <- Args[10] + +contFactors <- Args[11] +contFactorTransform <- Args[12] + +blockFactors <- Args[13] +showANOVA <- Args[14] +tableOfOverallEffectTests <- Args[15] +sig <- 1 - as.numeric(Args[16]) +sig2 <- 1 - as.numeric(Args[16])/2 +effectModel <- as.formula(Args[17]) +effectModel2 <- Args[17] +selectedEffect <- Args[18] +showLSMeans <- Args[19] +allPairwiseTest <- Args[20] + +backToControlTest <- Args[21] +cntrlGroup <- Args[22] +genpvals <- Args[23] + + +#Print args +if (Diplayargs == "Y"){ + print(Args) +} + +#=================================================================================================================== +#Setup the html file and associated css file +htmlFile <- sub(".csv", ".html", Args[3]); #determine the file name of the html file +HTMLSetFile(file=htmlFile) +cssFile <- "r2html.css" +cssFile <- paste("'",cssFile,"'", sep="") #need to enclose in quotes when path has spaces in it +HTMLCSS(CSSfile = cssFile) + +#=================================================================================================================== +#V3.2 STB OCT2015 +set.seed(5041975) + +#STB 14OCT2015 +#Set contrast options for Marginal overall tests +options(contrasts=c(unordered="contr.sum", ordered="contr.poly")) + +#Graphics parameter setup +graphdata<-statdata +if (FirstCatFactor != "NULL") { + Gr_palette<-palette_FUN(FirstCatFactor) +} +Line_size2 <- Line_size +Labelz_IVS_ <- "N" +ReferenceLine <- "NULL" + +#Control group +cntrlGroup<-sub("-", "_ivs_dash_ivs_", cntrlGroup, fixed=TRUE) +if (is.numeric(statdata$mainEffect) == TRUE) { + cntrlGroup <- paste ("'",cntrlGroup,"'",sep="") +} + +statdata$mainEffect<-as.factor(statdata$mainEffect) +statdata$scatterPlotColumn<-as.factor(statdata$scatterPlotColumn) + +#Response +resp <- unlist(strsplit(model ,"~"))[1] #get the response variable from the main model + +#Number of factors in Selected effect +factno<-length(unique (strsplit(selectedEffect, "*",fixed = TRUE)[[1]])) + +#STB June 2015 - Taking a copies of the dataset +statdata_temp <-statdata + + +#calculating number of block factors +noblockfactors=0 +if (blockFactors !="NULL") { + tempblockChanges <-strsplit(blockFactors, ",") + blocklistx <- c("") + for(i in 1:length(tempblockChanges[[1]])) { + blocklistx [length(blocklistx )+1]=(tempblockChanges[[1]][i]) + } + blocklist <- blocklistx[-1] + noblockfactors<-length(blocklist) +} + +#calculating number of treatment factors +tempChanges <-strsplit(treatFactors, ",") +treatlistx <- c("") +for(i in 1:length(tempChanges[[1]])) { + treatlistx [length(treatlistx )+1]=(tempChanges[[1]][i]) +} +treatlist <- treatlistx[-1] +notreatfactors<-length(treatlist) + +#calculating number of covariates +nocovars=0 +if (covariates !="NULL") { + tempcovChanges <-strsplit(covariates, ",") + txtexpectedcovChanges <- c("") + for(i in 1:length(tempcovChanges[[1]])) { + txtexpectedcovChanges [length(txtexpectedcovChanges )+1]=(tempcovChanges[[1]][i]) + } + covlist <- txtexpectedcovChanges[-1] + nocovars<-length(covlist) +} + +#Removing illegal characters +selectedEffect<- namereplace2(selectedEffect) +selectedEffectx<- namereplace(selectedEffect) + +#replace illegal characters in variable names +YAxisTitle <-resp +if(FirstCatFactor != "NULL") { + XAxisTitleCov<-covlist +} + +#replace illegal characters in variable names +for (i in 1:10) { + YAxisTitle<-namereplace(YAxisTitle) + + if(FirstCatFactor != "NULL") { + for (i in 1: nocovars) { + XAxisTitleCov[i]<-namereplace(XAxisTitleCov[i]) + } + } +} +LS_YAxisTitle<-YAxisTitle + +# Code to create varibale to test if the highest order interaction is selected +testeffects = noblockfactors +if(FirstCatFactor != "NULL") { + testeffects = noblockfactors+nocovars +} +emodel <-strsplit(effectModel2, "+", fixed = TRUE) + +emodelChanges <- c("") +for(i in 1:length(emodel[[1]])) { + emodelChanges [length(emodelChanges )+1]=(emodel[[1]][i]) +} +noeffects<-length(emodelChanges)-2 + +#=================================================================================================================== +#Titles and description +#=================================================================================================================== +#Output HTML header +if (Module == "SMPA") { + Title <-paste(branding, " Logistic Regression Analysis", sep="") +} +HTML.title(Title, HR = 1, align = "left") + +#Software developement version warning +if (Betawarn == "Y") { + HTML.title("Warning", HR=2, align="left") + HTML(BetaMessage, align="left") +} + +#=================================================================================================================== +# Testing the factorial combinations +if (Module == "SMPA") { + ind<-1 + for (i in 1:notreatfactors) { + ind=ind*length(unique(eval(parse(text = paste("statdata$",treatlist[i]))))) + } + + if((length(unique(statdata$scatterPlotColumn))) != ind) { + HTML("Unfortunately not all combinations of the levels of the treatment factors are present in the experimental design. We recommend you manually create a new factor corresponding to the combinations of the levels of the treatment factors.", align="left") + quit() + } +} +#=================================================================================================================== + +title<-c("Response") +if(FirstCatFactor != "NULL") { + title<-paste(title, " and covariate", sep="") +} +HTML.title(title, HR=2, align="left") + +if (Module == "SMPA") { + add<-paste(c("The "), resp, " response is currently being analysed by the Logistic Regression Analysis module", sep="") +} + +if(FirstCatFactor != "NULL") { + if (nocovars == 1) { + add<-paste(add, ", with ", covlist[1] , " fitted as a covariate.", sep="") + } + if (nocovars == 2) { + add<-paste(add, ", with ", covlist[1] , " and ", covlist[2] ," fitted as covariates.", sep="") + } + if (nocovars > 2) { + add<-paste(add, ", with ", sep="") + for (i in 1: (nocovars -2)) { + add <- paste (add, covlist[i], ", " , sep="") + } + add<-paste(add, covlist[(nocovars -1)] , " and ", covlist[nocovars] , " fitted as covariates.", sep="") + } +} else { + add<-paste(add, ".", sep="") +} + +if (responseTransform != "None") { + add<-paste(add, c("The response has been "), responseTransform, " transformed prior to analysis.", sep="") +} + +if (covariates !="NULL" && covariateTransform != "None") { + if (nocovars == 1) { + add<-paste(add, c("The covariate has been "), covariateTransform, " transformed prior to analysis.", sep="") + } else { + add<-paste(add, c("The covariates have been "), covariateTransform, " transformed prior to analysis.", sep="") + } +} +HTML(add, align="left") + +#=================================================================================================================== +#Scatterplot +#=================================================================================================================== +title<-c("Scatterplot of the observed data") +if(responseTransform != "None") { + title<-paste(title, " (on the ", responseTransform, " scale)", sep="") +} +HTML.title(title, HR=2, align="left") + +scatterPlot <- sub(".html", "scatterPlot.png", htmlFile) +png(scatterPlot,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + +#STB July2013 +plotFilepdf1 <- sub(".html", "scatterPlot.pdf", htmlFile) +dev.control("enable") + +#Graphical parameters +graphdata<-statdata +graphdata$yvarrr_IVS <- eval(parse(text = paste("statdata$",resp))) +graphdata$xvarrr_IVS <-statdata$scatterPlotColumn +XAxisTitle <- "" +MainTitle2 <- "" +w_Gr_jitscat <- 0 +h_Gr_jitscat <- 0 +infiniteslope <- "Y" + +#GGPLOT2 code +NONCAT_SCAT("SMPA_PLOT") + +void <- HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", scatterPlot), Align="centre") + +#STB July2013 +if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf1), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_1<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf1) + linkToPdf1 <- paste ("Click here to view the PDF of the scatterplot", sep = "") + HTML(linkToPdf1) +} +HTML("Tip: Use this plot to identify possible outliers.", align="left") + +#=================================================================================================================== +#Covariate plot +#=================================================================================================================== +if(FirstCatFactor != "NULL") { + + if (nocovars == 1) { + title<-c("Plot of the response vs. the covariate, categorised by the primary factor") + } else { + title<-c("Plot of the response vs. the covariates, categorised by the primary factor") + } + if(responseTransform != "None" || covariateTransform != "None") { + title<-paste(title, " (on the transformed scale)", sep="") + } + HTML.title(title, HR=2, align="left") + + index <- 1 + for (i in 1:nocovars) { + ncscatterplot3 <- sub(".html", "IVS", htmlFile) + ncscatterplot3 <- paste(ncscatterplot3, index, "ncscatterplot3.png", sep = "") + png(ncscatterplot3,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdf2 <- sub(".html", "IVS", htmlFile) + plotFilepdf2 <- paste(plotFilepdf2, index, "ncscatterplot3.pdf", sep="") + dev.control("enable") + + #Graphical parameters + graphdata<-statdata + graphdata$xvarrr_IVS <- eval(parse(text = paste("statdata$",covlist[i]))) + graphdata$yvarrr_IVS <- eval(parse(text = paste("statdata$",resp))) + graphdata$l_l <- eval(parse(text = paste("statdata$",FirstCatFactor))) + graphdata$catfact <-eval(parse(text = paste("statdata$",FirstCatFactor))) + XAxisTitle <- XAxisTitleCov[i] + MainTitle2 <-"" + w_Gr_jitscat <- 0 + h_Gr_jitscat <- 0 + Legendpos <- "right" + Gr_alpha <- 1 + Line_type <-Line_type_solid + + LinearFit <- "Y" + GraphStyle <- "Overlaid" + ScatterPlot <- "Y" + + #Testing for with infinite slopes on scatterplot and re-ordering dataset if necessary + inf_slope<-IVS_F_infinite_slope() + infiniteslope <- inf_slope$infiniteslope + graphdata<-inf_slope$graphdata + graphdatax <- subset(graphdata, catvartest != "N") + graphdata<-graphdatax + + #GGPLOT2 code + OVERLAID_SCAT() + + void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", ncscatterplot3), Align="centre") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf2), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_2<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf2) + linkToPdf2 <- paste ("Click here to view the PDF of the covariate plot", sep = "") + HTML(linkToPdf2) + } + index <- index +1 + } + + #STB Aug 2011 - removing lines with infinite slope + if (infiniteslope != "N") { + title<-paste("Warning: The covariate has the same value for all subjects in one or more levels of the ", FirstCatFactor, " factor. Care should be taken if you want to include this covariate in the analysis.", sep="") + HTML(title, align="left") + } + HTML("Tip: In order to decide whether it is helpful to fit the covariate, the following should be considered:", align="left") + HTML("a) Is there a relationship between the response and the covariate? (N.B., It is only worth fitting the covariate if there is a strong positive (or negative) relationship between them: i.e., the lines on the plot should not be horizontal).", align="left") + HTML("b) Is the relationship similar for all treatments? (The lines on the plot should be approximately parallel).", align="left") + HTML("c) Is the covariate influenced by the treatment? (We assume the covariate is not influenced by the treatment and so there should be no separation of the treatment groups along the x-axis on the plot).", align="left") + HTML("These issues are discussed in more detail in Morris (1999).", align="left") +} + +#=================================================================================================================== +#building the covariate interaction model +#=================================================================================================================== +if (AssessCovariateInteractions == "Y" && FirstCatFactor != "NULL") { + + #Creating the list of model terms + CovIntModel <- c(model) + + #Adding in additional interactions + for (i in 1:notreatfactors) { + for (j in 1: nocovars) { + CovIntModel <- paste(CovIntModel, " + ", treatlist[i], " * ", covlist[j], sep="") + } + } + + #Performing the ANCOVA analysis + Covintfull<-glm(as.formula(CovIntModel), data=statdata, family="binomial", na.action = na.omit) + + #Title + warning + HTML.title("Analysis of Covariance (ANCOVA) table for assessing covariate interactions", HR=2, align="left") + + #Printing ANCOVA Table - note this code is reused from below - Type III SS included (SMPA only, IFPA uses Type I) + if (df.residual(Covintfull)<1) { + HTML("The covariate interactions have not been calculated as there are zero residual degrees of freedom when all terms are included in the statistical model." , align="left") + } + + # Stop process if residual sums of squares are too close to zero + if (deviance(Covintfull)0) { + if (Module == "SMPA") { + tempx<-Anova(Covintfull, type=c("III"))[-1,] + + if (tempx[dim(tempx)[1],1] != 0) { + temp2x<-(tempx) + col1x<-format(round(temp2x[1], 3), nsmall=3, scientific=FALSE) + col2x<-format(round(temp2x[1]/temp2x[2], 3), nsmall=3, scientific=FALSE) + col3x<-format(round(temp2x[3], 2), nsmall=2, scientific=FALSE) + col4x<-format(round(temp2x[4], 4), nsmall=4, scientific=FALSE) + + sourcex<-rownames(temp2x) + + # Residual label in ANOVA + sourcex[length(sourcex)] <- "Residual" + + #STB March 2014 - Replacing : with * in ANOVA table + for (q in 1:notreatfactors) { + sourcex<-sub(":"," * ", sourcex) + } + ivsanovax<-cbind(sourcex, col1x, temp2x[2], col2x, col3x, col4x) + + ivsanovax[length(unique(sourcex)),5]<-" " + ivsanovax[length(unique(sourcex)),6]<-" " + + #STB May 2012 capitals changed + headx<-c("Effect", "Sums of squares", "Degrees of freedom","Mean square","F-value","p-value") + colnames(ivsanovax)<-headx + + for (i in 1:(dim(ivsanovax)[1]-1)) { + if (temp2x[i,4]<0.0001) { + #STB March 2011 formatting p-values p<0.0001 + # ivsanovax[i,6]<-0.0001 + ivsanovax[i,6]=format(round(0.0001, 4), nsmall=4, scientific=FALSE) + ivsanovax[i,6]<- paste("<",ivsanovax[i,6]) + } + } + + HTML(ivsanovax, classfirstline="second", align="left", row.names = "FALSE") + HTML("Note: This table should only be used to assess the covariate interactions. The statistical model used to generate all the remaining results in this output does not include the covariate interactions.", align="left") + HTML("Comment: ANCOVA table calculated using a Type III model fit, see Armitage et al. (2001).", align="left") + } + } + } +} +#=================================================================================================================== +#ANOVA table +#=================================================================================================================== +#Analysis call +threewayfull<-glm(model, data=statdata, family = binomial(link="logit"), na.action = na.omit) + +#Testing the degrees of freedom + +if (df.residual(threewayfull)<5) { + HTML.title("Warning", HR=2, align="left") + HTML("Unfortunately the residual degrees of freedom are low (less than 5). This may make the estimation of the underlying variability, and hence the results of the statistical tests, unreliable. This can be caused by attempting to fit too many factors, and their interactions, in the statistical model. Where appropriate we recommend you fit some of the 'Treatment' factors as 'Other design' factors. This will remove their interactions from the statistical model and therefore increase the residual degrees of freedom.", align="left") +} + +#ANOVA Table +if(showANOVA=="Y") { + if(FirstCatFactor != "NULL") { + HTML.title("Analysis of deviance table", HR=2, align="left") + } else { + HTML.title("Analysis of deviance table", HR=2, align="left") + } + + # Stop process if residual sums of squares are too close to zero + if (deviance(threewayfull)2) { + if(FirstCatFactor != "NULL") { + + #STB July 2013 change wording to remove effects + add<-paste(add, ": There are no statistically significant overall differences between the levels of any of the terms in the Analysis of deviance table", sep="") + } else { + add<-paste(add, ": There are no statistically significant overall differences between the levels of any of the terms in the Analysis of deviance table", sep="") + } + } + if (dim(ivsanova)[1]<=2) { + add<-paste(add, ": There is no statistically significant overall difference between the levels of the treatment factor", sep="") + } + } + + add<-paste(add, ". ", sep="") + + HTML(add, align="left") + if(FirstCatFactor != "NULL") { + HTML("Tip: While it is a good idea to consider the overall tests in the Analysis of deviance table, we should not rely on them when deciding whether or not to make pairwise comparisons.", align="left") + } else { + HTML("Tip: While it is a good idea to consider the overall tests in the Analysis of deviance table, we should not rely on them when deciding whether or not to make pairwise comparisons.", align="left") + } +} + + +#=================================================================================================================== +#Fixed effect coefficients +#=================================================================================================================== +if (ShowCoeff == "Y") { + HTML.title("Model coefficients", HR=2, align="left") + threewayfull<-glm(model, data=statdata, family = binomial(link="logit"), na.action = na.omit) + coeffs<- summary(threewayfull)$coefficient + + col1<-format(round(coeffs[,1], 4), nsmall=4, scientific=FALSE) + col2<-format(round(coeffs[,2], 4), nsmall=4, scientific=FALSE) + col3<-format(round(coeffs[,3], 2), nsmall=2, scientific=FALSE) + col4<-format(round(coeffs[,4], 4), nsmall=4, scientific=FALSE) + coeffsx <- cbind(col1, col2, col3, col4) + colnames(coeffsx)<-c("Estimate", "Std. Error", "z-value", "p-value") + for (i in 1:(dim(coeffsx)[1])) { + if (coeffs[i,4]<0.0001) { + coeffsx[i,4]=format(round(0.0001, 4), nsmall=4, scientific=FALSE) + coeffsx[i,4]<- paste("<",coeffsx[i,4]) + } + } + HTML(coeffsx, classfirstline="second", align="left", row.names = "FALSE") +} + +#=================================================================================================================== +#Covariate correlation table +#=================================================================================================================== +#if (CovariateRegressionCoefficients == "Y" && FirstCatFactor != "NULL") { +# +# if (nocovars == 1) { +# HTML.title("Covariate regression coefficient", HR=2, align="left") +# } else { +# HTML.title("Covariate regression coefficients", HR=2, align="left") +# } +# covtable_1<-coef(summary(threewayfull)) +# covtable<-data.frame(covtable_1)[c(2:(nocovars+1)),] +# +# names <- rownames(covtable) +# Estimate <-format(round(covtable$Estimate, 3), nsmall=3, scientific=FALSE) +# StdError <-format(round(covtable$Std..Error, 3), nsmall=3, scientific=FALSE) +# tvalue <-format(round(covtable$t.value, 2), nsmall=2, scientific=FALSE) +# Prt <-format(round(covtable$Pr...t.., 4), nsmall=4, scientific=FALSE) +# +# covtable2 <-cbind(names, Estimate, StdError, tvalue, Prt) +# +# for (k in 1:(dim(covtable2)[1])) { +# if (as.numeric(covtable[k,4])<0.0001) { +# #STB March 2011 formatting p-values p<0.0001 +# #ivsanova[i,9]<-0.0001 +# covtable2[k,4]= "<0.0001" +# } +# } +# colnames(covtable2)<-c("Covariate", "Estimate", "Std error", "t-value", "p-value") +# HTML(covtable2, classfirstline="second", align="left", row.names = "FALSE") +#} + +#=================================================================================================================== +#Diagnostic plots +#=================================================================================================================== +#if((showPRPlot=="Y" && showNormPlot=="N") || (showPRPlot=="N" && showNormPlot=="Y") ) { +# HTML.title("Diagnostic plot", HR=2, align="left") +#} +#if(showPRPlot=="Y" && showNormPlot=="Y") { +# HTML.title("Diagnostic plots", HR=2, align="left") +#} + +#Residual plots +if(showPRPlot=="Y") { + HTML.title("Residuals vs. predicted plot", HR=2, align="left") + + residualPlot <- sub(".html", "residualplot.png", htmlFile) + png(residualPlot,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdf3 <- sub(".html", "residualplot.pdf", htmlFile) + dev.control("enable") + + #Graphical parameters + graphdata<-data.frame(cbind(fitted(threewayfull),rstudent(threewayfull))) + graphdata$yvarrr_IVS <- graphdata$X2 + graphdata$xvarrr_IVS <- graphdata$X1 + XAxisTitle <- "Predicted values" + YAxisTitle <- "Externally Studentised residuals" + MainTitle2 <- " " + w_Gr_jitscat <- 0 + h_Gr_jitscat <- 0 + infiniteslope <- "Y" + + Gr_line_type<-Line_type_dashed + + Line_size2 <- Line_size + Line_size <- 0.5 + + #GGPLOT2 code + NONCAT_SCAT("RESIDPLOT") + + MainTitle2 <- "" + + void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", residualPlot), Align="centre") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf3), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_3<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf3) + linkToPdf3 <- paste ("Click here to view the PDF of the residuals vs. predicted plot", sep = "") + HTML(linkToPdf3) + } +# HTML("Tip: On this plot look to see if the spread of the points increases as the predicted values increase. If so the response may need transforming.", align="left") +# HTML("Tip: Any observation with a residual less than -3 or greater than 3 (SD) should be investigated as a possible outlier.", align="left") + HTML("Tip: The residuals should be unbiased and homoscedastic.", align="left") +} + +#Normality plots +#if(showNormPlot=="Y") { +# HTML.title("Normal probability plot", HR=3, align="left") +# +# normPlot <- sub(".html", "normplot.png", htmlFile) +# png(normPlot,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) +# +# #STB July2013 +# plotFilepdf4 <- sub(".html", "normplot.pdf", htmlFile) +# dev.control("enable") +# +# #Graphical parameters +# te<-qqnorm(resid(threewayfull)) +# graphdata<-data.frame(te$x,te$y) +# graphdata$xvarrr_IVS <-graphdata$te.x +# graphdata$yvarrr_IVS <-graphdata$te.y +# YAxisTitle <-"Sample Quantiles" +# XAxisTitle <-"Theoretical Quantiles" +# MainTitle2 <- " " +# w_Gr_jitscat <- 0 +# h_Gr_jitscat <- 0 +# infiniteslope <- "N" +# LinearFit <- "Y" +# +# Gr_line_type<-Line_type_dashed +# Line_size <- 0.5 +# Gr_alpha <- 1 +# Line_type <-Line_type_dashed +# +# #GGPLOT2 code +# NONCAT_SCAT("QQPLOT") +# +# MainTitle2 <- "" +# #=================================================================================================================== +# void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", normPlot), Align="left") +# +# #STB July2013 +# if (pdfout=="Y") { +# pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf4), height = pdfheight, width = pdfwidth) +# dev.set(2) +# dev.copy(which=3) +# dev.off(2) +# dev.off(3) +# pdfFile_4<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf4) +# linkToPdf4 <- paste ("Click here to view the PDF of the normal probability plot", sep = "") +# HTML(linkToPdf4) +# } +# HTML("Tip: Check that the points lie along the dotted line. If not then the data may be non-normally distributed.", align="left") +#} + +#=================================================================================================================== +#Odds Ratios +#=================================================================================================================== +CITitle<-paste("Table of log odds ratios with ",(sig*100),"% confidence intervals",sep="") +HTML.title(CITitle, HR=2, align="left") + +ORtable<-exp(cbind(OR = coef(threewayfull), confint(threewayfull))) +names<-c() + names[1]<-"Odds ratio" + names[2]<-paste("Lower ",(sig*100),"% CI",sep="") + names[3]<-paste("Upper ",(sig*100),"% CI",sep="") + + colnames(ORtable)<-names + +HTML(ORtable, classfirstline="second", align="left", row.names = "FALSE") + + +#=================================================================================================================== +#Plotting the model +#=================================================================================================================== + + HTML.title("Scatterplot of observed data including the predicted fit", HR=2, align="left") + + scatterPlotx <- sub(".html", "scatterPlotx.png", htmlFile) + png(scatterPlotx,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdfx <- sub(".html", "scatterPlotx.pdf", htmlFile) + dev.control("enable") + + graphdata<- data.frame(matrix(ncol = 0, nrow = dim(statdata)[1])) + graphdata$xaxisvarrr_ivs<-as.numeric(eval(parse(text = paste("statdata$", selectedEffect)))) + graphdata$yaxisvarrr_ivs<-eval(parse(text = paste("statdata$",resp))) + graphdata$Type <- "Raw data" + + graphdata2<- data.frame(matrix(ncol = 0, nrow = dim(statdata)[1])) + graphdata2$yaxisvarrr_ivs<-predict(threewayfull,type = "response") + graphdata2$xaxisvarrr_ivs<-as.numeric(eval(parse(text = paste("statdata$", selectedEffect)))) + graphdata2$Type <- "Prediction curve" + + finaldata<-rbind(graphdata,graphdata2) + + + #Creating final dataset +# Type <- c(1:length(bv)) +# for (i in 1:length(bv)) {Type[i]="Prediction curve"} +# finaldata<-data.frame(cbind(graphdata,bv, Type)) + colnames(finaldata)<-c(selectedEffect, "Response", "Type") + + +# tempdata2<-graphdata[,c("xaxisvarrr_ivs", "yaxisvarrr_ivs")] + +# #STB Feb 2016 - Replace length(tempdata2) with dim(tempdata2)[1] +# Type <- c(1:dim(tempdata2)[1]) +# for (i in 1:dim(tempdata2)[1]) { +# Type[i]=" Assay standards" +# } +# tempdata2<-data.frame(tempdata2, Type) +# colnames(tempdata2)<-c("Dose", "Response", "Type") +# finaldata<-rbind(tempdata, tempdata2) + + #New colour palette for this plot +# Col_palette <- c("#E41A1C" ,"black") +# BW_palette <- c("white", "black") +# +# #BandW - Line included +# if (bandw == "Y") { +# Gr_palette <-BW_palette +# } else { +# Gr_palette <-Col_palette +# } +# + Line_type <- Line_type_solid + MainTitle2<-"" + XAxisTitle <- selectedEffect + YAxisTitle <- resp + + + #GGPlot2 code + Logregplot() + + #=================================================================================================================== + void <- HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", scatterPlotx), Align="centre") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdfx), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFilex<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdfx) + linkToPdf <- paste ("Click here to view the PDF of the scatterplot including predicted fit", sep = "") + HTML(linkToPdfx) + } + + +quit() +#=================================================================================================================== +#LS Means plot and table +#=================================================================================================================== +if(showLSMeans =="Y") { + #STB May 2012 Updating "least square (predicted) means" + CITitle<-paste("Plot of the least square (predicted) means with ",(sig*100),"% confidence intervals",sep="") + HTML.title(CITitle, HR=2, align="left") + + #Calculate LS Means dataset + tabs<-lsmeans(threewayfull,eval(parse(text = paste("~",selectedEffect))), data=statdata) + x<-summary(tabs) + + if (Module == "IFPA") { + x<-na.omit(x) + } + + x$Mean <-x$lsmean + for (i in 1:dim(x)[1]) { + x$Lower[i] <- x$lsmean[i] - x$SE[i]*qt(sig2, x$df[i]) + x$Upper[i] <- x$lsmean[i] + x$SE[i]*qt(sig2, x$df[i]) + } + graphdata<-subset(x, select = -c(SE, df,lsmean, lower.CL, upper.CL )) + + names <- c() + for (l in 1:factno) { + names[l] <- paste(unique (strsplit(selectedEffect, "*",fixed = TRUE)[[1]])[l], " Level", sep = "") + } + names[factno+1]<-"Mean" + names[factno+2]<-"Lower" + names[factno+3]<-"Upper" + colnames(graphdata)<-names + + #Calculating dataset for plotting - including a Group factor for higher order interactions + graphdata$Group_IVSq_ <- graphdata[,1] + + if (factno > 1) { + for (y in 2:factno) { + graphdata$Group_IVSq_ <- paste(graphdata$Group_IVSq_, ", ", graphdata[,y], sep = "") + } + } + +#other parameters for the plot + Gr_alpha <- 0 + if (bandw != "N") { + Gr_fill <- BW_fill + } else { + Gr_fill <- Col_fill + } + YAxisTitle <- LS_YAxisTitle + XAxisTitle <- "Group" + MainTitle2 <- "" + Line_size <- Line_size2 + + #Code for LS MEans plot + meanPlot <- sub(".html", "meanplot.png", htmlFile) + png(meanPlot,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdf5 <- sub(".html", "meanplot.pdf", htmlFile) + dev.control("enable") + + #GGPLOT2 code + if (factno == 1 || factno > 4) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + LSMPLOT_1() + } + + if (factno == 2) { + if (length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,2])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$jj_1 <- graphdata[,1] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,2], sep = "") + + } else { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$jj_1 <- graphdata[,2] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,1], sep = "") + } + Gr_palette<- palette_FUN("jj_2") + LSMPLOT_2("none") + } + + if (factno == 3) { + if (length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,2]))) && length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,3])) )) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$jj_1 <- graphdata[,1] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,3], sep = "") + + } else if (length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,1]))) && length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,3]))) ) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$jj_1 <- graphdata[,2] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,3], sep = "") + + } else { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$jj_1 <- graphdata[,3] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,2], sep = "") + } + Gr_palette<- palette_FUN("jj_2") + LSMPLOT_2("three") + } + + if (factno == 4) { + if (length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,2]))) && length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,3]))) && length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,4])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$jj_1 <- graphdata[,1] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,3], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "= ",graphdata[,4], sep = "") + + } else if (length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,1]))) && length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,3]))) && length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,4])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$jj_1 <- graphdata[,2] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,3], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "= ",graphdata[,4], sep = "") + + } else if (length(unique(levels(graphdata[,3]))) > length(unique(levels(graphdata[,1]))) && length(unique(levels(graphdata[,3]))) > length(unique(levels(graphdata[,2]))) && length(unique(levels(graphdata[,3]))) > length(unique(levels(graphdata[,4])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$jj_1 <- graphdata[,3] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "= ",graphdata[,4], sep = "") + + } else { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$jj_1 <- graphdata[,4] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "= ",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "= ",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "= ",graphdata[,3], sep = "") + } + Gr_palette<- palette_FUN("jj_2") + LSMPLOT_2("four") + } + + void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", meanPlot), Align="left") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf5), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_5<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf5) + linkToPdf5 <- paste ("Click here to view the PDF of the plot of least square (predicted) means", sep = "") + HTML(linkToPdf5) + } +} +#=================================================================================================================== +#Table of Least Square means +#=================================================================================================================== +if(showLSMeans =="Y") { + #STB May 2012 Updating "least square (predicted) means" + CITitle2<-paste("Table of the least square (predicted) means with ",(sig*100),"% confidence intervals",sep="") + HTML.title(CITitle2, HR=2, align="left") + + #Calculate LS Means Table + x<-summary(tabs) + + if (Module == "IFPA") { + x<-na.omit(x) + } + + x$Mean <-format(round(x$lsmean, 3), nsmall=3, scientific=FALSE) + for (i in 1:dim(x)[1]) { + x$Lower[i] <- format(round(x$lsmean[i] - x$SE[i]*qt(sig2, x$df[i]), 3), nsmall=3, scientific=FALSE) + x$Upper[i] <- format(round(x$lsmean[i] + x$SE[i]*qt(sig2, x$df[i]), 3), nsmall=3, scientific=FALSE) + } + + names <- c("") + for (l in 1:factno) + { + names[l+1] <- paste(unique (strsplit(selectedEffect, "*",fixed = TRUE)[[1]])[l], " ", sep = "") + } + + x2<-subset(x, select = -c(SE, df,lsmean, lower.CL, upper.CL )) + + observ <- data.frame(c(1:dim(x)[1])) + x2 <- cbind(observ, x2) + + names[1]<-"Mean ID" + names[factno+2]<-"Mean" + names[factno+3]<-paste("Lower ",(sig*100),"% CI",sep="") + names[factno+4]<-paste("Upper ",(sig*100),"% CI",sep="") + + colnames(x2)<-names + HTML(x2, classfirstline="second", align="left", row.names = "FALSE") +} + +#=================================================================================================================== +#Back transformed geometric means plot and table +#=================================================================================================================== +if(GeomDisplay == "Y" && showLSMeans =="Y" && (responseTransform =="Log10"||responseTransform =="Loge")) { + CITitle<-paste("Plot of the back-transformed geometric means with ",(sig*100),"% confidence intervals",sep="") + HTML.title(CITitle, HR=2, align="left") + HTML("As the response was log transformed prior to analysis the least square (predicted) means are presented on the log scale. These results can be back transformed onto the original scale. These are known as the back-transformed geometric means.", align="left") + +#=================================================================================================================== +#LSMeans plot +#=================================================================================================================== +#Calculate LS Means dataset + tabs<-lsmeans(threewayfull,eval(parse(text = paste("~",selectedEffect))), data=statdata) + x<-summary(tabs) + + if (Module == "IFPA") { + x<-na.omit(x) + } + + if (responseTransform =="Log10") { + x$Mean <-10^(x$lsmean) + for (i in 1:dim(x)[1]) { + x$Lower[i] <- 10^(x$lsmean[i] - x$SE[i]*qt(sig2, x$df[i])) + x$Upper[i] <- 10^(x$lsmean[i] + x$SE[i]*qt(sig2, x$df[i])) + } + } + + if (responseTransform =="Loge") { + x$Mean <-exp(x$lsmean) + for (i in 1:dim(x)[1]) { + x$Lower[i] <- exp(x$lsmean[i] - x$SE[i]*qt(sig2, x$df[i])) + x$Upper[i] <- exp(x$lsmean[i] + x$SE[i]*qt(sig2, x$df[i])) + } + } + graphdata<-subset(x, select = -c(SE, df,lsmean, lower.CL, upper.CL )) + + names <- c() + for (l in 1:factno) { + names[l] <- paste(unique (strsplit(selectedEffect, "*",fixed = TRUE)[[1]])[l], " Level", sep = "") + } + names[factno+1]<-"Mean" + names[factno+2]<-"Lower" + names[factno+3]<-"Upper" + + colnames(graphdata)<-names + + #Calculating dataset for plotting - including a Group factor for higher order interactions + graphdata$Group_IVSq_ <- graphdata[,1] + + if (factno > 1) { + for (y in 2:factno) { + graphdata$Group_IVSq_ <- paste(graphdata$Group_IVSq_, ", ", graphdata[,y], sep = "") + } + } + + #other parameters for the plot + Gr_alpha <- 0 + if (bandw != "N") { + Gr_fill <- BW_fill + } else { + Gr_fill <- Col_fill + } + YAxisTitle <- LS_YAxisTitle + XAxisTitle <- "Group" + MainTitle2 <- "" + #Gr_line <-"black" + Line_size <- Line_size2 + + #Code for LS MEans plot + meanPlotq <- sub(".html", "meanplotq.png", htmlFile) + png(meanPlotq,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdf5q <- sub(".html", "meanplotq.pdf", htmlFile) + dev.control("enable") + + #GGPLOT2 code + if (factno == 1 || factno > 4) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + LSMPLOT_1() + } + + if (factno == 2) { + if (length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,2])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$jj_1 <- graphdata[,1] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,2], sep = "") + } else { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$jj_1 <- graphdata[,2] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,1], sep = "") + } + Gr_palette<- palette_FUN("jj_2") + LSMPLOT_2("none") + } + + if (factno == 3) { + if (length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,2]))) && length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,3])) )) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$jj_1 <- graphdata[,1] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,3], sep = "") + + } else if (length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,1]))) && length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,3]))) ) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$jj_1 <- graphdata[,2] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,3], sep = "") + + } else { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$jj_1 <- graphdata[,3] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,2], sep = "") + } + Gr_palette<- palette_FUN("jj_2") + LSMPLOT_2("three") + } + + if (factno == 4) { + if (length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,2]))) && length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,3]))) && length(unique(levels(graphdata[,1]))) > length(unique(levels(graphdata[,4])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$jj_1 <- graphdata[,1] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,3], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "=",graphdata[,4], sep = "") + + } else if (length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,1]))) && length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,3]))) && length(unique(levels(graphdata[,2]))) > length(unique(levels(graphdata[,4])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$jj_1 <- graphdata[,2] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,3], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "=",graphdata[,4], sep = "") + + } else if (length(unique(levels(graphdata[,3]))) > length(unique(levels(graphdata[,1]))) && length(unique(levels(graphdata[,3]))) > length(unique(levels(graphdata[,2]))) && length(unique(levels(graphdata[,3]))) > length(unique(levels(graphdata[,4])))) { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$jj_1 <- graphdata[,3] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "=",graphdata[,4], sep = "") + + } else { + XAxisTitle <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[4] + graphdata$jj_1 <- graphdata[,4] + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[1] + graphdata$catzz<-legendz + graphdata$jj_2 <- paste(graphdata$catzz, "=",graphdata[,1], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[2] + graphdata$catzz<-legendz + graphdata$jj_3 <- paste(graphdata$catzz, "=",graphdata[,2], sep = "") + legendz <- unique (strsplit(selectedEffectx, "*",fixed = TRUE)[[1]])[3] + graphdata$catzz<-legendz + graphdata$jj_4 <- paste(graphdata$catzz, "=",graphdata[,3], sep = "") + } + Gr_palette<- palette_FUN("jj_2") + LSMPLOT_2("four") + } + + void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", meanPlotq), Align="left") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf5q), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_5q<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf5q) + linkToPdf5q <- paste ("Click here to view the PDF of the plot of back transformed geometric means", sep = "") + HTML(linkToPdf5q) + } +} +#=================================================================================================================== +#Table of back transformed means +#=================================================================================================================== +if(GeomDisplay == "Y" && showLSMeans =="Y" && (responseTransform =="Log10"||responseTransform =="Loge")) { + + #STB May 2012 Updating "least square (predicted) means" + CITitle2<-paste("Table of the back-transformed geometric means with ",(sig*100),"% confidence intervals",sep="") + HTML.title(CITitle2, HR=2, align="left") + + #Calculate LS Means Table + x<-summary(tabs) + + if (Module == "IFPA") { + x<-na.omit(x) + } + + if (responseTransform =="Log10") { + x$Mean <-format(round(10^(x$lsmean), 3), nsmall=3, scientific=FALSE) + for (i in 1:dim(x)[1]) { + x$Lower[i] <- format(round(10^(x$lsmean[i] - x$SE[i]*qt(sig2, x$df[i])), 3), nsmall=3, scientific=FALSE) + x$Upper[i] <- format(round(10^(x$lsmean[i] + x$SE[i]*qt(sig2, x$df[i])), 3), nsmall=3, scientific=FALSE) + } + } + + if (responseTransform =="Loge") { + x$Mean <-format(round(exp(x$lsmean), 3), nsmall=3, scientific=FALSE) + for (i in 1:dim(x)[1]) { + x$Lower[i] <- format(round(exp(x$lsmean[i] - x$SE[i]*qt(sig2, x$df[i])), 3), nsmall=3, scientific=FALSE) + x$Upper[i] <- format(round(exp(x$lsmean[i] + x$SE[i]*qt(sig2, x$df[i])), 3), nsmall=3, scientific=FALSE) + } + } + + names <- c("") + for (l in 1:factno) + { + names[l+1] <- paste(unique (strsplit(selectedEffect, "*",fixed = TRUE)[[1]])[l], " ", sep = "") + } + + x2<-subset(x, select = -c(SE, df,lsmean, lower.CL, upper.CL )) + + observ <- data.frame(c(1:dim(x)[1])) + x2 <- cbind(observ, x2) + + names[1]<-"Mean ID" + names[factno+2]<-"Mean" + names[factno+3]<-paste("Lower ",(sig*100),"% CI",sep="") + names[factno+4]<-paste("Upper ",(sig*100),"% CI",sep="") + + colnames(x2)<-names + HTML(x2, classfirstline="second", align="left", row.names = "FALSE") +} + +#=================================================================================================================== +#All Pairwise tests +#=================================================================================================================== +#STB Jun 2015 +#Creating dataset without dashes in +ivs_num_ivs <- rep(1:dim(statdata)[1]) +ivs_char_ivs <- rep(factor(LETTERS[1:dim(statdata)[1]]), 1) +statdata_temp2<- cbind(statdata_temp, ivs_num_ivs,ivs_char_ivs ) +statdata_num<- statdata_temp2[,sapply(statdata_temp2,is.numeric)] +statdata_char<- statdata_temp2[,!sapply(statdata_temp2,is.numeric)] +statdata_char2 <- as.data.frame(sapply(statdata_char,gsub,pattern="-",replacement="_ivs_dash_ivs_")) +statdata<- data.frame(cbind(statdata_num, statdata_char2)) + +#All pairwise tests +if(allPairwiseTest != "NULL") { + + #All pairwise test options + allPairwiseTestText = allPairwiseTest + if(allPairwiseTestText=="Unadjusted (LSD)") { + allPairwiseTest= "none" + } else if (allPairwiseTestText=="Holm") { + allPairwiseTest= "holm" + } else if (allPairwiseTestText=="Hochberg") { + allPairwiseTest= "hochberg" + } else if (allPairwiseTestText=="Hommel") { + allPairwiseTest= "hommel" + } else if (allPairwiseTestText=="Bonferroni") { + allPairwiseTest= "bonferroni" + } else if (allPairwiseTestText=="Benjamini-Hochberg") { + allPairwiseTest= "BH" + } + + if (allPairwiseTest== "none") { + add<-paste(c("All pairwise comparisons without adjustment for multiplicity (LSD test)")) + } else { + add<-paste("All pairwise comparisons using ", allPairwiseTestText, "'s procedure", sep="") + } + HTML.title(add, HR=2, align="left") + + if (Module == "SMPA") { + mult<-glht(lm(model, data=statdata, na.action = na.omit), linfct=lsm(eval(parse(text = paste("pairwise ~",selectedEffect))))) + } + if (Module == "IFPA") { + mult<-glht(lm(effectModel, data=statdata, na.action = na.omit), linfct=mcp(mainEffect="Tukey")) + } + multci<-confint(mult, level=sig, calpha = univariate_calpha()) + tablen<-length(unique(rownames(multci$confint))) + + if (allPairwiseTest== "Tukey") { + if ( tablen >1 ) { + set.seed(3) + pwc = lsmeans(lm(model, data=statdata, na.action = na.omit) , eval(parse(text = paste("pairwise ~",selectedEffect))), adjust = "tukey") + pvals<-cld(pwc$contrast, sort=FALSE)[,6] + sigma<-cld(pwc$contrast, sort=FALSE)[,3] + } else { + # Bug if Tukey selected and only 2 levels of selected effect + multp<-summary(mult, test=adjusted("none")) + pvals<-multp$test$pvalues + sigma<-multp$test$sigma + } + } else { + multp<-summary(mult, test=adjusted(allPairwiseTest)) + pvals<-multp$test$pvalues + sigma<-multp$test$sigma + } + + tabs<-matrix(nrow=tablen, ncol=5) + for (i in 1:tablen) { + #STB Dec 2011 increasing means to 3dp + tabs[i,1]=format(round(multci$confint[i], 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabs[i,2]=format(round(multci$confint[i+tablen], 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabs[i,3]=format(round(multci$confint[i+2*tablen], 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabs[i,4]=format(round(sigma[i], 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabs[i,5]=format(round(pvals[i], 4), nsmall=4, scientific=FALSE) + } + for (i in 1:tablen) { + if (pvals[i]<0.0001) { + #STB March 2011 - formatting p-values p<0.0001 + #tabs[i,5]<-0.0001 + tabs[i,5]=format(round(0.0001, 4), nsmall=4, scientific=FALSE) + tabs[i,5]<- paste("<",tabs[i,5]) + } + } + + rows<-rownames(multci$confint) +#STB 2019 +# rows<-sub(" - "," vs. ", rows, fixed=TRUE) + + #STB June 2015 + for (i in 1:1000) { + rows<-sub("_ivs_dash_ivs_"," - ", rows, fixed=TRUE) + } + + lowerCI<-paste(" Lower ",(sig*100),"% CI ",sep="") + upperCI<-paste(" Upper ",(sig*100),"% CI ",sep="") + + tabls<-cbind(rows, tabs) + colnames(tabls)<-c("Comparison", "Difference", lowerCI, upperCI, "Std error", "p-value") + HTML(tabls, classfirstline="second", align="left", row.names = "FALSE") + rownames(tabls) <- rows + +#=================================================================================================================== + #STB March 2014 - Creating a dataset of p-values + + if (genpvals == "Y" && allPairwiseTest == "none") { + comparisons <- sub(".csv", "comparisons.csv", Args[3]) + for (i in 1:tablen) { + tabs[i,5]=pvals[i] + } + tabsxx<- data.frame(tabs[,5]) + for (i in 1:20) { + rows<-sub(","," and ", rows, fixed=TRUE) + } + tabsxx<-cbind(rows, tabsxx) + colnames(tabsxx)<-c("Comparison", "p-value") + row.names(tabsxx) <- seq(nrow(tabsxx)) + + write.csv(tabsxx, file = sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", comparisons), row.names=FALSE) + } +#=================================================================================================================== + #Conclusion + add<-paste(c("Conclusion")) + inte<-1 + for(i in 1:(dim(tabls)[1])) { + if (tabls[i,6]<= (1-sig)) { + if (inte==1) { + inte<-inte+1 + add<-paste(add, ": The following pairwise tests are statistically significantly different at the ", 100*(1-sig), "% level: ", rownames(tabls)[i], sep="") + } else { + inte<-inte+1 + add<-paste(add, ", ", rownames(tabls)[i], sep="") + } + } + } + if (inte==1) { + if (tablen >1) { + add<-paste(add, ": There are no statistically significant pairwise differences.", sep="") + } else { + add<-paste(add, ": The pairwise difference is not statistically significant.", sep="") + } + } else { + add<-paste(add, ". ", sep="") + } + HTML(add, align="left") + +#=================================================================================================================== + if (allPairwiseTest == "Tukey") { + HTML("Warning: The results of Tukey's procedure are approximate if the sample sizes are not equal.", align="left") + } +# if(length(grep("\\*", effectModel)) == 0 && length(grep("\\+", effectModel)) == 0 && length(grep("\\+", model)) == 1) { +# add2<-paste(c(" "), " ", sep="") +# HTML(add2, align="left") +# } else if (length(grep("\\*", model)) == 0 && length(grep("\\+", effectModel)) == 0 && length(grep("\\+", model)) == 0) { +# add2<-paste(c(" "), " ", sep="") +# HTML.title(" ", HR=2, align="left") +# HTML(add2, align="left") +# } + if (noeffects>testeffects) { + HTML("Warning: It is not advisable to draw statistical inferences about a factor/interaction in the presence of a significant higher-order interaction involving that factor/interaction. ", align="left") +#In the above table we have assumed that certain higher-order interactions are not significant and have removed them from the statistical model, see log for more details.", align="left") + } + + + if (tablen >1) { + if (allPairwiseTest == "none") { + HTML("Warning: As these tests are not adjusted for multiplicity there is a risk of generating false positive results. Only use the pairwise tests you planned to make a-priori, these are the so called planned comparisons, see Snedecor and Cochran (1989).", align="left") + } else { + addx <- paste("Warning: This procedure makes an adjustment assuming you want to make all pairwise comparisons. If this is not the case then these tests may be unduly conservative. You may wish to use planned comparisons (using unadjusted p-values) instead, see Snedecor and Cochran (1989), or make a manual adjustment to the unadjusted p-values using the ", branding , " P-value Adjustment module.", sep="") + HTML(addx, align="left") + } + } + if (allPairwiseTest != "none") { + HTML("Note: The confidence intervals quoted are not adjusted for multiplicity.", align="left") + } +} + +#=================================================================================================================== +#Back transformed geometric means table +#=================================================================================================================== +if(allPairwiseTest != "NULL") { + if(GeomDisplay == "Y" && (responseTransform =="Log10"||responseTransform =="Loge")) { + HTML.title("All pairwise comparisons as back-transformed ratios", HR=2, align="left") + HTML("As the response was log transformed prior to analysis the differences between the least square (predicted) means are presented on the log scale. These results can be back-transformed onto the original scale, where differences on the log scale become ratios when back-transformed.", align="left") + + #Creating the table + tabsx<-matrix(nrow=tablen, ncol=3) + if (responseTransform =="Log10") { + for (i in 1:tablen) { + tabsx[i,1]=format(round(10^(multci$confint[i]), 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabsx[i,2]=format(round(10^(multci$confint[i+tablen]), 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabsx[i,3]=format(round(10^(multci$confint[i+2*tablen]), 3), nsmall=3, scientific=FALSE) + } + } + if (responseTransform =="Loge") { + for (i in 1:tablen) { + tabsx[i,1]=format(round(exp(multci$confint[i]), 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabsx[i,2]=format(round(exp(multci$confint[i+tablen]), 3), nsmall=3, scientific=FALSE) + } + for (i in 1:tablen) { + tabsx[i,3]=format(round(exp(multci$confint[i+2*tablen]), 3), nsmall=3, scientific=FALSE) + } + } + + rowsx<-rownames(multci$confint) + rowsx<-sub(" - "," / ", rowsx, fixed=TRUE) + + #STB June 2015 + for (i in 1:100) { + rowsx<-sub("_ivs_dash_ivs_"," - ", rowsx, fixed=TRUE) + } + + lowerCI<-paste(" Lower ",(sig*100),"% CI ",sep="") + upperCI<-paste(" Upper ",(sig*100),"% CI ",sep="") + tablsx<-cbind(rowsx, tabsx) + colnames(tablsx)<-c("Comparison","Ratio", lowerCI, upperCI) + HTML(tablsx, classfirstline="second", align="left", row.names = "FALSE") + } +} + +#=================================================================================================================== +#Back to control comparisons +#=================================================================================================================== +backToControlTestText <- backToControlTest + +if(backToControlTestText=="Unadjusted (LSD)") { + backToControlTest= "none" +} else if (backToControlTestText=="Holm") { + backToControlTest= "holm" +} else if (backToControlTestText=="Hochberg") { + backToControlTest= "hochberg" +} else if (backToControlTestText=="Hommel") { + backToControlTest= "hommel" +} else if (backToControlTestText=="Bonferroni") { + backToControlTest= "bonferroni" +} else if (backToControlTestText=="Benjamini-Hochberg") { + backToControlTest= "BH" +} + +#=================================================================================================================== +#All to one comparisons +if(backToControlTest != "NULL") { + + #Title + if (backToControlTest== "none") { + add<-paste(c("All to one comparisons without adjustment for multiplicity (LSD test)")) + } else { + add<-paste("All to one comparisons using ", backToControlTestText, "'s procedure", sep="") + } + HTML.title(add, HR=2, align="left") + + #Creating the table of unadjusted p-values + #Generate all pairwise comparisons, unadjusted for multiplicity + + mult<-glht(lm(model, data=statdata, na.action = na.omit), linfct=lsm(eval(parse(text = paste("pairwise ~",selectedEffect))))) + multci<-confint(mult, level=sig, calpha = univariate_calpha()) + multp<-summary(mult, test=adjusted("none")) + + #Creating a matrix of the differences + comps<-c(rownames(multci$confint)) + diffz <-matrix(nrow=length(comps), ncol=2) + for (g in 1:length(comps)) { + comps2<-unlist(strsplit(comps[g]," - " ))[1] + comps3<-unlist(strsplit(comps[g]," - " ))[2] + diffz[g,1] = comps2 + diffz[g,2] = comps3 + } + + #Creating the unadjusted full column + pvals<-multp$test$pvalues + sigma<-multp$test$sigma + tstats<-Mod(as.numeric(multp$test$tstat)) + tablen<-length(unique(rownames(multci$confint))) + tabs<-data.frame(nrow=tablen, ncol=15) + + for (i in 1:tablen) { + tabs[i,1]=multci$confint[i] + } + for (i in 1:tablen) { + tabs[i,2]=multci$confint[i+tablen] + } + for (i in 1:tablen) { + tabs[i,3]=multci$confint[i+2*tablen] + } + for (i in 1:tablen) { + tabs[i,4]=sigma[i] + } + for (i in 1:tablen) { + tabs[i,5]=pvals[i] + } + for (i in 1:tablen) { + tabs[i,6]= diffz[i,1] + } + for (i in 1:tablen) { + tabs[i,7]= diffz[i,2] + } + for (i in 1:tablen) { + tabs[i,8]= tstats[i] + } + tabs2<- tabs + + for ( i in 1:tablen) { + if (tabs2[i,6] == cntrlGroup) { + tabs2[i,9] = -1*tabs2[i,1] + tabs2[i,10] = -1*tabs2[i,3] + tabs2[i,11] = -1*tabs2[i,2] + tabs2[i,12] = tabs2[i,7] + tabs2[i,13] = tabs2[i,6] + } else { + tabs2[i,9] = tabs2[i,1] + tabs2[i,10] = tabs2[i,2] + tabs2[i,11] = tabs2[i,3] + tabs2[i,12] = tabs2[i,6] + tabs2[i,13] = tabs2[i,7] + } + } + + for ( i in 1:tablen) { + tabs2[i,14] = paste(tabs2[i,12], " - ", tabs2[i,13], sep = "") +#STB +# tabs2[i,14] = paste(tabs2[i,12], " vs. ", tabs2[i,13], sep = "") + } + + #Subsetting to only the comparisons to control + tabs3<-subset(tabs2, V13 == cntrlGroup) +#STB Dec 2018 - Not sure this is needed +# tabs3<-subset(tabs2, tabs2$V13 == cntrlGroup) + + if (backToControlTest== "Dunnett") { + + + for (i in 1:(length(levels( eval(parse(text = paste("statdata$",selectedEffect))))))) { + if ( levels(eval(parse(text = paste("statdata$",selectedEffect))))[i] == cntrlGroup) { + refno=i + } + } + + mult<-glht(lm(model, data=statdata, na.action = na.omit), linfct=lsm(eval(parse(text = paste("trt.vs.ctrl ~",selectedEffect))), ref = refno )) + multci<-confint(mult, level=0.95, calpha = univariate_calpha()) + multp<-summary(mult) + adjpval<-multp$test$pvalues + tabs3$V15<-adjpval + } else { + #Adjusting the p-values + unadjpval<-tabs3$V5 + adjpval<-p.adjust(unadjpval, method = backToControlTest) + tabs3$V15<-adjpval + } + +#=================================================================================================================== + #Creating final table + tabs4<-data.frame() + for ( i in 1:dim(tabs3)[1]) { + tabs4[i,1]<-format(round(tabs3[i,9], 3), nsmall=3, scientific=FALSE) + tabs4[i,2]<-format(round(tabs3[i,10], 3), nsmall=3, scientific=FALSE) + tabs4[i,3]<-format(round(tabs3[i,11], 3), nsmall=3, scientific=FALSE) + tabs4[i,4]<-format(round(tabs3[i,4], 3), nsmall=3, scientific=FALSE) + tabs4[i,5]<-format(round(tabs3[i,15], 4), nsmall=4, scientific=FALSE) + } + + for (i in 1:dim(tabs3)[1]) { + if (adjpval[i]<0.0001) { + #STB March 2011 - formatting p-values p<0.0001 + #tabs4[i,5]<-0.0001 + tabs4[i,5]=format(round(0.0001, 4), nsmall=4, scientific=FALSE) + tabs4[i,5]<- paste("<",tabs4[i,5]) + } + } + + #STB June 2015 + for (i in 1:100) { + tabs3$V14<-sub("_ivs_dash_ivs_"," - ", tabs3$V14, fixed=TRUE) + } + + tabls<-cbind(tabs3$V14, tabs4) + + lowerCI<-paste(" Lower ",(sig*100),"% CI ",sep="") + upperCI<-paste(" Upper ",(sig*100),"% CI ",sep="") + #STB May 2012 correcting "SEM" + colnames(tabls)<-c("Comparison", "Difference", lowerCI, upperCI, "Std error", "p-value") + + HTML(tabls, classfirstline="second", align="left", row.names = "FALSE") + +#=================================================================================================================== + #Plot of the comparisons back to control + CITitle<-paste("Plot of the comparisons between the predicted means with ",(sig*100),"% confidence intervals",sep="") + HTML.title(CITitle, HR=2, align="left") + + #Code for LS MEans plot + meanPlotqq <- sub(".html", "meanplotqq.png", htmlFile) + png(meanPlotqq,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdf5qq <- sub(".html", "meanplotqq.pdf", htmlFile) + dev.control("enable") + + #Setting up the dataset + graphdata<-data.frame(tabs4) + graphdata$Mean<-as.numeric(graphdata$V1) + graphdata$Lower<-as.numeric(graphdata$V2) + graphdata$Upper<-as.numeric(graphdata$V3) + graphdata$Group_IVSq_<-tabs3$V14 + Gr_intercept <- 0 + XAxisTitle <- "Comparison" + YAxisTitle <- "Difference between the means" + Gr_line_type<-Line_type_dashed + + #GGPLOT2 code + LSMPLOT_diff() + void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", meanPlotqq), Align="left") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf5qq), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_5qq<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf5qq) + linkToPdf5qq <- paste ("Click here to view the PDF of the plot of comparisons back to control", sep = "") + HTML(linkToPdf5qq) + } + +#=================================================================================================================== + #Conclusions + add<-paste(c("Conclusion")) + inte<-1 + + for(i in 1:(dim(tabls)[1])) { + if (tabls[i,6]<= (1-sig)) { + if (inte==1) { + inte<-inte+1 + add<-paste(add, ": The following pairwise tests are statistically significantly different at the ", 100*(1-sig), "% level: ", tabs3$V14[i], sep="") + } else { + inte<-inte+1 + add<-paste(add, ", ", tabs3$V14[i], sep="") + } + } + } + if (inte==1) { + if (tablen >1) { + add<-paste(add, ": There are no statistically significant pairwise differences.", sep="") + } else { + add<-paste(add, ": The pairwise difference is not statistically significant.", sep="") + } + } else { + add<-paste(add, ". ", sep="") + } + HTML(add, align="left") + + if (noeffects>testeffects) { + HTML("Warning: It is not advisable to draw statistical inferences about a factor/interaction in the presence of a significant higher-order interaction involving that factor/interaction. In the above table we have assumed that certain higher order interactions are not significant, see log for more details.", align="left") + } + if (tablen > 1) { + if (backToControlTest== "none") { + HTML("Warning: As these tests are not adjusted for multiplicity there is a risk of generating false positive results. Only use the pairwise tests you planned to make a-priori, these are the so called planned comparisons, see Snedecor and Cochran (1989).", align="left") + } + } + if (backToControlTest != "none") { + HTML("Note: The confidence intervals quoted are not adjusted for multiplicity.", align="left") + } +} + +#=================================================================================================================== +#Back transformed geometric means table +#=================================================================================================================== +if(backToControlTest != "NULL" && GeomDisplay == "Y" && (responseTransform =="Log10"||responseTransform =="Loge")) { + HTML.title("All to one comparisons as back-transformed ratios", HR=2, align="left") + HTML("As the response was log transformed prior to analysis the differences between the least square (predicted) means are presented on the log scale. These results can be back-transformed onto the original scale, where differences on the log scale become ratios when back-transformed.", align="left") + +#Creating final table + tabs4x<-data.frame() + + if (responseTransform =="Log10") { + for ( i in 1:dim(tabs3)[1]) { + tabs4x[i,1]<-format(round(10^(tabs3[i,9]), 3), nsmall=3, scientific=FALSE) + tabs4x[i,2]<-format(round(10^(tabs3[i,10]), 3), nsmall=3, scientific=FALSE) + tabs4x[i,3]<-format(round(10^(tabs3[i,11]), 3), nsmall=3, scientific=FALSE) + } + } + if (responseTransform =="Loge") { + for ( i in 1:dim(tabs3)[1]) { + tabs4x[i,1]<-format(round(exp(tabs3[i,9]), 3), nsmall=3, scientific=FALSE) + tabs4x[i,2]<-format(round(exp(tabs3[i,10]), 3), nsmall=3, scientific=FALSE) + tabs4x[i,3]<-format(round(exp(tabs3[i,11]), 3), nsmall=3, scientific=FALSE) + } + } + + tabs3$V14<-sub(" - "," / ", tabs3$V14, fixed=TRUE) +#STB2019 +# tabs3$V14<-sub(" vs. "," / ", tabs3$V14, fixed=TRUE) + + #STB June 2015 + for (i in 1:100) { + tabs3$V14<-sub("_ivs_dash_ivs_"," - ", tabs3$V14, fixed=TRUE) + } + + lowerCI<-paste("Lower ",(sig*100),"% CI",sep="") + upperCI<-paste("Upper ",(sig*100),"% CI",sep="") + + tablsx <- cbind(tabs3$V14, tabs4x) + #STB May 2012 correcting "SEM" + colnames(tablsx)<-c("Comparison", "Ratio", lowerCI, upperCI) + + HTML(tablsx, classfirstline="second", align="left", row.names = "FALSE") + +#=================================================================================================================== + #Plot of the comparisons back to control + CITitle<-paste("Plot of the comparisons between the back-transformed geometric means with ",(sig*100),"% confidence intervals",sep="") + HTML.title(CITitle, HR=2, align="left") + + #Code for LS MEans plot + meanPlotqs <- sub(".html", "meanplotqs.png", htmlFile) + png(meanPlotqs,width = jpegwidth, height = jpegheight, units="in", res=PlotResolution) + + #STB July2013 + plotFilepdf5qs <- sub(".html", "meanplotqs.pdf", htmlFile) + dev.control("enable") + + #Setting up the dataset + graphdata<-data.frame(tabs4x) + graphdata$Mean<-as.numeric(graphdata$V1) + graphdata$Lower<-as.numeric(graphdata$V2) + graphdata$Upper<-as.numeric(graphdata$V3) + graphdata$Group_IVSq_<-tabs3$V14 + Gr_intercept <- 1 + XAxisTitle <- "Comparison" + YAxisTitle <- "Ratio of differences between the geometric means" + + #GGPLOT2 code + LSMPLOT_diff() + + void<-HTMLInsertGraph(GraphFileName=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", meanPlotqs), Align="left") + + #STB July2013 + if (pdfout=="Y") { + pdf(file=sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","", plotFilepdf5qs), height = pdfheight, width = pdfwidth) + dev.set(2) + dev.copy(which=3) + dev.off(2) + dev.off(3) + pdfFile_5qs<-sub("[A-Z0-9a-z,:,\\\\]*App_Data[\\\\]","",plotFilepdf5qs) + linkToPdf5qs <- paste ("Click here to view the PDF of the plot of comparisons back to control", sep = "") + HTML(linkToPdf5qs) + } +} + +#=================================================================================================================== +#Analysis description +#=================================================================================================================== +HTML.title("Analysis description", HR=2, align="left") + +add<-c("The data were analysed using a ") + +if (notreatfactors==1) { + if(FirstCatFactor != "NULL") { + add<-paste(add, "1-way ANCOVA approach, with ", treatFactors, " as the treatment factor", sep="") + } else { + add<-paste(add, "1-way ANOVA approach, with ", treatFactors, " as the treatment factor", sep="") + } +} else { + add<-paste(add, notreatfactors, sep="") + if(FirstCatFactor != "NULL") { + add<-paste(add, "-way ANCOVA approach, with ", sep="") + } else { + add<-paste(add, "-way ANOVA approach, with ", sep="") + } + for (i in 1:notreatfactors) { + if (i1) { + if (FirstCatFactor == "NULL") { + add<-paste(add, " and ", sep="") + } + for (i in 1:noblockfactors) { + if (i Armitage, P., Matthews, J.N.S. and Berry, G. (2001). Statistical Methods in Medical Research. 4th edition; John Wiley & Sons. New York.", align="left") +} + +if (allPairwiseTest== "BH" | backToControlTest=="BH") { + HTML("Benjamini, Y. and Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society Series B, 57, 289-300. ", align="left") +} + +if (allPairwiseTest== "bonferroni" | backToControlTest=="bonferroni") { + HTML("Bonferroni, C.E. (1936). Teoria statistica delle classi e calcolo delle probabilita. Pubblicazioni del R Istituto Superiore di Scienze Economiche e Commerciali di Firenze, 8, 3-62.", align="left") +} + +if (allPairwiseTest== "Tukey") { + HTML("Braun, H.I., ed. (1994). The collected works of John W. Tukey. Vol. VIII: Multiple comparisons:1948-1983. New York: Chapman and Hall.", align="left") +} + +if (backToControlTest== "Dunnett") { + HTML("Dunnett, C.W. (1955). A multiple comparison procedure for comparing several treatments with a control. Journal of the American Statistical Association, 50, 1096-1121.", align="left") +} + +if (allPairwiseTest== "hochberg" | backToControlTest=="hochberg") { + HTML("Hochberg, Y. (1988). A sharper Bonferroni procedure for multiple tests of significance. Biometrika, 75, 800-803.", align="left") +} + +if (allPairwiseTest== "holm" | backToControlTest=="holm") { + HTML("Holm, S. (1979). A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics, 6, 65-70.", align="left") +} + +if (allPairwiseTest== "hommel" | backToControlTest=="hommel") { + HTML("Hommel, G. (1988). A stagewise rejective multiple test procedure based on a modified Bonferroni test. Biometrika, 75, 383-386.", align="left") +} + +if(FirstCatFactor != "NULL") { + HTML(" Morris, T.R. (1999). Experimental Design and Analysis in Animal Sciences. CABI publishing. Wallingford, Oxon (UK).", align="left") +} + +if (allPairwiseTest != "NULL" | backToControlTest !="NULL") { + if (tablen >1 & (allPairwiseTest== "none" | backToControlTest=="none"|allPairwiseTest!= "NULL" | backToControlTest=="NULL") ) { + HTML("Snedecor, G.W. and Cochran, W.G. (1989). Statistical Methods. 8th edition; Iowa State University Press, Iowa, USA.", align="left") + } +} + +HTML.title("R references", HR=4, align="left") +HTML(Ref_list$R_ref , align="left") +HTML(Ref_list$GGally_ref, align="left") +HTML(Ref_list$RColorBrewers_ref, align="left") +HTML(Ref_list$GGPLot2_ref, align="left") +HTML(Ref_list$ggrepel_ref, align="left") +HTML(Ref_list$reshape_ref, align="left") +HTML(Ref_list$plyr_ref, align="left") +HTML(Ref_list$scales_ref, align="left") +HTML(Ref_list$car_ref, align="left") +HTML(Ref_list$R2HTML_ref, align="left") +HTML(Ref_list$PROTO_ref, align="left") +HTML(Ref_list$LSMEANS_ref, align="left") +HTML(Ref_list$multcomp_ref, align="left") +HTML(Ref_list$mcview_ref, align="left") + + +#=================================================================================================================== +#Show dataset +#=================================================================================================================== + + +if (showdataset=="Y") +{ + statdata_temp<-subset(statdata_temp, select = -c(mainEffect, scatterPlotColumn,catfact)) + + observ <- data.frame(c(1:dim(statdata_temp)[1])) + colnames(observ) <- c("Observation") + statdata_temp2 <- cbind(observ, statdata_temp) + + HTML.title("Analysis dataset", HR = 2, align = "left") + HTML(statdata_temp2, classfirstline = "second", align = "left", row.names = "FALSE") + +} + +#=================================================================================================================== +#Show arguments +#=================================================================================================================== +if (OutputAnalysisOps == "Y") { + HTML.title("Analysis options", HR=2, align="left") + + HTML(paste("Response variable: ", resp, sep=""), align="left") + + if (responseTransform != "None") { + HTML(paste("Response variable transformation: ", responseTransform, sep=""), align="left") + } + + HTML(paste("Treatment factor(s): ", treatFactors, sep=""), align="left") + + if (blockFactors != "NULL") { + HTML(paste("Other design (block) factor(s): ", blockFactors, sep=""), align="left") + } + + if(FirstCatFactor != "NULL") { + HTML(paste("Covariate(s): ", covariates, sep=""), align="left") + } + + if (FirstCatFactor != "NULL" ) { + HTML(paste("Primary factor: ", FirstCatFactor, sep=""), align="left") + } + + if (FirstCatFactor != "NULL" && covariateTransform != "None") { + HTML(paste("Covariate(s) transformation: ", covariateTransform, sep=""), align="left") + } + + HTML(paste("Output ANOVA table (Y/N): ", showANOVA, sep=""), align="left") + HTML(paste("Output residuals vs. predicted plot (Y/N): ", showPRPlot, sep=""), align="left") + HTML(paste("Output normal probability plot (Y/N): ", showNormPlot, sep=""), align="left") + HTML(paste("Significance level: ", 1-sig, sep=""), align="left") + + if (showLSMeans != "N" && (Args[19] != "NULL" | backToControlTest != "NULL" ) ) { + HTML(paste("Selected effect (for pairwise mean comparisons): ", selectedEffect, sep=""), align="left") + } + + HTML(paste("Output least square (predicted) means (Y/N): ", showLSMeans, sep=""), align="left") + + + if (Args[19] != "NULL") { + HTML(paste("All pairwise comparisons procedure: ", allPairwiseTest, sep=""), align="left") + } + + if (backToControlTest != "NULL" && backToControlTest != "none") { + HTML(paste("Comparisons back to control procedure: ", backToControlTest, sep=""), align="left") + } + + if (backToControlTest == "none") { + HTML(paste("Comparisons back to control procedure: Unadjusted (LSD)"), align="left") + } + + if ( backToControlTest != "NULL" ) { + HTML(paste("Control group: ", cntrlGroup, sep=""), align="left") + } +} \ No newline at end of file diff --git a/SilveR/Scripts/MultivariateAnalysis.R b/SilveR/Scripts/MultivariateAnalysis.R index a8bd1dd60..31315d927 100644 --- a/SilveR/Scripts/MultivariateAnalysis.R +++ b/SilveR/Scripts/MultivariateAnalysis.R @@ -1421,10 +1421,17 @@ print(PLSmodel$explained_variance) #=================================================================================================================== Ref_list<-R_refs() -#HTML.title("Statistical references", HR=2, align="left") -#HTML(Ref_list$BateClark_ref, align="left") +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$R2HTML_ref, align="left") diff --git a/SilveR/Scripts/NestedDesignAnalysis.R b/SilveR/Scripts/NestedDesignAnalysis.R index ef6e1dce6..75dbd21cb 100644 --- a/SilveR/Scripts/NestedDesignAnalysis.R +++ b/SilveR/Scripts/NestedDesignAnalysis.R @@ -1450,11 +1450,22 @@ HTML("Significance level: The chance that the experiment will give a false-posit #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") HTML("Snedecor, G.W. and Cochran, W.G. (1989). Statistical Methods (8th Edition). Iowa State University Press, Ames, Iowa.", align="left") -HTML("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/NonParametricAnalysis.R b/SilveR/Scripts/NonParametricAnalysis.R index fdf760457..9d12af959 100644 --- a/SilveR/Scripts/NonParametricAnalysis.R +++ b/SilveR/Scripts/NonParametricAnalysis.R @@ -1097,7 +1097,13 @@ if (RunFried == "Y") { #Bate and Clark comment HTML(refxx, align = "left") - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML(Ref_list$BateClark_ref, align = "left") HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") HTML("Kruskal, W.H. and Wallis, W.A. (1952). Use of ranks in one criterion variance analysis. JASA, 47, 583-621.", align = "left") @@ -1127,7 +1133,13 @@ if (RunFried == "Y") { #Bate and Clark comment HTML(refxx, align = "left") - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML(Ref_list$BateClark_ref, align = "left") HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") HTML("Mann, H.B. and Whitney, D.R. (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of Mathematical Statistics, 18, 50-60.", align = "left") @@ -1162,7 +1174,13 @@ if (RunFried == "Y") { #Bate and Clark comment HTML(refxx, align = "left") - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML(Ref_list$BateClark_ref, align = "left") HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") HTML("Hollander, M. and Wolfe, D.A. (1973). Nonparametric Statistical Methods. New York: John Wiley & Sons.", align = "left") @@ -1231,7 +1249,13 @@ if (RunFried == "Y") { #Bate and Clark comment HTML(refxx, align = "left") - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML(Ref_list$BateClark_ref, align = "left") HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") HTML("Mann, H.B. and Whitney, D.R. (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of Mathematical Statistics, 18, 50-60.", align = "left") @@ -1286,7 +1310,13 @@ if (RunFried == "Y") { #Bate and Clark comment HTML(refxx, align = "left") - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML(Ref_list$BateClark_ref, align = "left") HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") HTML("Hollander, M. and Wolfe, D.A. (1973). Nonparametric Statistical Methods. New York: John Wiley & Sons.", align = "left") @@ -1327,14 +1357,26 @@ if (RunFried == "Y") { #Bate and Clark comment HTML(refxx, align = "left") - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML(Ref_list$BateClark_ref, align = "left") HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") HTML("Steel, R.G.D. (1959). A multiple comparison rank sum test: treatments versus control. Biometrics, 15, 560-572. ", align = "left") } if (block != "NULL" && (statstest == "CompareToControl" && leng >= 3)) { - HTML.title("Statistical references", HR = 2, align = "left") + if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") + } + if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") + } HTML("Hyndman, R.J. and Fan, Y. (1996). Sample quantiles in statistical packages. American Statistician 50, 361-365.", align = "left") } @@ -1349,7 +1391,12 @@ if (RunFried != "Y") { #=================================================================================================================== #References #=================================================================================================================== -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$mtvnorm_ref, align = "left") diff --git a/SilveR/Scripts/OneSampleTTestAnalysis.R b/SilveR/Scripts/OneSampleTTestAnalysis.R index 3786387ed..741e24c2f 100644 --- a/SilveR/Scripts/OneSampleTTestAnalysis.R +++ b/SilveR/Scripts/OneSampleTTestAnalysis.R @@ -338,10 +338,21 @@ if (showNormPlot != "N" ) { #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/OneWayANOVAPowerAnalysisDatasetBasedInputs.R b/SilveR/Scripts/OneWayANOVAPowerAnalysisDatasetBasedInputs.R index 2d01a5c30..2ee3c2046 100644 --- a/SilveR/Scripts/OneWayANOVAPowerAnalysisDatasetBasedInputs.R +++ b/SilveR/Scripts/OneWayANOVAPowerAnalysisDatasetBasedInputs.R @@ -283,11 +283,22 @@ HTML("Significance level: The chance that the experiment will give a false-posit #=================================================================================================================== Ref_list <- R_refs() -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") #HTML("Harrison, D.A. and Brady, A.R. (2004). Sample size and power calculations using the noncentral t-distribution. The Stata Journal, 4(2), 142-153.", align = "left") -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") HTML(Ref_list$RColorBrewers_ref, align = "left") diff --git a/SilveR/Scripts/OneWayANOVAPowerAnalysisUserBasedInputs.R b/SilveR/Scripts/OneWayANOVAPowerAnalysisUserBasedInputs.R index 008e79c25..493a31b7a 100644 --- a/SilveR/Scripts/OneWayANOVAPowerAnalysisUserBasedInputs.R +++ b/SilveR/Scripts/OneWayANOVAPowerAnalysisUserBasedInputs.R @@ -283,11 +283,22 @@ HTML("Significance level: The chance that the experiment will give a false-posit #=================================================================================================================== Ref_list <- R_refs() -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") #HTML("Harrison, D.A. and Brady, A.R. (2004). Sample size and power calculations using the noncentral t-distribution. The Stata Journal, 4(2), 142-153.", align = "left") -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") HTML(Ref_list$RColorBrewers_ref, align = "left") diff --git a/SilveR/Scripts/PValueAdjustmentDatasetBasedInputs.R b/SilveR/Scripts/PValueAdjustmentDatasetBasedInputs.R index d57f8d631..dbf313642 100644 --- a/SilveR/Scripts/PValueAdjustmentDatasetBasedInputs.R +++ b/SilveR/Scripts/PValueAdjustmentDatasetBasedInputs.R @@ -265,7 +265,13 @@ HTML(add, align="left") #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if (allPairwiseTest== "BH" ) { @@ -284,7 +290,12 @@ if (allPairwiseTest== "hommel" ) { HTML("Hommel, G. (1988). A stagewise rejective multiple test procedure based on a modified Bonferroni test. Biometrika, 75, 383-386.", align="left") } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$R2HTML_ref, align="left") HTML(Ref_list$multcomp_ref, align="left") diff --git a/SilveR/Scripts/PValueAdjustmentUserBasedInputs.R b/SilveR/Scripts/PValueAdjustmentUserBasedInputs.R index 7b7c1654c..d7aae58aa 100644 --- a/SilveR/Scripts/PValueAdjustmentUserBasedInputs.R +++ b/SilveR/Scripts/PValueAdjustmentUserBasedInputs.R @@ -265,7 +265,13 @@ HTML(add, align="left") #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if (allPairwiseTest== "BH" ) { @@ -284,7 +290,12 @@ if (allPairwiseTest== "hommel" ) { HTML("Hommel, G. (1988). A stagewise rejective multiple test procedure based on a modified Bonferroni test. Biometrika, 75, 383-386.", align="left") } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$R2HTML_ref, align="left") HTML(Ref_list$multcomp_ref, align="left") diff --git a/SilveR/Scripts/PairedTTestAnalysis.R b/SilveR/Scripts/PairedTTestAnalysis.R index 34f998218..87e54def3 100644 --- a/SilveR/Scripts/PairedTTestAnalysis.R +++ b/SilveR/Scripts/PairedTTestAnalysis.R @@ -1188,8 +1188,13 @@ if (showComps == "Y") { lowerCI<-paste(" Lower ",(sig*100),"% CI ",sep="") upperCI<-paste(" Upper ",(sig*100),"% CI ",sep="") - - colnames(tabls)<-c("Comparison", "Difference", lowerCI, upperCI) + + if (UpdateIVS == "N") { + colnames(tabls)<-c("Comparison", "Difference", lowerCI, upperCI) + } + if (UpdateIVS == "Y") { + colnames(tabls)<-c("Comparison", "Ratio", lowerCI, upperCI) + } HTML(tabls, classfirstline="second", align="left", row.names = "FALSE") } @@ -1305,7 +1310,13 @@ Ref_list<-R_refs() #Bate and Clark comment HTML(refxx, align="left") -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(covariatelist != "NULL") { @@ -1320,7 +1331,12 @@ if (dimfact > 2) { HTML("Venables, W.N. and Ripley, B.D. (2003). Modern Applied Statistics with S. 4th Edition; Springer. New York, Inc.", align="left") -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/RepeatedMeasuresParametricAnalysis.R b/SilveR/Scripts/RepeatedMeasuresParametricAnalysis.R index fda874a2a..25e08fdc7 100644 --- a/SilveR/Scripts/RepeatedMeasuresParametricAnalysis.R +++ b/SilveR/Scripts/RepeatedMeasuresParametricAnalysis.R @@ -1746,7 +1746,13 @@ Ref_list<-R_refs() #Bate and Clark comment HTML(refxx, align="left") -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(FirstCatFactor != "NULL") { @@ -1760,7 +1766,12 @@ if (pairwiseTest != "None") { } HTML("Venables, W.N. and Ripley, B.D. (2003). Modern Applied Statistics with S. 4th Edition; Springer. New York, Inc.", align="left") -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/SingleMeasuresParametricAnalysis.R b/SilveR/Scripts/SingleMeasuresParametricAnalysis.R index 0760dcb42..a6f06eee4 100644 --- a/SilveR/Scripts/SingleMeasuresParametricAnalysis.R +++ b/SilveR/Scripts/SingleMeasuresParametricAnalysis.R @@ -2038,7 +2038,13 @@ Ref_list<-R_refs() #Bate and Clark comment HTML(refxx, align="left") -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(showANOVA=="Y") { @@ -2083,7 +2089,12 @@ if (allPairwiseTest != "NULL" | backToControlTest !="NULL") { } } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/SummaryStatistics.R b/SilveR/Scripts/SummaryStatistics.R index d1858c319..76e69caac 100644 --- a/SilveR/Scripts/SummaryStatistics.R +++ b/SilveR/Scripts/SummaryStatistics.R @@ -722,10 +722,21 @@ Ref_list <- R_refs() #Bate and Clark comment HTML(refxx, align = "left") -HTML.title("Statistical references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align = "left") -HTML.title("R references", HR = 2, align = "left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref, align = "left") HTML(Ref_list$GGally_ref, align = "left") HTML(Ref_list$RColorBrewers_ref, align = "left") diff --git a/SilveR/Scripts/SurvivalAnalysis.R b/SilveR/Scripts/SurvivalAnalysis.R index e9ce24276..4891583a2 100644 --- a/SilveR/Scripts/SurvivalAnalysis.R +++ b/SilveR/Scripts/SurvivalAnalysis.R @@ -243,13 +243,24 @@ if (ShowPlot == "Y") { #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if (ComparingCurves == "Y") { HTML("Harrington, D.P. and Fleming, T.R. (1982). A class of rank test procedures for censored survival data. Biometrika 69, 553-566.", align="left") } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/Scripts/UnpairedTTestAnalysis.R b/SilveR/Scripts/UnpairedTTestAnalysis.R index 8b18761e3..2617127fe 100644 --- a/SilveR/Scripts/UnpairedTTestAnalysis.R +++ b/SilveR/Scripts/UnpairedTTestAnalysis.R @@ -744,14 +744,25 @@ if(unequalCase == "Y" && GeomDisplay == "Y" && (responseTransform =="Log10"||res #=================================================================================================================== Ref_list<-R_refs() -HTML.title("Statistical references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("Statistical references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("References", HR=2, align="left") + HTML(Ref_list$IVS_ref, align="left") +} HTML(Ref_list$BateClark_ref, align="left") if(unequalCase == "Y") { HTML("Welch, B.L. (1947). The generalization of Student's problem when several different population variances are involved. Biometrika, 34(1-2), 28-35.", align="left") } -HTML.title("R references", HR=2, align="left") +if (UpdateIVS == "N") { + HTML.title("R references", HR=2, align="left") +} +if (UpdateIVS == "Y") { + HTML.title("R references", HR=4, align="left") +} HTML(Ref_list$R_ref , align="left") HTML(Ref_list$GGally_ref, align="left") HTML(Ref_list$RColorBrewers_ref, align="left") diff --git a/SilveR/SilveR.csproj b/SilveR/SilveR.csproj index 69dc03c01..33c4b8870 100644 --- a/SilveR/SilveR.csproj +++ b/SilveR/SilveR.csproj @@ -1,6 +1,6 @@  - 4.0.2 + 4.1.0 true SilveR.snk @@ -16,6 +16,8 @@ netcoreapp3.1 true + 4.1.0.0 + 4.1.0.0 @@ -115,6 +117,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/SilveR/Startup.cs b/SilveR/Startup.cs index b86cdce23..b0ff32f9a 100644 --- a/SilveR/Startup.cs +++ b/SilveR/Startup.cs @@ -105,7 +105,6 @@ public async void ElectronBootstrap() BrowserWindow browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { Title = Program.AppName, - Fullscreen = true, Width = 1280, Height = 1024, AutoHideMenuBar = true, @@ -120,7 +119,11 @@ public async void ElectronBootstrap() Electron.Menu.SetContextMenu(browserWindow, contextMenu); - browserWindow.OnReadyToShow += () => browserWindow.Show(); + browserWindow.OnReadyToShow += () => + { + browserWindow.Show(); + browserWindow.Maximize(); + }; } @@ -211,6 +214,12 @@ private void ProvisionDatabase(IApplicationBuilder app) context.Scripts.Add(linearRegression); } + if (!existingScripts.Any(x => x.ScriptFileName == "LogisticRegressionAnalysis")) + { + Script logisticRegression = new Script() { ScriptDisplayName = "Logistic Regression Analysis", ScriptFileName = "LogisticRegressionAnalysis", RequiresDataset = true }; + context.Scripts.Add(logisticRegression); + } + if (!existingScripts.Any(x => x.ScriptFileName == "DoseResponseAndNonLinearRegressionAnalysis")) { Script doseResponse = new Script() { ScriptDisplayName = "Dose-response and Non-linear Regression Analysis", ScriptFileName = "DoseResponseAndNonLinearRegressionAnalysis", RequiresDataset = true }; diff --git a/SilveR/StatsModels/AnalysisFactory.cs b/SilveR/StatsModels/AnalysisFactory.cs index dfabb5380..48c49d706 100644 --- a/SilveR/StatsModels/AnalysisFactory.cs +++ b/SilveR/StatsModels/AnalysisFactory.cs @@ -45,6 +45,9 @@ public static AnalysisModelBase CreateAnalysisModel(string scriptName, Dataset d case "LinearRegressionAnalysis": model = new LinearRegressionAnalysisModel(dataset); break; + case "LogisticRegressionAnalysis": + model = new LogisticRegressionAnalysisModel(dataset); + break; case "DoseResponseAndNonLinearRegressionAnalysis": model = new DoseResponseAndNonLinearRegressionAnalysisModel(dataset); break; diff --git a/SilveR/StatsModels/LogisticRegressionAnalysisModel.cs b/SilveR/StatsModels/LogisticRegressionAnalysisModel.cs new file mode 100644 index 000000000..aad4434bb --- /dev/null +++ b/SilveR/StatsModels/LogisticRegressionAnalysisModel.cs @@ -0,0 +1,420 @@ +using Combinatorics.Collections; +using SilveR.Helpers; +using SilveR.Models; +using SilveR.Validators; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Data; +using System.Linq; +using System.Text; + +namespace SilveR.StatsModels +{ + public class LogisticRegressionAnalysisModel : AnalysisDataModelBase + { + [Required] + [CheckUsedOnceOnly] + [DisplayName("Response")] + public string Response { get; set; } + + [Required] + [CheckUsedOnceOnly] + [DisplayName("Treatment factors")] + public IEnumerable Treatments { get; set; } + + [DisplayName("Other design (block) factors")] + [CheckUsedOnceOnly] + public IEnumerable OtherDesignFactors { get; set; } + + [Required] + [CheckUsedOnceOnly] + [DisplayName("Continuous factors")] + public IEnumerable ContinuousFactors { get; set; } + + [DisplayName("Continuous factors transformation")] + public string ContinuousFactorsTransformation { get; set; } = "None"; + + [DisplayName("Response transformation")] + public string ResponseTransformation { get; set; } = "None"; + + public IEnumerable TransformationsList + { + get { return new List() { "None", "Log10", "Loge", "Square Root", "ArcSine", "Rank" }; } + } + + [CheckUsedOnceOnly] + [DisplayName("Covariates")] + public IEnumerable Covariates { get; set; } + + [DisplayName("Primary factor")] + public string PrimaryFactor { get; set; } + + [DisplayName("Covariate transformation")] + public string CovariateTransformation { get; set; } = "None"; + + [DisplayName("ANOVA table")] + public bool ANOVASelected { get; set; } = true; + + [DisplayName("Residuals vs. predicted plot")] + public bool TableOfOverallEffectTests { get; set; } = true; + + [DisplayName("Significance level")] + public string Significance { get; set; } = "0.05"; + + public IEnumerable SignificancesList + { + get { return new List() { "0.1", "0.05", "0.01", "0.001" }; } + } + + [DisplayName("Effect")] + public string SelectedEffect { get; set; } + + [DisplayName("Least square (predicted) means")] + public bool LSMeansSelected { get; set; } + + [DisplayName("All pairwise comparisons")] + public string AllPairwise { get; set; } + + public IEnumerable PairwiseTestList + { + get { return new List() { String.Empty, "Unadjusted (LSD)", "Tukey", "Holm", "Hochberg", "Hommel", "Bonferroni", "Benjamini-Hochberg" }; } + } + + [DisplayName("Comparisons back to control")] + public string ComparisonsBackToControl { get; set; } + + public IEnumerable ComparisonsBackToControlTestList + { + get { return new List() { String.Empty, "Unadjusted (LSD)", "Dunnett", "Holm", "Hochberg", "Hommel", "Bonferroni", "Benjamini-Hochberg" }; } + } + + [DisplayName("Control group")] + public string ControlGroup { get; set; } + + [DisplayName("Generate comparisons dataset")] + public bool GenerateComparisonsDataset { get; set; } + + public LogisticRegressionAnalysisModel() : base("LogisticRegressionAnalysis") { } + + public LogisticRegressionAnalysisModel(IDataset dataset) + : base(dataset, "LogisticRegressionAnalysis") { } + + public override ValidationInfo Validate() + { + LogisticRegressionAnalysisValidator logisticRegressionAnalysisValidator = new LogisticRegressionAnalysisValidator(this); + return logisticRegressionAnalysisValidator.Validate(); + } + + public override string[] ExportData() + { + DataTable dtNew = DataTable.CopyForExport(); + + //Get the response, treatment and covariate columns by removing all other columns from the new datatable + foreach (string columnName in dtNew.GetVariableNames()) + { + if (Response != columnName && !Treatments.Contains(columnName) && (OtherDesignFactors == null || !OtherDesignFactors.Contains(columnName)) && (Covariates == null || !Covariates.Contains(columnName))) + { + dtNew.Columns.Remove(columnName); + } + } + + //if the response is blank then remove that row + dtNew.RemoveBlankRow(Response); + + //Generate a "catfact" column from the CatFactors (used only in R)! + DataColumn catFactor = new DataColumn("catfact"); + dtNew.Columns.Add(catFactor); + + //Need to create a new column for the scatterplot data as we have to combine any interaction effects into one column + dtNew.CreateCombinedEffectColumn(Treatments, "scatterPlotColumn"); + + //If an interaction effect is selected then we need to combine values into single column + if (!String.IsNullOrEmpty(SelectedEffect)) + { + //create a new column and add it to the table + if (SelectedEffect.Contains(" * ")) //then it is an interaction effect so we need to combine values from different columns + { + char[] splitChar = { '*' }; + string[] effects = SelectedEffect.Split(splitChar, StringSplitOptions.RemoveEmptyEntries); //get the effect names that make up the interaction effect + + dtNew.CreateCombinedEffectColumn(effects, "mainEffect"); + } + else //just copy the column selected in the dropdown + { + DataColumn mainEffect = new DataColumn("mainEffect"); + dtNew.Columns.Add(mainEffect); + foreach (DataRow r in dtNew.Rows) + { + r["mainEffect"] = r[SelectedEffect].ToString(); + } + } + } + + //Now do transformations... + dtNew.TransformColumn(Response, ResponseTransformation); + + if (Covariates != null) + { + foreach (string covariate in Covariates) + { + dtNew.TransformColumn(covariate, CovariateTransformation); + } + } + + //Finally, as numeric categorical variables get misinterpreted by r, we need to go through + //each column and put them in quotes... + foreach (string treat in Treatments) + { + if (dtNew.CheckIsNumeric(treat)) + { + foreach (DataRow row in dtNew.Rows) + { + row[treat] = "'" + row[treat] + "'"; + } + } + } + + if (OtherDesignFactors != null) + { + foreach (string odf in OtherDesignFactors) + { + if (dtNew.CheckIsNumeric(odf)) + { + foreach (DataRow row in dtNew.Rows) + { + row[odf] = "'" + row[odf] + "'"; + } + } + } + } + + string[] csvArray = dtNew.GetCSVArray(); + + //fix any columns with illegal chars here (at the end) + ArgumentFormatter argFormatter = new ArgumentFormatter(); + csvArray[0] = argFormatter.ConvertIllegalCharacters(csvArray[0]); + + return csvArray; + } + + + public override string GetCommandLineArguments() + { + ArgumentFormatter argFormatter = new ArgumentFormatter(); + StringBuilder arguments = new StringBuilder(); + + //first thing to do is to assemble the model (use the GetModel method) + arguments.Append(" " + argFormatter.GetFormattedArgument(GetModel(), true)); //4 + + string scatterplotModel = argFormatter.GetFormattedArgument(Response + "~scatterPlotColumn", true); + arguments.Append(" " + scatterplotModel); //5 + + //assemble a model for the covariate plot (if a covariate has been chosen)... + arguments.Append(" " + argFormatter.GetFormattedArgument(Covariates)); //6 + + //get transforms + arguments.Append(" " + argFormatter.GetFormattedArgument(ResponseTransformation, false)); //7 + + arguments.Append(" " + argFormatter.GetFormattedArgument(CovariateTransformation, false)); //8 + + arguments.Append(" " + argFormatter.GetFormattedArgument(PrimaryFactor, true)); //9 + + arguments.Append(" " + argFormatter.GetFormattedArgument(Treatments)); //10 + + arguments.Append(" " + argFormatter.GetFormattedArgument(ContinuousFactors)); //11 + + arguments.Append(" " + argFormatter.GetFormattedArgument(ContinuousFactorsTransformation, false));//12 + + arguments.Append(" " + argFormatter.GetFormattedArgument(OtherDesignFactors)); //13 + + arguments.Append(" " + argFormatter.GetFormattedArgument(ANOVASelected)); //14 + arguments.Append(" " + argFormatter.GetFormattedArgument(TableOfOverallEffectTests)); //15 + + arguments.Append(" " + Significance); //16 + + //assemble the effect model + if (String.IsNullOrEmpty(SelectedEffect)) //17, 18 + { + arguments.Append(" " + "NULL"); + arguments.Append(" " + "NULL"); + } + else + { + arguments.Append(" " + argFormatter.GetFormattedArgument(GetEffectModel(), true)); + arguments.Append(" " + argFormatter.GetFormattedArgument(SelectedEffect, true)); + } + + arguments.Append(" " + argFormatter.GetFormattedArgument(LSMeansSelected)); //19 + + arguments.Append(" " + argFormatter.GetFormattedArgument(AllPairwise, false)); //20 + + arguments.Append(" " + argFormatter.GetFormattedArgument(ComparisonsBackToControl, false)); //21 + + arguments.Append(" " + argFormatter.GetFormattedArgument(ControlGroup, false)); //22 + + arguments.Append(" " + argFormatter.GetFormattedArgument(GenerateComparisonsDataset)); //23 + + return arguments.ToString().Trim(); + } + + + public override void LoadArguments(IEnumerable arguments) + { + ArgumentHelper argHelper = new ArgumentHelper(arguments); + + this.Response = argHelper.LoadStringArgument(nameof(Response)); + this.Treatments = argHelper.LoadIEnumerableArgument(nameof(Treatments)); + this.ContinuousFactors = argHelper.LoadIEnumerableArgument(nameof(ContinuousFactors)); + this.ContinuousFactorsTransformation = argHelper.LoadStringArgument(nameof(ContinuousFactorsTransformation)); + this.OtherDesignFactors = argHelper.LoadIEnumerableArgument(nameof(OtherDesignFactors)); + this.ResponseTransformation = argHelper.LoadStringArgument(nameof(ResponseTransformation)); + this.Covariates = argHelper.LoadIEnumerableArgument(nameof(Covariates)); + this.PrimaryFactor = argHelper.LoadStringArgument(nameof(PrimaryFactor)); + this.CovariateTransformation = argHelper.LoadStringArgument(nameof(CovariateTransformation)); + this.ANOVASelected = argHelper.LoadBooleanArgument(nameof(ANOVASelected)); + this.TableOfOverallEffectTests = argHelper.LoadBooleanArgument(nameof(TableOfOverallEffectTests)); + this.Significance = argHelper.LoadStringArgument(nameof(Significance)); + this.SelectedEffect = argHelper.LoadStringArgument(nameof(SelectedEffect)); + this.LSMeansSelected = argHelper.LoadBooleanArgument(nameof(LSMeansSelected)); + this.AllPairwise = argHelper.LoadStringArgument(nameof(AllPairwise)); + this.ComparisonsBackToControl = argHelper.LoadStringArgument(nameof(ComparisonsBackToControl)); + this.ControlGroup = argHelper.LoadStringArgument(nameof(ControlGroup)); + this.GenerateComparisonsDataset = argHelper.LoadBooleanArgument(nameof(GenerateComparisonsDataset)); + } + + public override IEnumerable GetArguments() + { + List args = new List(); + + args.Add(ArgumentHelper.ArgumentFactory(nameof(Response), Response)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(Treatments), Treatments)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(ContinuousFactors), ContinuousFactors)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(ContinuousFactorsTransformation), ContinuousFactorsTransformation)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(OtherDesignFactors), OtherDesignFactors)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(ResponseTransformation), ResponseTransformation)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(Covariates), Covariates)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(PrimaryFactor), PrimaryFactor)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(CovariateTransformation), CovariateTransformation)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(ANOVASelected), ANOVASelected)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(TableOfOverallEffectTests), TableOfOverallEffectTests)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(Significance), Significance)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(SelectedEffect), SelectedEffect)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(LSMeansSelected), LSMeansSelected)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(AllPairwise), AllPairwise)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(ComparisonsBackToControl), ComparisonsBackToControl)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(ControlGroup), ControlGroup)); + args.Add(ArgumentHelper.ArgumentFactory(nameof(GenerateComparisonsDataset), GenerateComparisonsDataset)); + + return args; + } + + + private string GetModel() + { + //assemble the model from the information in the treatment, other factors, response and covariate boxes + StringBuilder model = new StringBuilder(Response + "~"); + + if (Covariates != null) + { + model.Append(String.Join('+', Covariates) + '+'); + } + + if (OtherDesignFactors != null) + { + model.Append(String.Join('+', OtherDesignFactors) + '+'); + } + + model.Append(String.Join('+', Treatments) + '+'); + + //determine the interactions + List factors = new List(Treatments); + List fullInteractions = DetermineInteractions(factors); + foreach (string s in fullInteractions) + { + model.Append(s.Replace(" * ", "*") + '+'); + } + + return model.ToString().TrimEnd('+'); + } + + private string GetEffectModel() + { + //assemble the effect model + StringBuilder effectModel = new StringBuilder(Response + "~"); //add in the response + + if (Covariates != null) + { + effectModel.Append(String.Join('+', Covariates) + '+'); + } + + if (OtherDesignFactors != null) + { + effectModel.Append(String.Join('+', OtherDesignFactors) + '+'); + } + + //complicated business of assembling the other part of the model from the interactions etc... + string[] splitter = { " * " }; + List interactionEffects = new List(SelectedEffect.Split(splitter, StringSplitOptions.RemoveEmptyEntries)); + + foreach (string treat in Treatments) + { + if (!interactionEffects.Contains(treat)) + { + effectModel.Append(treat.Trim() + "+"); + } + } + + return effectModel + "mainEffect"; //where maineffect is the combined effect column of the selected effect in the dataset + } + + public static List DetermineInteractions(List listToCreateInteractionsFrom) + { + List interactions = new List(); + + //for each factor, determine the combinations + for (int i = 2; i <= listToCreateInteractionsFrom.Count; i++) + { + Combinations combinations = new Combinations(listToCreateInteractionsFrom, i, GenerateOption.WithoutRepetition); + + //for each set of combinations we need to assemble the string, with each factor separated by a * + foreach (IList combination in combinations) + { + string interaction = String.Join(" * ", combination); + + //add the interaction to the list + interactions.Add(interaction); + } + } + + return interactions; + } + + public static List DetermineSelectedEffectsList(List selectedTreatments) + { + //assemble a complete list of main and interaction effects + List effects = new List(); + effects.AddRange(selectedTreatments); + + List interactions = DetermineInteractions(selectedTreatments); + + effects.AddRange(interactions); + + //if the number of interaction effects is 4 or greater, + //then only the main effects and highest order effect are to be available + if (selectedTreatments.Count >= 4) + { + //remove any effect that is an interaction effect + for (int i = effects.Count - 1; i >= 0; i = i - 1) + { + if (effects[i].Contains("*")) effects.Remove(effects[i]); + } + //add in the highest order interaction again + effects.Add(interactions[interactions.Count - 1].ToString()); + } + + return effects; + } + } +} \ No newline at end of file diff --git a/SilveR/Validators/LogisticRegressionAnalysisValidator.cs b/SilveR/Validators/LogisticRegressionAnalysisValidator.cs new file mode 100644 index 000000000..59916573f --- /dev/null +++ b/SilveR/Validators/LogisticRegressionAnalysisValidator.cs @@ -0,0 +1,159 @@ +using SilveR.StatsModels; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; + +namespace SilveR.Validators +{ + public class LogisticRegressionAnalysisValidator : ValidatorBase + { + private readonly LogisticRegressionAnalysisModel lrVariables; + + public LogisticRegressionAnalysisValidator(LogisticRegressionAnalysisModel sm) + : base(sm.DataTable) + { + lrVariables = sm; + } + + public override ValidationInfo Validate() + { + //go through all the column names, if any are numeric then stop the analysis + List allVars = new List(); + allVars.AddVariables(lrVariables.Treatments); + allVars.AddVariables(lrVariables.OtherDesignFactors); + allVars.Add(lrVariables.Response); + allVars.AddVariables(lrVariables.Covariates); + + if (!CheckColumnNames(allVars)) + return ValidationInfo; + + //First create a list of catogorical variables selected (i.e. as treatments and other factors) + List categorical = new List(); + categorical.AddVariables(lrVariables.Treatments); + categorical.AddVariables(lrVariables.OtherDesignFactors); + + //check that the factors have at least 2 levels + if (!CheckFactorsHaveLevels(categorical, true)) + return ValidationInfo; + + //check that the response has two distinct values + int distinctResponseValues = CountDistinctLevels(lrVariables.Response); + if(distinctResponseValues != 2) + { + ValidationInfo.AddErrorMessage("Response must have 2 distinct values."); + } + + //Do checks to ensure that treatments contain a response etc and the responses contain a treatment etc... + if (!CheckResponsesPerLevel(lrVariables.Treatments, lrVariables.Response, ReflectionExtensions.GetPropertyDisplayName(i => i.Treatments))) + return ValidationInfo; + + if (!CheckResponsesPerLevel(lrVariables.OtherDesignFactors, lrVariables.Response, ReflectionExtensions.GetPropertyDisplayName(i => i.OtherDesignFactors))) + return ValidationInfo; + + //do data checks on the treatments/other factors and response + if (!CategoricalAgainstContinuousVariableChecks(categorical, lrVariables.Response)) + return ValidationInfo; + + //check transformations + CheckTransformations(lrVariables.ResponseTransformation, lrVariables.Response); + + if (lrVariables.Covariates != null) + { + CheckTransformations(lrVariables.CovariateTransformation, lrVariables.Covariates, true); + } + + //do data checks on the treatments/other factors and covariate (if selected) + if (lrVariables.Covariates != null) + { + foreach (string covariate in lrVariables.Covariates) + { + if (!CategoricalAgainstContinuousVariableChecks(categorical, covariate)) + return ValidationInfo; + } + } + + if (lrVariables.Covariates != null && String.IsNullOrEmpty(lrVariables.PrimaryFactor)) + { + ValidationInfo.AddErrorMessage("You have selected a covariate but no primary factor is selected."); + } + + if (!String.IsNullOrEmpty(lrVariables.ComparisonsBackToControl) && String.IsNullOrEmpty(lrVariables.ControlGroup)) + { + ValidationInfo.AddErrorMessage("You have selected to compare back to a control but no control group is selected."); + } + + //if get here then no errors so return true + return ValidationInfo; + } + + private bool CategoricalAgainstContinuousVariableChecks(List categorical, string continuous) + { + foreach (string catFactor in categorical) //go through each categorical factor and do the check on each + { + string factorType; + if (lrVariables.Treatments.Contains(catFactor)) + { + factorType = ReflectionExtensions.GetPropertyDisplayName(i => i.Treatments); + } + else + { + factorType = ReflectionExtensions.GetPropertyDisplayName(i => i.OtherDesignFactors); + } + + string responseType; + if (lrVariables.Response.Contains(continuous)) + { + responseType = ReflectionExtensions.GetPropertyDisplayName(i => i.Response); + } + else + { + responseType = ReflectionExtensions.GetPropertyDisplayName(i => i.Covariates); + } + + //Now that the whole column checks have been done, ensure that the treatment and response for each row is ok + List categoricalRow = new List(); + List continuousRow = new List(); + + foreach (DataRow row in DataTable.Rows) //assemble a list of the categorical data and the continuous data... + { + categoricalRow.Add(row[catFactor].ToString()); + continuousRow.Add(row[continuous].ToString()); + } + + for (int i = 0; i < DataTable.Rows.Count; i++) //use for loop cos its easier to compare the indexes of the cat and cont rows + { + //Check that the "response" does not contains non-numeric data + bool parsedOK = Double.TryParse(continuousRow[i], out double parsedValue); + if (!String.IsNullOrEmpty(continuousRow[i]) && !parsedOK) + { + ValidationInfo.AddErrorMessage("The " + responseType + " (" + continuous + ") contain non-numerical data which cannot be processed. Please check the input data and make sure the data was entered correctly."); + return false; + } + + //Check that there are no responses where the treatments are blank + if (String.IsNullOrEmpty(categoricalRow[i]) && !String.IsNullOrEmpty(continuousRow[i])) + { + ValidationInfo.AddErrorMessage("The " + factorType + " (" + catFactor + ") contains missing data where there are observations present in the " + responseType + ". Please check the input data and make sure the data was entered correctly."); + return false; + } + + //check that the "response" contains data for each "treatment" (not fatal) + if (!String.IsNullOrEmpty(categoricalRow[i]) && String.IsNullOrEmpty(continuousRow[i])) + { + string mess = "The " + responseType + " (" + continuous + ") contains missing data."; + if (responseType == "Covariate") + { + mess = mess + " Any response that does not have a corresponding covariate will be excluded from the analysis."; + } + + ValidationInfo.AddWarningMessage(mess); + } + } + } + + //if got here then all checks ok, return true + return true; + } + } +} \ No newline at end of file diff --git a/SilveR/Views/Analyses/LinearRegressionAnalysis.cshtml b/SilveR/Views/Analyses/LinearRegressionAnalysis.cshtml index 971a7fbfb..6abd456f8 100644 --- a/SilveR/Views/Analyses/LinearRegressionAnalysis.cshtml +++ b/SilveR/Views/Analyses/LinearRegressionAnalysis.cshtml @@ -90,7 +90,7 @@
-

Covariate

+

Covariates

diff --git a/SilveR/Views/Analyses/LogisticRegressionAnalysis.cshtml b/SilveR/Views/Analyses/LogisticRegressionAnalysis.cshtml new file mode 100644 index 000000000..05c1275f7 --- /dev/null +++ b/SilveR/Views/Analyses/LogisticRegressionAnalysis.cshtml @@ -0,0 +1,202 @@ +@model SilveR.StatsModels.LogisticRegressionAnalysisModel + +@section Scripts { + + + + + + + + + +} + +@{ + ViewBag.Title = "Logistic Regression Analysis"; +} + +
+
+

@ViewBag.Title

+
+
+ Help +
+
+ +
+ + @await Html.PartialAsync("AnalysisErrors") + + + +
+
+ +
+
Input Options
+
+

Response

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +

Factors

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
Interactions
+
+ +
+
+
+ +
+ +
+
+
+
+ +

Covariates

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
Output Options
+
+

Overall Results

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +

Selected Effect Results

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +

Post Hoc Tests

+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/SilveR/Views/Analyses/RepeatedMeasuresParametricAnalysis.cshtml b/SilveR/Views/Analyses/RepeatedMeasuresParametricAnalysis.cshtml index cc96ee19f..900aef1b3 100644 --- a/SilveR/Views/Analyses/RepeatedMeasuresParametricAnalysis.cshtml +++ b/SilveR/Views/Analyses/RepeatedMeasuresParametricAnalysis.cshtml @@ -93,7 +93,7 @@

-

Covariate

+

Covariates

diff --git a/SilveR/Views/Shared/_Layout.cshtml b/SilveR/Views/Shared/_Layout.cshtml index f65ec8b56..66a51e3c2 100644 --- a/SilveR/Views/Shared/_Layout.cshtml +++ b/SilveR/Views/Shared/_Layout.cshtml @@ -71,6 +71,7 @@
  • Unpaired t-test Analysis
  • Correlation Analysis
  • Linear Regression Analysis
  • +
  • Logistic Regression Analysis
  • Dose-response and Non-linear Regression Analysis
  • One-sample t-test Analysis
  • diff --git a/SilveR/bundleconfig.json b/SilveR/bundleconfig.json index 8357be27f..22f4cd877 100644 --- a/SilveR/bundleconfig.json +++ b/SilveR/bundleconfig.json @@ -91,6 +91,13 @@ "wwwroot/js/openLinks.js" ] }, + { + "outputFileName": "wwwroot/js/stats/logisticRegressionAnalysis.min.js", + "inputFiles": [ + "wwwroot/js/stats/logisticRegressionAnalysis.js", + "wwwroot/js/openLinks.js" + ] + }, { "outputFileName": "wwwroot/js/stats/comparisonOfMeansPowerAnalysisDatasetBasedInputs.min.js", "inputFiles": [ diff --git a/SilveR/wwwroot/js/stats/logisticRegressionAnalysis.js b/SilveR/wwwroot/js/stats/logisticRegressionAnalysis.js new file mode 100644 index 000000000..47947db22 --- /dev/null +++ b/SilveR/wwwroot/js/stats/logisticRegressionAnalysis.js @@ -0,0 +1,185 @@ +$(function () { + jQuery.ajaxSettings.traditional = true + + $("#Response").kendoDropDownList({ + dataSource: theModel.availableVariablesAllowNull + }); + + $("#ResponseTransformation").kendoDropDownList({ + dataSource: theModel.transformationsList, + change: function () { + const covariateTransformation = $("#CovariateTransformation").data("kendoDropDownList"); + covariateTransformation.value($("#ResponseTransformation").val()); + } + }); + + $("#Treatments").kendoMultiSelect({ + dataSource: theModel.availableVariables, + value: theModel.treatments, + change: treatmentsChanged + }); + + $("#OtherDesignFactors").kendoMultiSelect({ + dataSource: theModel.availableVariables, + value: theModel.otherDesignFactors + }); + + $("#ContinuousFactors").kendoMultiSelect({ + dataSource: theModel.availableVariables, + value: theModel.continuousFactors + }); + + $("#ContinuousFactorsTransformation").kendoDropDownList({ + dataSource: theModel.transformationsList + }); + + $("#Covariates").kendoMultiSelect({ + dataSource: theModel.availableVariables, + value: theModel.covariates, + change: covariateBlockEnableDisable + }); + + const primaryFactorDropdown = $("#PrimaryFactor").kendoDropDownList({ + dataSource: theModel.treatments, + value: theModel.primaryFactor + }).data("kendoDropDownList"); + primaryFactorDropdown.bind("dataBound", function (e) { + if (!this.value()) { + this.select(0); + } + }); + + $("#CovariateTransformation").kendoDropDownList({ + dataSource: theModel.transformationsList + }); + + $("#Significance").kendoDropDownList({ + dataSource: theModel.significancesList + }); + + const selectedEffect = $("#SelectedEffect").kendoDropDownList({ + dataSource: { + transport: { + read: { + url: "/Values/GetSMPASelectedEffectsList" + } + } + }, + change: selectedEffectChanged + }).data("kendoDropDownList"); + selectedEffect.bind("dataBound", function (e) { + if (selectedEffect.select() === -1) { + if (theModel.selectedEffect) { + selectedEffect.value(theModel.selectedEffect); + } + else { + selectedEffect.select(0); + } + } + + selectedEffect.enable(true); + + selectedEffectChanged(); + }); + + $("#AllPairwise").kendoDropDownList({ + dataSource: theModel.pairwiseTestList + }); + + $("#ComparisonsBackToControl").kendoDropDownList({ + dataSource: theModel.comparisonsBackToControlTestList + }); + + const controlGroup = $("#ControlGroup").kendoDropDownList({ + autoBind: false, + dataSource: { + transport: { + read: { + url: "/Values/GetLevels" + } + } + } + }).data("kendoDropDownList"); + controlGroup.bind("dataBound", function (e) { + controlGroup.value(theModel.controlGroup); + }); + + treatmentsChanged(); + + covariateBlockEnableDisable(); +}); + +function treatmentsChanged() { + const treatmentMultiSelect = $("#Treatments").data("kendoMultiSelect"); + + $.ajax({ + type: 'GET', + url: "/Values/GetSMPAInteractions", + data: { selectedTreatments: treatmentMultiSelect.dataItems() }, + success: function (data) { + var markup = ''; + for (var x = 0; x < data.length; x++) { + markup += ''; + } + + $('#Interactions').html(markup).show(); + } + }); + + + //treatments have changed so fill in the primary factor... + const primaryFactorDropDown = $("#PrimaryFactor").data("kendoDropDownList"); + primaryFactorDropDown.setDataSource($("#Treatments").data("kendoMultiSelect").dataItems()); + + //...and the selected effect + const selectedEffectDropDown = $("#SelectedEffect").data("kendoDropDownList"); + selectedEffectDropDown.dataSource.read({ + selectedTreatments: $("#Treatments").data("kendoMultiSelect").dataItems() + }); +} + +//if the selected effect is changed then fill in the control group +function selectedEffectChanged() { + + const controlGroup = $("#ControlGroup").data("kendoDropDownList"); + + controlGroup.value(null); + controlGroup.dataSource.read({ treatment: $("#SelectedEffect").val(), datasetID: $("#DatasetID").val(), includeNull: true }); + + selectedEffectsBlockEnableDisable(); +} + +function covariateBlockEnableDisable() { + const covariateDropDown = $("#Covariates"); + const primaryFactorDropDown = $("#PrimaryFactor").data("kendoDropDownList"); + const covariateTransformationDropDown = $("#CovariateTransformation").data("kendoDropDownList"); + + if (covariateDropDown.val().length > 0) { + primaryFactorDropDown.enable(true); + covariateTransformationDropDown.enable(true); + } + else { + primaryFactorDropDown.enable(false); + covariateTransformationDropDown.enable(false); + covariateTransformationDropDown.value("None"); + primaryFactorDropDown.value(null); + } +} + +function selectedEffectsBlockEnableDisable() { + const treatmentMultiSelect = $("#Treatments").data("kendoMultiSelect"); + const selectedEffectDropDown = $("#SelectedEffect").data("kendoDropDownList"); + const comparisonsBackToControl = $('#ComparisonsBackToControl').data("kendoDropDownList"); + const controlGroup = $('#ControlGroup').data("kendoDropDownList"); + + if (treatmentMultiSelect != null && treatmentMultiSelect.value().length > 0 && selectedEffectDropDown.value().indexOf("*") == -1) { + comparisonsBackToControl.enable(true); + controlGroup.enable(true); + } + else { + comparisonsBackToControl.enable(false); + controlGroup.enable(false); + comparisonsBackToControl.value(null); + controlGroup.value(null); + } +} \ No newline at end of file diff --git a/SilveR/wwwroot/js/stats/logisticRegressionAnalysis.min.js b/SilveR/wwwroot/js/stats/logisticRegressionAnalysis.min.js new file mode 100644 index 000000000..d06e84876 --- /dev/null +++ b/SilveR/wwwroot/js/stats/logisticRegressionAnalysis.min.js @@ -0,0 +1 @@ +function treatmentsChanged(){const n=$("#Treatments").data("kendoMultiSelect");$.ajax({type:"GET",url:"/Values/GetSMPAInteractions",data:{selectedTreatments:n.dataItems()},success:function(n){for(var i="",t=0;t'+n[t]+"<\/option>";$("#Interactions").html(i).show()}});const t=$("#PrimaryFactor").data("kendoDropDownList");t.setDataSource($("#Treatments").data("kendoMultiSelect").dataItems());const i=$("#SelectedEffect").data("kendoDropDownList");i.dataSource.read({selectedTreatments:$("#Treatments").data("kendoMultiSelect").dataItems()})}function selectedEffectChanged(){const n=$("#ControlGroup").data("kendoDropDownList");n.value(null);n.dataSource.read({treatment:$("#SelectedEffect").val(),datasetID:$("#DatasetID").val(),includeNull:!0});selectedEffectsBlockEnableDisable()}function covariateBlockEnableDisable(){const i=$("#Covariates"),n=$("#PrimaryFactor").data("kendoDropDownList"),t=$("#CovariateTransformation").data("kendoDropDownList");i.val().length>0?(n.enable(!0),t.enable(!0)):(n.enable(!1),t.enable(!1),t.value("None"),n.value(null))}function selectedEffectsBlockEnableDisable(){const i=$("#Treatments").data("kendoMultiSelect"),r=$("#SelectedEffect").data("kendoDropDownList"),n=$("#ComparisonsBackToControl").data("kendoDropDownList"),t=$("#ControlGroup").data("kendoDropDownList");i!=null&&i.value().length>0&&r.value().indexOf("*")==-1?(n.enable(!0),t.enable(!0)):(n.enable(!1),t.enable(!1),n.value(null),t.value(null))}function openItem(n){$.ajax({type:"POST",url:"/Values/OpenUrl",data:{url:n}})}$(function(){jQuery.ajaxSettings.traditional=!0;$("#Response").kendoDropDownList({dataSource:theModel.availableVariablesAllowNull});$("#ResponseTransformation").kendoDropDownList({dataSource:theModel.transformationsList,change:function(){const n=$("#CovariateTransformation").data("kendoDropDownList");n.value($("#ResponseTransformation").val())}});$("#Treatments").kendoMultiSelect({dataSource:theModel.availableVariables,value:theModel.treatments,change:treatmentsChanged});$("#OtherDesignFactors").kendoMultiSelect({dataSource:theModel.availableVariables,value:theModel.otherDesignFactors});$("#ContinuousFactors").kendoMultiSelect({dataSource:theModel.availableVariables,value:theModel.continuousFactors});$("#ContinuousFactorsTransformation").kendoDropDownList({dataSource:theModel.transformationsList});$("#Covariates").kendoMultiSelect({dataSource:theModel.availableVariables,value:theModel.covariates,change:covariateBlockEnableDisable});const i=$("#PrimaryFactor").kendoDropDownList({dataSource:theModel.treatments,value:theModel.primaryFactor}).data("kendoDropDownList");i.bind("dataBound",function(){this.value()||this.select(0)});$("#CovariateTransformation").kendoDropDownList({dataSource:theModel.transformationsList});$("#Significance").kendoDropDownList({dataSource:theModel.significancesList});const n=$("#SelectedEffect").kendoDropDownList({dataSource:{transport:{read:{url:"/Values/GetSMPASelectedEffectsList"}}},change:selectedEffectChanged}).data("kendoDropDownList");n.bind("dataBound",function(){n.select()===-1&&(theModel.selectedEffect?n.value(theModel.selectedEffect):n.select(0));n.enable(!0);selectedEffectChanged()});$("#AllPairwise").kendoDropDownList({dataSource:theModel.pairwiseTestList});$("#ComparisonsBackToControl").kendoDropDownList({dataSource:theModel.comparisonsBackToControlTestList});const t=$("#ControlGroup").kendoDropDownList({autoBind:!1,dataSource:{transport:{read:{url:"/Values/GetLevels"}}}}).data("kendoDropDownList");t.bind("dataBound",function(){t.value(theModel.controlGroup)});treatmentsChanged();covariateBlockEnableDisable()}); \ No newline at end of file diff --git a/Silver.UnitTests/Helpers/PdfGeneratorTests.cs b/Silver.UnitTests/Helpers/PdfGeneratorTests.cs deleted file mode 100644 index 2f5f822e0..000000000 --- a/Silver.UnitTests/Helpers/PdfGeneratorTests.cs +++ /dev/null @@ -1,23 +0,0 @@ -using SilveR.Helpers; -using System; -using System.Runtime.InteropServices; -using Xunit; - -namespace SilveR.UnitTests.Helpers -{ - public class PdfGeneratorTests - { - //[Fact] - //public void GeneratePdf_ReturnsBytes() - //{ - // if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - // { - // //Arrange, Act - // byte[] bytes = PdfGenerator.GeneratePdf(new Uri("http://google.com")); - - // //Assert - // Assert.True(bytes.Length > 0); - // } - //} - } -} \ No newline at end of file diff --git a/Silver.UnitTests/StatsModels/LogisticRegressionAnalysisModelTests.cs b/Silver.UnitTests/StatsModels/LogisticRegressionAnalysisModelTests.cs new file mode 100644 index 000000000..e1bb21004 --- /dev/null +++ b/Silver.UnitTests/StatsModels/LogisticRegressionAnalysisModelTests.cs @@ -0,0 +1,573 @@ +using Moq; +using SilveR.Models; +using SilveR.StatsModels; +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.Linq; +using Xunit; + +namespace SilveR.UnitTests.StatsModels +{ + public class LogisticRegressionAnalysisModelTests + { + [Fact] + public void ScriptFileName_ReturnsCorrectString() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = new LogisticRegressionAnalysisModel(); + + //Act + string result = sut.ScriptFileName; + + //Assert + Assert.Equal("LogisticRegressionAnalysis", result); + } + + [Fact] + public void TransformationsList_ReturnsCorrectList() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = new LogisticRegressionAnalysisModel(); + + //Act + IEnumerable result = sut.TransformationsList; + + //Assert + Assert.IsAssignableFrom>(result); + Assert.Equal(new List() { "None", "Log10", "Loge", "Square Root", "ArcSine", "Rank" }, result); + } + + [Fact] + public void SignificancesList_ReturnsCorrectList() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = new LogisticRegressionAnalysisModel(); + + //Act + IEnumerable result = sut.SignificancesList; + + //Assert + Assert.IsAssignableFrom>(result); + Assert.Equal(new List() { "0.1", "0.05", "0.01", "0.001" }, result); + } + + [Fact] + public void PairwiseTestList_ReturnsCorrectList() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = new LogisticRegressionAnalysisModel(); + + //Act + IEnumerable result = sut.PairwiseTestList; + + //Assert + Assert.IsAssignableFrom>(result); + Assert.Equal(new List() { String.Empty, "Unadjusted (LSD)", "Tukey", "Holm", "Hochberg", "Hommel", "Bonferroni", "Benjamini-Hochberg" }, result); + } + + [Fact] + public void ComparisonsBackToControlTestList_ReturnsCorrectList() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = new LogisticRegressionAnalysisModel(); + + //Act + IEnumerable result = sut.ComparisonsBackToControlTestList; + + //Assert + Assert.IsAssignableFrom>(result); + Assert.Equal(new List() { String.Empty, "Unadjusted (LSD)", "Dunnett", "Holm", "Hochberg", "Hommel", "Bonferroni", "Benjamini-Hochberg" }, result); + } + + [Fact] + public void ExportData_ReturnsCorrectStringArray() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + Mock mockDataset = new Mock(); + mockDataset.Setup(x => x.DatasetID).Returns(1); + mockDataset.Setup(x => x.DatasetToDataTable()).Returns(GetTestDataTable()); + + LogisticRegressionAnalysisModel sut = GetModel(mockDataset.Object); + sut.Treatments = new List() { "Treat1" }; + sut.ContinuousFactors = new List() { "Cont1" }; + sut.OtherDesignFactors = null; + sut.Covariates = null; + sut.SelectedEffect = "Treat1"; + + //Act + string[] result = sut.ExportData(); + + //Assert + Assert.Equal("Respivs_sp_ivs1,Treat1,catfact,scatterPlotColumn,mainEffect", result[0]); + Assert.Equal(79, result.Count()); //as blank reponses are removed + Assert.StartsWith("1.641107979,D1", result[32]); + + //scatterplot check + Assert.Contains(",D1,", result[24]); + + //mainEffect check + Assert.EndsWith(",D1", result[24]); + } + + [Fact] + public void ExportData_MultipleTreatments_ReturnsCorrectStringArray() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + Mock mockDataset = new Mock(); + mockDataset.Setup(x => x.DatasetID).Returns(1); + mockDataset.Setup(x => x.DatasetToDataTable()).Returns(GetTestDataTable()); + + LogisticRegressionAnalysisModel sut = GetModel(mockDataset.Object); + + //Act + string[] result = sut.ExportData(); + + //Assert + Assert.Equal("Respivs_sp_ivs1,Treat1,Treat2,Block3,Covivs_sp_ivs1,catfact,scatterPlotColumn,mainEffect", result[0]); + + //scatterplot check + Assert.Contains(",D1 F,", result[24]); + + //mainEffect check + Assert.EndsWith(",D1 F", result[24]); + } + + [Fact] + public void GetArguments_ReturnsCorrectArguments() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = GetModel(GetDataset()); + + //Act + List result = sut.GetArguments().ToList(); + + //Assert + var response = result.Single(x => x.Name == "Response"); + Assert.Equal("Resp 1", response.Value); + + var treatments = result.Single(x => x.Name == "Treatments"); + Assert.Equal("Treat1,Treat2", treatments.Value); + + var continuousFactors = result.Single(x => x.Name == "ContinuousFactors"); + Assert.Equal("Cont1", continuousFactors.Value); + + var continuousFactorsTransformation = result.Single(x => x.Name == "ContinuousFactorsTransformation"); + Assert.Equal("None", continuousFactorsTransformation.Value); + + var otherDesignFactors = result.Single(x => x.Name == "OtherDesignFactors"); + Assert.Equal("Block3", otherDesignFactors.Value); + + var covariates = result.Single(x => x.Name == "Covariates"); + Assert.Equal("Cov 1", covariates.Value); + + var responseTransformation = result.Single(x => x.Name == "ResponseTransformation"); + Assert.Equal("None", responseTransformation.Value); + + var covariateTransformation = result.Single(x => x.Name == "CovariateTransformation"); + Assert.Equal("None", covariateTransformation.Value); + + var primaryFactor = result.Single(x => x.Name == "PrimaryFactor"); + Assert.Equal("Treat1", primaryFactor.Value); + + var selectedEffect = result.Single(x => x.Name == "SelectedEffect"); + Assert.Equal("Treat1 * Treat2", selectedEffect.Value); + + var lsMeansSelected = result.Single(x => x.Name == "LSMeansSelected"); + Assert.Equal("False", lsMeansSelected.Value); + + var anovaSelected = result.Single(x => x.Name == "ANOVASelected"); + Assert.Equal("True", anovaSelected.Value); + + var significance = result.Single(x => x.Name == "Significance"); + Assert.Equal("0.05", significance.Value); + + var prPlotSelected = result.Single(x => x.Name == "TableOfOverallEffectTests"); + Assert.Equal("True", prPlotSelected.Value); + + var allPairwise = result.Single(x => x.Name == "AllPairwise"); + Assert.Equal("Tukey", allPairwise.Value); + + var comparisonsBackToControl = result.Single(x => x.Name == "ComparisonsBackToControl"); + Assert.Equal("Holm", comparisonsBackToControl.Value); + + var controlGroup = result.Single(x => x.Name == "ControlGroup"); + Assert.Equal("D1", controlGroup.Value); + + var generateComparisonsDataset = result.Single(x => x.Name == "GenerateComparisonsDataset"); + Assert.Equal("True", generateComparisonsDataset.Value); + } + + [Fact] + public void LoadArguments_ReturnsCorrectArguments() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = new LogisticRegressionAnalysisModel(GetDataset()); + + List arguments = new List(); + arguments.Add(new Argument { Name = "Response", Value = "Resp 1" }); + arguments.Add(new Argument { Name = "Treatments", Value = "Treat1,Treat2" }); + arguments.Add(new Argument { Name = "ContinuousFactors", Value = "Cont1" }); + arguments.Add(new Argument { Name = "ContinuousFactorsTransformation", Value = "None" }); + arguments.Add(new Argument { Name = "OtherDesignFactors", Value = "Treat3,Cat4" }); + arguments.Add(new Argument { Name = "ResponseTransformation", Value = "Log10" }); + arguments.Add(new Argument { Name = "Covariates", Value = "Resp3" }); + arguments.Add(new Argument { Name = "PrimaryFactor", Value = "Treat2" }); + arguments.Add(new Argument { Name = "CovariateTransformation", Value = "ArcSine" }); + arguments.Add(new Argument { Name = "ANOVASelected", Value = "False" }); + arguments.Add(new Argument { Name = "TableOfOverallEffectTests", Value = "True" }); + arguments.Add(new Argument { Name = "Significance", Value = "0.9" }); + arguments.Add(new Argument { Name = "SelectedEffect", Value = "Treat1 * Treat2" }); + arguments.Add(new Argument { Name = "LSMeansSelected", Value = "True" }); + arguments.Add(new Argument { Name = "AllPairwise", Value = "Tukey" }); + arguments.Add(new Argument { Name = "ComparisonsBackToControl", Value = "Bonferroni" }); + arguments.Add(new Argument { Name = "ControlGroup", Value = "A" }); + arguments.Add(new Argument { Name = "GenerateComparisonsDataset", Value = "True" }); + + Assert.Equal(18, arguments.Count); + + //Act + sut.LoadArguments(arguments); + + //Assert + Assert.Equal("Resp 1", sut.Response); + Assert.Equal(new List { "Treat1", "Treat2" }, sut.Treatments); + Assert.Equal(new List { "Cont1" }, sut.ContinuousFactors); + Assert.Equal("None", sut.ContinuousFactorsTransformation); + Assert.Equal(new List { "Treat3", "Cat4" }, sut.OtherDesignFactors); + Assert.Equal("Log10", sut.ResponseTransformation); + Assert.Equal(new List { "Resp3" }, sut.Covariates); + Assert.Equal("Treat2", sut.PrimaryFactor); + Assert.Equal("ArcSine", sut.CovariateTransformation); + Assert.False(sut.ANOVASelected); + Assert.True(sut.TableOfOverallEffectTests); + Assert.Equal("0.9", sut.Significance); + Assert.Equal("Treat1 * Treat2", sut.SelectedEffect); + Assert.True(sut.LSMeansSelected); + Assert.Equal("Tukey", sut.AllPairwise); + Assert.Equal("Bonferroni", sut.ComparisonsBackToControl); + Assert.Equal("A", sut.ControlGroup); + Assert.True(sut.GenerateComparisonsDataset); + } + + + [Fact] + public void GetCommandLineArguments_ReturnsCorrectString() + { + //Arrange + System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + LogisticRegressionAnalysisModel sut = GetModel(GetDataset()); + + //Act + string result = sut.GetCommandLineArguments(); + + //Assert + + Assert.Equal("Respivs_sp_ivs1~Covivs_sp_ivs1+Block3+Treat1+Treat2+Treat1*Treat2 Respivs_sp_ivs1~scatterPlotColumn Covivs_sp_ivs1 None None Treat1 Treat1,Treat2 Cont1 None Block3 Y Y 0.05 Respivs_sp_ivs1~Covivs_sp_ivs1+Block3+mainEffect Treat1ivs_sp_ivs*ivs_sp_ivsTreat2 N Tukey Holm D1 Y", result); + } + + private LogisticRegressionAnalysisModel GetModel(IDataset dataset) + { + var model = new LogisticRegressionAnalysisModel(dataset) + { + ANOVASelected = true, + AllPairwise = "Tukey", + ComparisonsBackToControl = "Holm", + ControlGroup = "D1", + ContinuousFactors = new List + { + "Cont1" + }, + ContinuousFactorsTransformation = "None", + CovariateTransformation = "None", + Covariates = new System.Collections.Generic.List + { + "Cov 1" + }, + LSMeansSelected = false, + OtherDesignFactors = new System.Collections.Generic.List + { + "Block3" + }, + TableOfOverallEffectTests = true, + PrimaryFactor = "Treat1", + Response = "Resp 1", + ResponseTransformation = "None", + SelectedEffect = "Treat1 * Treat2", + Significance = "0.05", + Treatments = new System.Collections.Generic.List + { + "Treat1", + "Treat2" + }, + GenerateComparisonsDataset = true + }; + + return model; + } + + private DataTable GetTestDataTable() + { + DataTable dt = new DataTable(); + dt.Columns.Add("SilveRSelected"); + dt.Columns.Add("Resp 1"); + dt.Columns.Add("Resp7"); + dt.Columns.Add("Resp8"); + dt.Columns.Add("Resp1 2"); + dt.Columns.Add("Treat1"); + dt.Columns.Add("Treat2"); + dt.Columns.Add("Treat3"); + dt.Columns.Add("Treat8"); + dt.Columns.Add("Treat9"); + dt.Columns.Add("Treat10"); + dt.Columns.Add("Treat11"); + dt.Columns.Add("Treat 15"); + dt.Columns.Add("Treat16"); + dt.Columns.Add("Blo ck1"); + dt.Columns.Add("Blo ck2"); + dt.Columns.Add("Block3"); + dt.Columns.Add("Block4"); + dt.Columns.Add("Cov 1"); + dt.Columns.Add("Cov3"); + dt.Columns.Add("Cov6"); + dt.Columns.Add("Treat1Treat2"); + dt.Columns.Add("Treat1Treat2Treat3"); + dt.Columns.Add("Treat9Treat10"); + dt.Columns.Add("Treat9Treat10Treat11"); + dt.Columns.Add("Resp 2"); + dt.Columns.Add("Resp3"); + dt.Columns.Add("Resp4"); + dt.Columns.Add("Resp5"); + dt.Columns.Add("Resp6"); + dt.Columns.Add("Resp9"); + dt.Columns.Add("Resp10"); + dt.Columns.Add("Resp11"); + dt.Columns.Add("Tre at4"); + dt.Columns.Add("T reat5"); + dt.Columns.Add("Treat6"); + dt.Columns.Add("Treat7"); + dt.Columns.Add("Treat12"); + dt.Columns.Add("Treat13"); + dt.Columns.Add("Treat14"); + dt.Columns.Add("Cov2"); + dt.Columns.Add("Cov4"); + dt.Columns.Add("Cov5"); + dt.Columns.Add("Treat 20"); + dt.Columns.Add("Treat 21"); + dt.Columns.Add("Treat 17"); + dt.Columns.Add("Treat 18"); + dt.Columns.Add("Treat 19"); + dt.Columns.Add("Resp 13"); + dt.Columns.Add("Resp14"); + dt.Columns.Add("Resp15"); + dt.Columns.Add("Treat22"); + dt.Columns.Add("Treat23"); + dt.Columns.Add("Cov7"); + dt.Columns.Add("PVTestResponse1a"); + dt.Columns.Add("PVTestResponse1b"); + dt.Columns.Add("PVTestGroup1"); + dt.Columns.Add("PVTestResponse2"); + dt.Columns.Add("PVTEstCovariate2a"); + dt.Columns.Add("PVTEstCovariate2b"); + dt.Columns.Add("PVTEstGroup2"); + dt.Columns.Add("CVResp"); + dt.Columns.Add("CVTreat1"); + dt.Columns.Add("CVTreat2"); + dt.Columns.Add("CVTreat3"); + dt.Columns.Add("CVTreat4"); + dt.Columns.Add("IFResp"); + dt.Columns.Add("IFTreat1"); + dt.Columns.Add("IFTreat2"); + dt.Columns.Add("IFTreat3"); + dt.Columns.Add("IFTreat4"); + dt.Rows.Add(new object[] { "True", "1.170460288", "0.603046662673043", "0.812263122833665", "1.170460288", "D0", "F", "TG", "C", "3", "1", "3", "A", "A", "Bk1", "Bk3", "1", "2", "0.251420288", "0.251420288", "0.653915157", "D0 F", "D0 F TG", "3 1", "3 1 3", "1.170460288", "1.170460288", "1.170460288", "1.170460288", "", "0.603046662673043", "0.356118785", "0.653915157", "D0", "D10", "D0", "D0", "D0", "F", "A", "0.251420288", "0.251420288", "0.251420288", "A", "A", "1", "q", "1", "0.0963639699688432", "0.278027714537481", "", "A", "1", "0.266515860849041", "1", "1", "1", "1", "1", "1", "1", "15", "A", "A", "1", "1", "15", "A", "A", "1", "1", }); + dt.Rows.Add(new object[] { "True", "1.301819998", "0.732601111951696", "0.447456349428076", "1.301819998", "D0", "F", "TG", "C", "3", "2", "1", "A", "B", "Bk1", "Bk1", "1", "2", "0.409977995", "0.409977995", "0.142751504", "D0 F", "D0 F TG", "3 2", "3 2 1", "1.301819998", "1.301819998", "1.301819998", "1.301819998", "", "0.732601111951696", "0.312079363", "0.142751504", "D0", "D10", "D0", "D0", "D0", "F", "A", "0.409977995", "0.409977995", "0.409977995", "B", "A", "1", "q", "1", "0.055568871198945", "0.382898816060915", "0.4545333335297", "A", "2", "0.460971770762763", "2", "2", "1", "2", "1", "2", "1", "16", "A", "A", "1", "1", "16", "A", "A", "1", "1", }); + dt.Rows.Add(new object[] { "True", "1.716827101", "0.940090281116573", "0.856354376025044", "1.716827101", "D0", "F", "TG", "C", "1", "1", "3", "A", "C", "Bk2", "Bk1", "2", "2", "0.67927756", "0.67927756", "0.56603235", "D0 F", "D0 F TG", "1 1", "1 1 3", "1.716827101", "1.716827101", "1.716827101", "1.716827101", "", "0.940090281116573", "0.54865642", "0.56603235", "D0", "D10", "D0", "D0", "D0", "F", "B", "0.67927756", "0.67927756", "0.67927756", "C", "A", "1", "q", "1", "0.460559914997265", "0.901288338592629", "0.863833239608352", "A", "3", "0.82953383870103", "3", "3", "1", "3", "3", "3", "1", "16", "A", "A", "1", "1", "16", "A", "A", "1", "1", }); + dt.Rows.Add(new object[] { "True", "1.170287058", "0.837977845863444", "0.467653941957621", "1.170287058", "D0", "F", "TG", "C", "1", "2", "1", "A", "D", "Bk2", "Bk2", "2", "2", "0.39624008", "0.39624008", "0.044637798", "D0 F", "D0 F TG", "1 2", "1 2 1", "1.170287058", "1.170287058", "1.170287058", "1.170287058", "", "0.837977845863444", "0.215032411", "0.044637798", "D0", "D10", "D0", "D0", "D0", "F", "B", "0.39624008", "0.39624008", "0.39624008", "A", "B", "1", "q", "1", "0.833652566364452", "0.571433306935469", "0.530353535439734", "A", "4", "0.610715057182273", "4", "4", "1", "4", "4", "4", "1", "14", "A", "A", "1", "1", "14", "A", "A", "1", "1", }); + dt.Rows.Add(new object[] { "True", "1.385523855", "0.0868474776039534", "0.680134733131071", "1.385523855", "D0", "F", "WT", "C", "3", "2", "2", "B", "A", "Bk1", "Bk2", "1", "2", "0.605211369", "0.605211369", "0.543254157", "D0 F", "D0 F WT", "3 2", "3 2 2", "1.385523855", "1.385523855", "1.385523855", "1.385523855", "", "0.0868474776039534", "0.173845019", "0.543254157", "D0", "D10", "D0", "D0", "D0", "F", "C", "0.605211369", "0.605211369", "0.605211369", "B", "B", "1", "q", "1", "0.656724285795664", "0.623802661315602", "0.313150319999142", "B", "1", "0.982069409206542", "11", "10", "2", "5", "5", "5", "1", "18", "A", "B", "1", "2", "18", "A", "B", "1", "2", }); + dt.Rows.Add(new object[] { "True", "1.441107979", "0.140404548426278", "0.814541080250263", "1.441107979", "D0", "F", "WT", "C", "3", "2", "3", "B", "B", "Bk1", "Bk3", "1", "2", "0.992180305", "0.992180305", "0.854148137", "D0 F", "D0 F WT", "3 2", "3 2 3", "1.441107979", "1.441107979", "1.441107979", "1.441107979", "", "0.140404548426278", "0.51040045", "0.854148137", "D0", "D10", "D0", "D0", "D0", "F", "C", "0.992180305", "0.992180305", "0.992180305", "C", "B", "1", "q", "1", "0.0220536192463925", "0.509256720353518", "0.174567990309805", "B", "2", "0.0906698179316803", "12", "11", "2", "6", "10", "11", "2", "17", "A", "B", "1", "2", "17", "A", "B", "1", "2", }); + dt.Rows.Add(new object[] { "True", "1.600527038", "0.991751224880621", "0.0406909657925691", "1.600527038", "D0", "F", "WT", "C", "1", "2", "2", "B", "C", "Bk2", "Bk3", "2", "2", "0.685151304", "0.685151304", "0.339916355", "D0 F", "D0 F WT", "1 2", "1 2 2", "1.600527038", "1.600527038", "1.600527038", "1.600527038", "", "0.991751224880621", "0.599137419", "4.7", "D0", "D10", "D0", "D0", "D0", "F", "C", "0.685151304", "0.685151304", "0.685151304", "A", "A", "2", "q", "1", "0.842352893043648", "0.568714855332386", "0.447862518907233", "B", "3", "0.0857534395418158", "13", "12", "2", "7", "11", "11", "2", "16", "A", "B", "1", "2", "16", "A", "B", "1", "2", }); + dt.Rows.Add(new object[] { "True", "1.570742573", "0.200106552575097", "0.837302048821571", "1.570742573", "D0", "F", "WT", "C", "1", "2", "3", "B", "D", "Bk2", "Bk1", "2", "2", "0.082280725", "0.082280725", "0.845987397", "D0 F", "D0 F WT", "1 2", "1 2 3", "1.570742573", "1.570742573", "1.570742573", "1.570742573", "", "0.200106552575097", "0.529847741", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.082280725", "0.082280725", "0.082280725", "B", "A", "2", "q", "1", "0.633353259254585", "0.471160037557914", "0.799330721856125", "B", "4", "0.815363668618568", "14", "13", "2", "9", "12", "12", "2", "18", "A", "B", "1", "2", "18", "A", "B", "1", "2", }); + dt.Rows.Add(new object[] { "True", "1.332792864", "0.124397094477086", "0.81927613782916", "1.332792864", "D0", "M", "TG", "C", "3", "3", "1", "C", "A", "Bk1", "Bk1", "1", "2", "0.414097984", "0.414097984", "0.817811302", "D0 M", "D0 M TG", "3 3", "3 3 1", "1.332792864", "1.332792864", "1.332792864", "1.332792864", "", "0.124397094477086", "0.800183941", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.414097984", "0.414097984", "0.414097984", "C", "A", "2", "q", "1", "0.445749520430521", "0.669680856480915", "0.539921016509775", "C", "1", "0.569032842718968", "", "", "", "10", "14", "14", "2", "17", "A", "C", "1", "3", "17", "A", "C", "1", "3", }); + dt.Rows.Add(new object[] { "True", "1.570048439", "0.915191859457472", "0.322276620180147", "1.570048439", "D0", "M", "TG", "C", "3", "3", "2", "C", "B", "Bk1", "Bk2", "1", "2", "0.067631666", "0.067631666", "0.906066356", "D0 M", "D0 M TG", "3 3", "3 3 2", "1.570048439", "1.570048439", "1.570048439", "1.570048439", "", "0.915191859457472", "0.936126132", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.067631666", "0.067631666", "0.067631666", "A", "B", "2", "q", "1", "0.960898386360586", "0.927068315067787", "0.835127944324997", "C", "2", "0.276453652553175", "", "", "", "11", "14", "14", "2", "14", "A", "C", "1", "3", "14", "A", "C", "1", "3", }); + dt.Rows.Add(new object[] { "True", "1.657046361", "0.31057873183634", "0.290013789221723", "1.657046361", "D0", "M", "TG", "C", "3", "3", "3", "C", "C", "Bk1", "Bk3", "1", "2", "0.421922675", "0.421922675", "0.969396829", "D0 M", "D0 M TG", "3 3", "3 3 3", "1.657046361", "1.657046361", "1.657046361", "1.657046361", "", "0.31057873183634", "0.689009069", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.421922675", "0.421922675", "0.421922675", "B", "B", "2", "q", "1", "0.78912845700754", "0.0158878081728098", "0.0396830829024308", "C", "3", "0.551358413198525", "", "", "", "", "", "", "", "15", "A", "C", "1", "3", "15", "A", "C", "1", "3", }); + dt.Rows.Add(new object[] { "True", "1.474137613", "0.457779840024549", "0.35474847665096", "1.474137613", "D0", "M", "TG", "C", "1", "3", "1", "C", "D", "Bk2", "Bk2", "2", "2", "0.290327192", "0.290327192", "0.718713971", "D0 M", "D0 M TG", "1 3", "1 3 1", "1.474137613", "1.474137613", "1.474137613", "1.474137613", "", "0.457779840024549", "0.653549271", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.290327192", "0.290327192", "0.290327192", "C", "B", "2", "q", "1", "0.690175209937228", "0.910114831266688", "0.463997388330815", "C", "4", "0.6553448539872", "", "", "", "", "", "", "", "0.769798133953462", "A", "C", "1", "3", "0.769798133953462", "A", "C", "1", "3", }); + dt.Rows.Add(new object[] { "True", "1.716827101", "0.0671358810975891", "0.196116189081307", "1.716827101", "D0", "M", "TG", "C", "1", "3", "2", "A", "A", "Bk2", "Bk3", "2", "2", "0.51467703", "0.51467703", "0.076617146", "D0 M", "D0 M TG", "1 3", "1 3 2", "1.716827101", "1.716827101", "1.716827101", "1.716827101", "", "0.0671358810975891", "0.701238702", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.51467703", "0.51467703", "0.51467703", "A", "A", "1", "w", "1", "0.498938084387785", "0.796378731040055", "0.383186751654319", "A", "1", "0.475746521294949", "", "", "", "", "", "", "", "0.197990831502153", "B", "A", "2", "1", "0.197990831502153", "B", "A", "2", "1", }); + dt.Rows.Add(new object[] { "True", "1.170287058", "0.552815259422122", "0.268419967518355", "1.170287058", "D0", "M", "TG", "C", "1", "3", "3", "A", "B", "Bk2", "Bk1", "2", "2", "0.85443754", "0.85443754", "0.713506941", "D0 M", "D0 M TG", "1 3", "1 3 3", "1.170287058", "1.170287058", "1.170287058", "1.170287058", "", "0.552815259422122", "0.668313021", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.85443754", "0.85443754", "0.85443754", "B", "A", "1", "w", "1", "0.653181551542021", "0.423402022771651", "0.1657508367955", "A", "2", "0.0377149362295359", "", "", "", "", "", "", "", "0.554259094477103", "B", "A", "2", "1", "0.554259094477103", "B", "A", "2", "1", }); + dt.Rows.Add(new object[] { "True", "1.063642468", "0.40505236469072", "0.43675094654099", "1.063642468", "D0", "M", "WT", "C", "1", "1", "1", "A", "C", "Bk1", "Bk1", "2", "2", "0.913914896", "0.913914896", "0.329648291", "D0 M", "D0 M WT", "1 1", "1 1 1", "1.063642468", "1.063642468", "1.063642468", "1.063642468", "", "0.40505236469072", "0.65758256", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.913914896", "0.913914896", "0.913914896", "C", "A", "1", "w", "1", "0.828401322932965", "0.758984970689022", "0.570932178887405", "A", "3", "0.488316263753079", "", "", "", "", "", "", "", "0.0992525187210886", "B", "A", "2", "1", "0.0992525187210886", "B", "A", "2", "1", }); + dt.Rows.Add(new object[] { "True", "1.244007576", "0.230600627561462", "0.542372979062827", "1.244007576", "D0", "M", "WT", "C", "1", "1", "2", "A", "D", "Bk1", "Bk2", "2", "2", "0.769521225", "0.769521225", "0.109290024", "D0 M", "D0 M WT", "1 1", "1 1 2", "1.244007576", "1.244007576", "1.244007576", "1.244007576", "", "0.230600627561462", "0.687190506", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.769521225", "0.769521225", "0.769521225", "A", "B", "1", "w", "1", "0.655656631561048", "0.207091476886771", "0.405726381451844", "A", "4", "0.818069299239549", "", "", "", "", "", "", "", "0.212098806370527", "B", "A", "2", "1", "0.212098806370527", "B", "A", "2", "1", }); + dt.Rows.Add(new object[] { "True", "1.600527038", "0.409989784660779", "0.363827997768341", "1.600527038", "D0", "M", "WT", "C", "2", "1", "1", "B", "A", "Bk2", "Bk2", "2", "2", "0.642408987", "0.642408987", "0.411345052", "D0 M", "D0 M WT", "2 1", "2 1 1", "1.600527038", "1.600527038", "1.600527038", "1.600527038", "", "0.409989784660779", "0.56299766", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.642408987", "0.642408987", "0.642408987", "B", "B", "1", "w", "1", "0.361329036696993", "0.533840704023495", "0.953779792403675", "B", "1", "0.00533938209867824", "", "", "", "", "", "", "", "0.271795352264463", "B", "B", "2", "2", "0.271795352264463", "B", "B", "2", "2", }); + dt.Rows.Add(new object[] { "True", "0.987369833", "0.721002153505759", "0.366093082878754", "0.987369833", "D0", "M", "WT", "C", "2", "1", "2", "B", "B", "Bk2", "Bk3", "2", "2", "0.309986757", "0.309986757", "0.432802217", "D0 M", "D0 M WT", "2 1", "2 1 2", "0.987369833", "0.987369833", "0.987369833", "0.987369833", "", "0.721002153505759", "0.031078452", "", "D0", "D10", "D0", "D0", "D0", "F", "", "0.309986757", "0.309986757", "0.309986757", "C", "B", "1", "w", "1", "0.517823156415715", "0.412124455647062", "", "B", "2", "0.314792053499413", "", "", "", "", "", "", "", "0.646576484947105", "B", "B", "2", "2", "0.646576484947105", "B", "B", "2", "2", }); + dt.Rows.Add(new object[] { "True", "1.370460288", "0.173476580058291", "0.611493952241674", "1.370460288", "D1", "F", "TG", "C", "2", "1", "3", "B", "C", "Bk1", "Bk1", "2", "2", "0.591264809", "0.591264809", "0.817789771", "D1 F", "D1 F TG", "2 1", "2 1 3", "1.370460288", "1.370460288", "1.370460288", "1.370460288", "", "0.173476580058291", "0.761898632", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.591264809", "0.591264809", "0.591264809", "A", "A", "2", "w", "1", "0.421485135586719", "0.223131585308148", "0.604421955892524", "B", "3", "0.297345070720787", "", "", "", "", "", "", "", "0.711940041021504", "B", "B", "2", "2", "0.711940041021504", "B", "B", "2", "2", }); + dt.Rows.Add(new object[] { "True", "1.501819998", "0.924819752477296", "0.693431965484925", "1.501819998", "D1", "F", "TG", "C", "2", "2", "1", "B", "D", "Bk1", "Bk2", "2", "1", "0.023013687", "0.023013687", "0.204990012", "D1 F", "D1 F TG", "2 2", "2 2 1", "1.501819998", "1.501819998", "1.501819998", "1.501819998", "", "0.924819752477296", "0.724670977", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.023013687", "0.023013687", "0.023013687", "B", "A", "2", "w", "1", "0.223104382188778", "0.446342939965881", "0.393322765968075", "B", "4", "0.423044796969845", "", "", "", "", "", "", "", "0.399996653032867", "B", "B", "2", "2", "0.399996653032867", "B", "B", "2", "2", }); + dt.Rows.Add(new object[] { "True", "1.585523855", "0.866116079524865", "0.406660027450881", "1.585523855", "D1", "F", "TG", "C", "2", "2", "2", "C", "A", "Bk1", "Bk3", "2", "1", "0.228751128", "0.228751128", "0.656070241", "D1 F", "D1 F TG", "2 2", "2 2 2", "1.585523855", "1.585523855", "1.585523855", "1.585523855", "", "0.866116079524865", "0.418230806", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.228751128", "0.228751128", "0.228751128", "C", "A", "2", "w", "1", "0.79754182737605", "0.048309956327143", "0.26307052257456", "C", "1", "0.0745085346038588", "", "", "", "", "", "", "", "0.206104672676506", "B", "C", "2", "3", "0.206104672676506", "B", "C", "2", "3", }); + dt.Rows.Add(new object[] { "True", "1.370460288", "0.861827198686888", "0.445787308470098", "1.370460288", "D1", "F", "TG", "C", "3", "2", "1", "C", "B", "Bk2", "Bk2", "2", "1", "0.833876926", "0.833876926", "0.907028247", "D1 F", "D1 F TG", "3 2", "3 2 1", "1.370460288", "1.370460288", "1.370460288", "1.370460288", "", "0.861827198686888", "0.587689207", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.833876926", "0.833876926", "0.833876926", "A", "B", "2", "w", "1", "0.504961249533863", "0.713563195886542", "0.442979672293395", "C", "2", "0.450267041974058", "", "", "", "", "", "", "", "0.853307895519926", "B", "C", "2", "3", "0.853307895519926", "B", "C", "2", "3", }); + dt.Rows.Add(new object[] { "True", "1.501819998", "0.216245303930937", "0.288483484835275", "1.501819998", "D1", "F", "TG", "C", "3", "2", "2", "C", "C", "Bk2", "Bk3", "2", "1", "0.716614275", "0.716614275", "0.36104316", "D1 F", "D1 F TG", "3 2", "3 2 2", "1.501819998", "1.501819998", "1.501819998", "1.501819998", "", "0.216245303930937", "0.135744804", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.716614275", "0.716614275", "0.716614275", "B", "B", "2", "w", "1", "0.485003815403439", "0.452921774306074", "0.715071534046262", "C", "3", "0.193689739098456", "", "", "", "", "", "", "", "0.712220632343034", "B", "C", "2", "3", "0.712220632343034", "B", "C", "2", "3", }); + dt.Rows.Add(new object[] { "True", "1.370460288", "0.956456905733308", "0.407631567238776", "1.370460288", "D1", "F", "TG", "C", "3", "2", "3", "C", "D", "Bk2", "Bk1", "2", "1", "0.080120144", "0.080120144", "0.345314335", "D1 F", "D1 F TG", "3 2", "3 2 3", "1.370460288", "1.370460288", "1.370460288", "1.370460288", "", "0.956456905733308", "0.01620344", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.080120144", "0.080120144", "0.080120144", "C", "B", "2", "w", "1", "0.982463942051801", "0.979450197245469", "", "C", "4", "0.267900675105304", "", "", "", "", "", "", "", "0.223704319346075", "B", "C", "2", "3", "0.223704319346075", "B", "C", "2", "3", }); + dt.Rows.Add(new object[] { "True", "1.641107979", "0.337344013697215", "0.0194565951037273", "1.641107979", "D1", "F", "WT", "C", "2", "2", "3", "A", "A", "Bk1", "Bk1", "2", "1", "0.776155131", "0.776155131", "0.468548418", "D1 F", "D1 F WT", "2 2", "2 2 3", "1.641107979", "1.641107979", "1.641107979", "1.641107979", "", "0.337344013697215", "0.477167012", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.776155131", "0.776155131", "0.776155131", "A", "A", "1", "q", "2", "0.496971408277598", "", "", "", "", "", "", "", "", "", "", "", "", "0.136412249865606", "C", "A", "3", "1", "0.136412249865606", "C", "A", "3", "1", }); + dt.Rows.Add(new object[] { "True", "1.532792864", "0.266885520346394", "0.294547513706064", "1.532792864", "D1", "F", "WT", "C", "2", "3", "1", "A", "B", "Bk1", "Bk2", "2", "1", "0.830872442", "0.830872442", "0.895445179", "D1 F", "D1 F WT", "2 3", "2 3 1", "1.532792864", "1.532792864", "1.532792864", "1.532792864", "", "0.266885520346394", "0.825342034", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.830872442", "0.830872442", "0.830872442", "B", "A", "1", "q", "2", "0.98256748110733", "", "", "", "", "", "", "", "", "", "", "", "", "0.747410595516353", "C", "A", "3", "1", "0.747410595516353", "C", "A", "3", "1", }); + dt.Rows.Add(new object[] { "True", "1.501819998", "0.574598206821078", "0.560948852023722", "1.501819998", "D1", "F", "WT", "C", "3", "3", "1", "A", "C", "Bk2", "Bk2", "2", "1", "0.071264197", "0.071264197", "0.011729616", "D1 F", "D1 F WT", "3 3", "3 3 1", "1.501819998", "1.501819998", "1.501819998", "1.501819998", "", "0.574598206821078", "0.543407026", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.071264197", "0.071264197", "0.071264197", "C", "A", "1", "q", "2", "0.0632516959529705", "", "", "", "", "", "", "", "", "", "", "", "", "0.448268661351918", "C", "A", "3", "1", "0.448268661351918", "C", "A", "3", "1", }); + dt.Rows.Add(new object[] { "True", "1.585523855", "0.340316189802516", "0.290002724973979", "1.585523855", "D1", "F", "WT", "C", "3", "3", "2", "A", "D", "Bk2", "Bk3", "2", "1", "0.097003892", "0.097003892", "0.00962974", "D1 F", "D1 F WT", "3 3", "3 3 2", "1.585523855", "1.585523855", "1.585523855", "1.585523855", "", "0.340316189802516", "0.407880898", "", "D1", "D10", "D0", "D1", "D1", "F", "", "0.097003892", "0.097003892", "0.097003892", "A", "B", "1", "q", "2", "0.427636140373732", "", "", "", "", "", "", "", "", "", "", "", "", "0.547564770867569", "C", "A", "3", "1", "0.547564770867569", "C", "A", "3", "1", }); + dt.Rows.Add(new object[] { "True", "1.770048439", "0.29402232193559", "0.962459107249869", "1.770048439", "D1", "M", "TG", "C", "2", "3", "2", "B", "A", "Bk1", "Bk3", "2", "1", "0.209579177", "0.209579177", "0.790354007", "D1 M", "D1 M TG", "2 3", "2 3 2", "1.770048439", "1.770048439", "1.770048439", "1.770048439", "", "0.29402232193559", "0.378431833", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.209579177", "0.209579177", "0.209579177", "B", "B", "1", "q", "2", "0.819525552605012", "", "", "", "", "", "", "", "", "", "", "", "", "0.104531567668928", "C", "B", "3", "2", "0.104531567668928", "C", "B", "3", "2", }); + dt.Rows.Add(new object[] { "True", "1.857046361", "0.804550729426912", "0.522219300967214", "1.857046361", "D1", "M", "TG", "C", "2", "3", "3", "B", "B", "Bk1", "Bk1", "2", "1", "0.488427414", "0.488427414", "0.717729496", "D1 M", "D1 M TG", "2 3", "2 3 3", "1.857046361", "1.857046361", "1.857046361", "1.857046361", "", "0.804550729426912", "0.278027329", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.488427414", "0.488427414", "0.488427414", "C", "B", "1", "q", "2", "0.635388275555056", "", "", "", "", "", "", "", "", "", "", "", "", "0.593481508327229", "C", "B", "3", "2", "0.593481508327229", "C", "B", "3", "2", }); + dt.Rows.Add(new object[] { "True", "1.263642468", "0.704040701705731", "0.927081799004612", "1.263642468", "D1", "M", "TG", "C", "3", "1", "1", "B", "C", "Bk1", "Bk2", "2", "1", "0.056963977", "0.056963977", "0.446229701", "D1 M", "D1 M TG", "3 1", "3 1 1", "1.263642468", "1.263642468", "1.263642468", "1.263642468", "", "0.704040701705731", "0.032708981", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.056963977", "0.056963977", "0.056963977", "A", "A", "2", "q", "2", "0.393385828593356", "", "", "", "", "", "", "", "", "", "", "", "", "0.481507831695153", "C", "B", "3", "2", "0.481507831695153", "C", "B", "3", "2", }); + dt.Rows.Add(new object[] { "True", "1.641107979", "0.456627050505169", "0.328088969451556", "1.641107979", "D1", "M", "TG", "C", "3", "3", "3", "B", "D", "Bk2", "Bk1", "2", "1", "0.886551225", "0.886551225", "0.767800036", "D1 M", "D1 M TG", "3 3", "3 3 3", "1.641107979", "1.641107979", "1.641107979", "1.641107979", "", "0.456627050505169", "0.785007278", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.886551225", "0.886551225", "0.886551225", "B", "A", "2", "q", "2", "0.015537340891965", "", "", "", "", "", "", "", "", "", "", "", "", "0.766123142013142", "C", "B", "3", "2", "0.766123142013142", "C", "B", "3", "2", }); + dt.Rows.Add(new object[] { "True", "1.532792864", "0.74559001126744", "0.373095983734427", "1.532792864", "D1", "M", "TG", "C", "1", "1", "1", "C", "A", "Bk2", "Bk2", "3", "1", "0.030910748", "0.030910748", "0.211080602", "D1 M", "D1 M TG", "1 1", "1 1 1", "1.532792864", "1.532792864", "1.532792864", "1.532792864", "", "0.74559001126744", "0.775481087", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.030910748", "0.030910748", "0.030910748", "C", "A", "2", "q", "2", "0.60548821765474", "", "", "", "", "", "", "", "", "", "", "", "", "0.952716370328942", "C", "C", "3", "3", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.770048439", "0.650827657531079", "0.386983255803045", "1.770048439", "D1", "M", "TG", "C", "1", "1", "2", "C", "B", "Bk2", "Bk3", "3", "1", "0.785780199", "0.785780199", "0.559971518", "D1 M", "D1 M TG", "1 1", "1 1 2", "1.770048439", "1.770048439", "1.770048439", "1.770048439", "", "0.650827657531079", "0.233922069", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.785780199", "0.785780199", "0.785780199", "A", "B", "2", "q", "2", "0.613073260194348", "", "", "", "", "", "", "", "", "", "", "", "", "0.126699076303079", "C", "C", "3", "3", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.444007576", "0.595058451982713", "0.0816750242951656", "1.444007576", "D1", "M", "WT", "C", "3", "1", "2", "C", "C", "Bk1", "Bk3", "2", "1", "0.654543393", "0.654543393", "0.028179208", "D1 M", "D1 M WT", "3 1", "3 1 2", "1.444007576", "1.444007576", "1.444007576", "1.444007576", "", "0.595058451982713", "0.633216256", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.654543393", "0.654543393", "0.654543393", "B", "B", "2", "q", "2", "0.689424757207339", "", "", "", "", "", "", "", "", "", "", "", "", "0.135410489298746", "C", "C", "3", "3", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.916827101", "0.280383922227745", "0.341740602821349", "1.916827101", "D1", "M", "WT", "C", "3", "1", "3", "C", "D", "Bk1", "Bk1", "2", "1", "0.481989874", "0.481989874", "0.731735705", "D1 M", "D1 M WT", "3 1", "3 1 3", "1.916827101", "1.916827101", "1.916827101", "1.916827101", "", "0.280383922227745", "0.959323939", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.481989874", "0.481989874", "0.481989874", "C", "B", "2", "q", "2", "0.623508292038176", "", "", "", "", "", "", "", "", "", "", "", "", "0.618268239315514", "C", "C", "3", "3", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.857046361", "0.98975161272649", "0.773882241701029", "1.857046361", "D1", "M", "WT", "C", "1", "1", "3", "A", "A", "Bk2", "Bk1", "3", "1", "0.35865958", "0.35865958", "0.456733225", "D1 M", "D1 M WT", "1 1", "1 1 3", "1.857046361", "1.857046361", "1.857046361", "1.857046361", "", "0.98975161272649", "0.691604257", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.35865958", "0.35865958", "0.35865958", "A", "A", "1", "w", "2", "0.143874375965833", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.263642468", "0.561915586858659", "0.5088227458051", "1.263642468", "D1", "M", "WT", "C", "1", "2", "1", "A", "B", "Bk2", "Bk2", "3", "1", "0.607058994", "0.607058994", "0.432122644", "D1 M", "D1 M WT", "1 2", "1 2 1", "1.263642468", "1.263642468", "1.263642468", "1.263642468", "", "0.561915586858659", "0.788333245", "", "D1", "D10", "D0", "D1", "D1", "M", "", "0.607058994", "0.607058994", "0.607058994", "B", "A", "1", "w", "2", "0.454927479569744", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.258312377", "0.564773978955788", "1.2", "1.258312377", "D10", "F", "TG", "A", "1", "1", "1", "A", "C", "Bk1", "Bk1", "1", "1", "0.003473612", "0", "0.01089691", "D10 F", "D10 F TG", "1 1", "1 1 1", "-1", "0", "missing", "", "321", "-1", "0.229878028", "", "", "D10", "D10", "D10", "D10", "F", "", "-1", "missing", "", "C", "A", "1", "w", "2", "0.996677676716297", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.770742573", "0.763285638585231", "0.856574324795722", "1.770742573", "D10", "F", "TG", "A", "1", "1", "2", "A", "D", "Bk1", "Bk2", "1", "1", "0.325671649", "0.325671649", "0.852331827", "D10 F", "D10 F TG", "1 1", "1 1 2", "1.770742573", "1.770742573", "1.770742573", "1.770742573", "", "0.763285638585231", "0.250039813", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.325671649", "0.325671649", "0.325671649", "A", "B", "1", "w", "2", "0.343827776778713", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.674137613", "0.439583545552745", "0.627770818786173", "1.674137613", "D10", "F", "TG", "A", "1", "1", "3", "B", "A", "Bk1", "Bk3", "1", "1", "0.632595085", "0.632595085", "0.990447908", "D10 F", "D10 F TG", "1 1", "1 1 3", "1.674137613", "1.674137613", "1.674137613", "1.674137613", "", "0.439583545552745", "0.962201316", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.632595085", "0.632595085", "0.632595085", "B", "B", "1", "w", "2", "0.485465048299329", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.641107979", "0.344765025846945", "0.0612330939849803", "1.641107979", "D10", "F", "TG", "A", "2", "1", "2", "B", "B", "Bk2", "Bk2", "1", "1", "0.157125673", "0.157125673", "0.403187671", "D10 F", "D10 F TG", "2 1", "2 1 2", "1.641107979", "1.641107979", "1.641107979", "1.641107979", "", "0.344765025846945", "0.986171659", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.157125673", "0.157125673", "0.157125673", "C", "B", "1", "w", "2", "0.0543468468739636", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.532792864", "0.148645842849191", "0.581543026491877", "1.532792864", "D10", "F", "TG", "A", "2", "1", "3", "B", "C", "Bk2", "Bk3", "1", "1", "0.34255673", "0.34255673", "0.459745166", "D10 F", "D10 F TG", "2 1", "2 1 3", "1.532792864", "1.532792864", "1.532792864", "1.532792864", "", "0.148645842849191", "0.917447146", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.34255673", "0.34255673", "0.34255673", "A", "A", "2", "w", "2", "0.96339699498589", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.770048439", "0.0621496219072206", "0.545390176726762", "1.770048439", "D10", "F", "TG", "B", "2", "2", "1", "B", "D", "Bk2", "Bk1", "1", "1", "0.460969017", "0.460969017", "0.254896714", "D10 F", "D10 F TG", "2 2", "2 2 1", "1.770048439", "1.770048439", "1.770048439", "1.770048439", "", "0.0621496219072206", "0.368602339", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.460969017", "0.460969017", "0.460969017", "B", "A", "2", "w", "2", "0.876369253335818", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.916827101", "0.361327873509002", "0.548538299005267", "1.916827101", "D10", "F", "WT", "A", "1", "2", "1", "C", "A", "Bk1", "Bk1", "1", "1", "0.927654114", "0.927654114", "0.852649548", "D10 F", "D10 F WT", "1 2", "1 2 1", "1.916827101", "1.916827101", "1.916827101", "1.916827101", "", "0.361327873509002", "0.400228217", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.927654114", "0.927654114", "0.927654114", "C", "A", "2", "w", "2", "0.92177823531874", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.370287058", "0.812372731910561", "0.405961530722458", "1.370287058", "D10", "F", "WT", "A", "1", "2", "2", "C", "B", "Bk1", "Bk2", "1", "1", "0.702380161", "0.702380161", "0.860030648", "D10 F", "D10 F WT", "1 2", "1 2 2", "1.370287058", "1.370287058", "1.370287058", "1.370287058", "", "0.812372731910561", "0.082542379", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.702380161", "0.702380161", "0.702380161", "A", "B", "2", "w", "2", "0.464973322454951", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.857046361", "0.582763750813711", "0.488252633533302", "1.857046361", "D10", "F", "WT", "B", "2", "2", "2", "C", "C", "Bk2", "Bk2", "1", "1", "0.388044205", "0.388044205", "0.948339757", "D10 F", "D10 F WT", "2 2", "2 2 2", "1.857046361", "1.857046361", "1.857046361", "1.857046361", "", "0.582763750813711", "0.551953672", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.388044205", "0.388044205", "0.388044205", "B", "B", "2", "w", "2", "0.475212371159667", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.263642468", "0.534123741454761", "0.340440930562808", "1.263642468", "D10", "F", "WT", "B", "2", "2", "3", "C", "D", "Bk2", "Bk3", "1", "1", "0.193467751", "0.193467751", "0.80932296", "D10 F", "D10 F WT", "2 2", "2 2 3", "1.263642468", "1.263642468", "1.263642468", "1.263642468", "", "0.534123741454761", "0.856083698", "", "D10", "D10", "D0", "D10", "D10", "F", "", "0.193467751", "0.193467751", "0.193467751", "C", "B", "2", "w", "2", "0.562416947293646", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.800527038", "0.523927093616605", "0.159520225255629", "1.800527038", "D10", "M", "TG", "A", "1", "2", "3", "A", "A", "Bk1", "Bk2", "1", "1", "0.286888105", "0.286888105", "0.948638079", "D10 M", "D10 M TG", "1 2", "1 2 3", "1.800527038", "1.800527038", "1.800527038", "1.800527038", "", "0.523927093616605", "0.572318227", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.286888105", "0.286888105", "0.286888105", "A", "A", "1", "q", "1", "0.905956223365035", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.187369833", "0.699313408674976", "0.859459235533828", "1.187369833", "D10", "M", "TG", "A", "1", "3", "1", "A", "B", "Bk1", "Bk3", "1", "1", "0.739410707", "0.739410707", "0.560362423", "D10 M", "D10 M TG", "1 3", "1 3 1", "1.187369833", "1.187369833", "1.187369833", "1.187369833", "", "0.699313408674976", "0.785902559", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.739410707", "0.739410707", "0.739410707", "B", "A", "1", "q", "1", "0.507491096403013", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.370460288", "0.168313596936464", "0.960479177722312", "1.370460288", "D10", "M", "TG", "A", "1", "3", "2", "A", "C", "Bk1", "Bk1", "1", "1", "0.963879625", "0.963879625", "0.062086242", "D10 M", "D10 M TG", "1 3", "1 3 2", "1.370460288", "1.370460288", "1.370460288", "1.370460288", "", "0.168313596936464", "0.530684325", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.963879625", "0.963879625", "0.963879625", "C", "A", "1", "q", "1", "0.428485940674252", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.444007576", "0.840591827206065", "0.681706057339523", "1.444007576", "D10", "M", "TG", "B", "2", "3", "1", "A", "D", "Bk2", "Bk3", "1", "1", "0.258104927", "0.258104927", "0.957998863", "D10 M", "D10 M TG", "2 3", "2 3 1", "1.444007576", "1.444007576", "1.444007576", "1.444007576", "", "0.840591827206065", "0.572115535", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.258104927", "0.258104927", "0.258104927", "A", "B", "1", "q", "1", "0.533083359510192", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.916827101", "0.663661990767209", "0.24651613145372", "1.916827101", "D10", "M", "TG", "B", "2", "3", "2", "B", "A", "Bk2", "Bk1", "1", "1", "0.059813834", "0.059813834", "0.262132204", "D10 M", "D10 M TG", "2 3", "2 3 2", "1.916827101", "1.916827101", "1.916827101", "1.916827101", "", "0.663661990767209", "0.718160147", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.059813834", "0.059813834", "0.059813834", "B", "B", "1", "q", "1", "0.197028249469745", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.370287058", "0.0357383247595688", "0.24625400698063", "1.370287058", "D10", "M", "TG", "B", "2", "3", "3", "B", "B", "Bk2", "Bk2", "1", "1", "0.642994776", "0.642994776", "0.769860109", "D10 M", "D10 M TG", "2 3", "2 3 3", "1.370287058", "1.370287058", "1.370287058", "1.370287058", "", "0.0357383247595688", "0.61170538", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.642994776", "0.642994776", "0.642994776", "C", "B", "1", "q", "1", "0.354801834989983", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.501819998", "0.219162513014847", "0.0773314108245682", "1.501819998", "D10", "M", "WT", "A", "1", "3", "3", "B", "C", "Bk1", "Bk2", "1", "1", "0.473124664", "0.473124664", "0.387642505", "D10 M", "D10 M WT", "1 3", "1 3 3", "1.501819998", "1.501819998", "1.501819998", "1.501819998", "", "0.219162513014847", "0.960307129", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.473124664", "0.473124664", "0.473124664", "A", "A", "2", "q", "1", "0.883857406283437", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.585523855", "0.606367318809271", "0.683112708084104", "1.585523855", "D10", "M", "WT", "A", "2", "1", "1", "B", "D", "Bk1", "Bk3", "1", "1", "0.768653477", "0.768653477", "0.443414606", "D10 M", "D10 M WT", "2 1", "2 1 1", "1.585523855", "1.585523855", "1.585523855", "1.585523855", "", "0.606367318809271", "0.248369014", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.768653477", "0.768653477", "0.768653477", "B", "A", "2", "q", "1", "0.57516733670594", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.800527038", "0.19741446372558", "0.671929556767691", "1.800527038", "D10", "M", "WT", "B", "3", "1", "1", "C", "A", "Bk2", "Bk3", "1", "1", "0.063026459", "0.063026459", "0.462131655", "D10 M", "D10 M WT", "3 1", "3 1 1", "1.800527038", "1.800527038", "1.800527038", "1.800527038", "", "0.19741446372558", "0.007458589", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.063026459", "0.063026459", "0.063026459", "C", "A", "2", "q", "1", "0.669761812498911", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.187369833", "0.0187752489219706", "0.231504015489546", "1.187369833", "D10", "M", "WT", "C", "3", "1", "2", "C", "B", "Bk2", "Bk1", "1", "1", "0.194179828", "0.194179828", "0.980159331", "D10 M", "D10 M WT", "3 1", "3 1 2", "1.187369833", "1.187369833", "1.187369833", "1.187369833", "", "0.0187752489219706", "0.806309829", "", "D10", "D10", "D0", "D10", "D10", "M", "", "0.194179828", "0.194179828", "0.194179828", "A", "B", "2", "q", "1", "0.375833102013638", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.02633744", "0.784305538893852", "0.359513551889353", "2.02633744", "D3", "F", "TG", "C", "1", "2", "2", "C", "C", "Bk1", "Bk3", "3", "1", "0.13770819", "0.13770819", "0.671938116", "D3 F", "D3 F TG", "1 2", "1 2 2", "2.02633744", "2.02633744", "2.02633744", "2.02633744", "", "0.784305538893852", "0.087818003", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.13770819", "0.13770819", "0.13770819", "B", "B", "2", "q", "1", "0.82416848533104", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.195303034", "0.876024476520656", "0.993920105336578", "2.195303034", "D3", "F", "TG", "C", "1", "2", "3", "C", "D", "Bk1", "Bk1", "3", "1", "0.643463015", "0.643463015", "0.415385744", "D3 F", "D3 F TG", "1 2", "1 2 3", "2.195303034", "2.195303034", "2.195303034", "2.195303034", "", "0.876024476520656", "0.315569093", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.643463015", "0.643463015", "0.643463015", "C", "B", "2", "q", "1", "0.138579639296542", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.282420265", "0.647710909362175", "0.500681510537306", "2.282420265", "D3", "F", "TG", "C", "1", "3", "1", "A", "A", "Bk1", "Bk2", "3", "1", "0.661600948", "0.661600948", "0.443806741", "D3 F", "D3 F TG", "1 3", "1 3 1", "2.282420265", "2.282420265", "2.282420265", "2.282420265", "", "0.647710909362175", "0.714716676", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.661600948", "0.661600948", "0.661600948", "A", "A", "1", "w", "1", "0.72047130054622", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.716885733", "0.343082315973712", "0.611414582597931", "1.716885733", "D3", "F", "TG", "C", "2", "2", "3", "A", "B", "Bk2", "Bk1", "3", "1", "0.368788258", "0.368788258", "0.538961313", "D3 F", "D3 F TG", "2 2", "2 2 3", "1.716885733", "1.716885733", "1.716885733", "1.716885733", "", "0.343082315973712", "0.286867695", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.368788258", "0.368788258", "0.368788258", "B", "A", "1", "w", "1", "0.855678044153857", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.746115363", "0.622752177825267", "0.913942694279479", "1.746115363", "D3", "F", "TG", "C", "2", "3", "1", "A", "C", "Bk2", "Bk2", "3", "1", "0.080808376", "0.080808376", "0.289179198", "D3 F", "D3 F TG", "2 3", "2 3 1", "1.746115363", "1.746115363", "1.746115363", "1.746115363", "", "0.622752177825267", "0.35037958", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.080808376", "0.080808376", "0.080808376", "C", "A", "1", "w", "1", "0.379371586963415", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.810308454", "0.260465421946502", "0.0425275187615783", "1.810308454", "D3", "F", "TG", "C", "2", "3", "2", "A", "D", "Bk2", "Bk3", "3", "1", "0.830390884", "0.830390884", "0.523184907", "D3 F", "D3 F TG", "2 3", "2 3 2", "1.810308454", "1.810308454", "1.810308454", "1.810308454", "", "0.260465421946502", "0.240231327", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.830390884", "0.830390884", "0.830390884", "A", "B", "1", "w", "1", "0.231619242823246", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.860750091", "0.380167845919718", "0.404441986881423", "1.860750091", "D3", "F", "WT", "C", "1", "3", "2", "B", "A", "Bk1", "Bk3", "3", "1", "0.794241899", "0.794241899", "0.600773768", "D3 F", "D3 F WT", "1 3", "1 3 2", "1.860750091", "1.860750091", "1.860750091", "1.860750091", "", "0.380167845919718", "0.8373271", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.794241899", "0.794241899", "0.794241899", "B", "B", "1", "w", "1", "0.493123045413753", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.637967891", "0.839741777545848", "0.236080162456037", "1.637967891", "D3", "F", "WT", "C", "1", "3", "3", "B", "B", "Bk1", "Bk1", "3", "1", "0.461015234", "0.461015234", "0.759455683", "D3 F", "D3 F WT", "1 3", "1 3 3", "1.637967891", "1.637967891", "1.637967891", "1.637967891", "", "0.839741777545848", "0.410502813", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.461015234", "0.461015234", "0.461015234", "C", "B", "1", "w", "1", "0.770800611519469", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.250653742", "0.24223593659305", "0.8740887574609", "2.250653742", "D3", "F", "WT", "C", "2", "3", "3", "B", "C", "Bk2", "Bk1", "3", "1", "0.480200439", "0.480200439", "0.725279", "D3 F", "D3 F WT", "2 3", "2 3 3", "2.250653742", "2.250653742", "2.250653742", "2.250653742", "", "0.24223593659305", "0.410295688", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.480200439", "0.480200439", "0.480200439", "A", "A", "2", "w", "1", "0.301267635208203", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.881722808", "0.210460280339522", "0.637014023498692", "1.881722808", "D3", "F", "WT", "C", "3", "1", "1", "B", "D", "Bk2", "Bk2", "3", "1", "0.259839003", "0.259839003", "0.507556163", "D3 F", "D3 F WT", "3 1", "3 1 1", "1.881722808", "1.881722808", "1.881722808", "1.881722808", "", "0.210460280339522", "0.176386949", "", "D3", "D10", "D0", "D3", "D3", "F", "", "0.259839003", "0.259839003", "0.259839003", "B", "A", "2", "w", "1", "0.233613808418154", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.693983444", "0.315324277777574", "0.754602480736339", "1.693983444", "D3", "M", "TG", "C", "2", "1", "1", "C", "A", "Bk1", "Bk2", "3", "1", "0.841943615", "0.841943615", "0.368487829", "D3 M", "D3 M TG", "2 1", "2 1 1", "1.693983444", "1.693983444", "1.693983444", "1.693983444", "", "0.315324277777574", "0.825593846", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.841943615", "0.841943615", "0.841943615", "C", "A", "2", "w", "1", "0.96393909534567", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.822731728", "0.0110590535519883", "0.16229031158923", "1.822731728", "D3", "M", "TG", "C", "2", "1", "2", "C", "B", "Bk1", "Bk3", "3", "1", "0.93956765", "0.93956765", "0.836553233", "D3 M", "D3 M TG", "2 1", "2 1 2", "1.822731728", "1.822731728", "1.822731728", "1.822731728", "", "0.0110590535519883", "0.1302948", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.93956765", "0.93956765", "0.93956765", "A", "B", "2", "w", "1", "0.440368931654281", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.259625123", "0.822291934077382", "0.0644771178280121", "2.259625123", "D3", "M", "TG", "C", "2", "1", "3", "C", "C", "Bk1", "Bk1", "3", "1", "0.705216899", "0.705216899", "0.339155553", "D3 M", "D3 M TG", "2 1", "2 1 3", "2.259625123", "2.259625123", "2.259625123", "2.259625123", "", "0.822291934077382", "0.000623952", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.705216899", "0.705216899", "0.705216899", "B", "B", "2", "w", "1", "0.308880403163354", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.611021829", "0.14174021444686", "0.326051780650482", "1.611021829", "D3", "M", "TG", "C", "3", "1", "2", "C", "D", "Bk2", "Bk3", "3", "1", "0.090175409", "0.090175409", "0.528609496", "D3 M", "D3 M TG", "3 1", "3 1 2", "1.611021829", "1.611021829", "1.611021829", "1.611021829", "", "0.14174021444686", "0.920407014", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.090175409", "0.090175409", "0.090175409", "C", "B", "2", "w", "1", "0.0277068791062829", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.056711957", "0.241973082616662", "0.365864768380597", "", "D3", "M", "TG", "C", "3", "1", "3", "", "", "Bk2", "Bk1", "3", "1", "0.824022633", "0.824022633", "0.440157959", "D3 M", "D3 M TG", "3 1", "3 1 3", "2.056711957", "2.056711957", "2.056711957", "2.056711957", "", "0.241973082616662", "0.685187744", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.824022633", "0.824022633", "0.824022633", "A", "A", "1", "q", "2", "0.481363080340923", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.179452748", "0.628971378234828", "0.369217265842098", "", "D3", "M", "TG", "C", "3", "2", "1", "", "", "Bk2", "Bk2", "3", "1", "0.937608097", "0.937608097", "0.155738784", "D3 M", "D3 M TG", "3 2", "3 2 1", "2.179452748", "2.179452748", "2.179452748", "2.179452748", "", "0.628971378234828", "0.002641728", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.937608097", "0.937608097", "0.937608097", "B", "A", "1", "q", "2", "0.574334111499995", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.989662521", "0.940411573968542", "0.441101188907144", "", "D3", "M", "WT", "C", "2", "2", "1", "", "", "Bk1", "Bk2", "3", "1", "0.146492169", "0.146492169", "0.999285379", "D3 M", "D3 M WT", "2 2", "2 2 1", "1.989662521", "1.989662521", "1.989662521", "1.989662521", "", "0.940411573968542", "0.058017306", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.146492169", "0.146492169", "0.146492169", "C", "A", "1", "q", "2", "0.0137299470555288", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.686946905", "0.993394945047956", "0.266103257059627", "", "D3", "M", "WT", "C", "2", "2", "2", "", "", "Bk1", "Bk3", "3", "1", "0.910921236", "0.910921236", "0.007237098", "D3 M", "D3 M WT", "2 2", "2 2 2", "1.686946905", "1.686946905", "1.686946905", "1.686946905", "", "0.993394945047956", "0.193034916", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.910921236", "0.910921236", "0.910921236", "A", "B", "1", "q", "2", "0.696945658902809", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "1.61676718", "0.339232644242126", "0.294094835244646", "", "D3", "M", "WT", "C", "3", "2", "2", "", "", "Bk2", "Bk3", "3", "1", "0.460446839", "0.460446839", "0.278652307", "D3 M", "D3 M WT", "3 2", "3 2 2", "1.61676718", "1.61676718", "1.61676718", "1.61676718", "", "0.339232644242126", "0.721929266", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.460446839", "0.460446839", "0.460446839", "B", "B", "1", "q", "2", "0.337930101482616", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "2.481805825", "0.815126101922305", "0.516703937668062", "", "D3", "M", "WT", "C", "3", "2", "3", "", "", "Bk2", "Bk1", "3", "1", "0.25973294", "0.25973294", "0.438075624", "D3 M", "D3 M WT", "3 2", "3 2 3", "2.481805825", "2.481805825", "2.481805825", "2.481805825", "", "0.815126101922305", "0.855638606", "", "D3", "D10", "D0", "D3", "D3", "M", "", "0.25973294", "0.25973294", "0.25973294", "C", "B", "1", "q", "2", "0.833218810157955", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "1", "", "", "", "", "3", "1", "", "", "0.740273982", "", "", "3 3", "3 3 1", "", "", "", "", "", "", "0.552034309", "", "", "", "", "30mg/kg", "", "", "", "", "", "", "A", "A", "2", "q", "2", "0.861462770062802", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "2", "", "", "", "", "3", "1", "", "", "0.125915186", "", "", "3 3", "3 3 2", "", "", "", "", "", "", "0.442105141", "", "", "", "", "", "", "", "", "", "", "", "B", "A", "2", "q", "2", "0.490509634695046", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "3", "", "", "", "", "3", "1", "", "", "0.288545388", "", "", "3 3", "3 3 3", "", "", "", "", "", "", "0.824363834", "", "", "", "", "", "", "", "", "", "", "", "C", "A", "2", "q", "2", "0.858485717161229", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "1", "", "", "", "", "1", "2", "", "", "0.240627052", "", "", "1 1", "1 1 1", "", "", "", "", "", "", "0.015581845", "", "", "", "", "", "", "", "", "", "", "", "A", "B", "2", "q", "2", "0.131932818345175", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "2", "", "", "", "", "1", "2", "", "", "0.97512017", "", "", "1 1", "1 1 2", "", "", "", "", "", "", "0.409608369", "", "", "", "", "", "", "", "", "", "", "", "B", "B", "2", "q", "2", "0.760267063388702", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "3", "", "", "", "", "1", "2", "", "", "0.27633178", "", "", "1 1", "1 1 3", "", "", "", "", "", "", "0.866517158", "", "", "", "", "", "", "", "", "", "", "", "C", "B", "2", "q", "2", "0.156660883121574", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "1", "", "", "", "", "1", "2", "", "", "0.789444996", "", "", "1 2", "1 2 1", "", "", "", "", "", "", "0.065734459", "", "", "", "", "", "", "", "", "", "", "", "A", "A", "1", "w", "2", "0.306993830626573", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "2", "", "", "", "", "1", "2", "", "", "0.787423408", "", "", "1 2", "1 2 2", "", "", "", "", "", "", "0.350633957", "", "", "", "", "", "", "", "", "", "", "", "B", "A", "1", "w", "2", "0.390206600309541", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "3", "", "", "", "", "1", "2", "", "", "0.529488555", "", "", "1 2", "1 2 3", "", "", "", "", "", "", "0.496621338", "", "", "", "", "", "", "", "", "", "", "", "C", "A", "1", "w", "2", "0.741224903871354", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "1", "", "", "", "", "1", "2", "", "", "0.425961489", "", "", "1 3", "1 3 1", "", "", "", "", "", "", "0.318421203", "", "", "", "", "", "", "", "", "", "", "", "A", "B", "1", "w", "2", "0.361812644675452", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "2", "", "", "", "", "1", "2", "", "", "0.612719495", "", "", "1 3", "1 3 2", "", "", "", "", "", "", "0.579106139", "", "", "", "", "", "", "", "", "", "", "", "B", "B", "1", "w", "2", "0.625339169893917", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "3", "", "", "", "", "1", "2", "", "", "0.537175813", "", "", "1 3", "1 3 3", "", "", "", "", "", "", "0.729490464", "", "", "", "", "", "", "", "", "", "", "", "C", "B", "1", "w", "2", "0.32728848864308", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "1", "", "", "", "", "1", "2", "", "", "0.237554254", "", "", "2 1", "2 1 1", "", "", "", "", "", "", "0.814990961", "", "", "", "", "", "", "", "", "", "", "", "A", "A", "2", "w", "2", "0.512686836875425", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "2", "", "", "", "", "1", "2", "", "", "0.326563784", "", "", "2 1", "2 1 2", "", "", "", "", "", "", "0.231658206", "", "", "", "", "", "", "", "", "", "", "", "B", "A", "2", "w", "2", "0.145245817819875", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "3", "", "", "", "", "1", "2", "", "", "0.110168174", "", "", "2 1", "2 1 3", "", "", "", "", "", "", "0.394246904", "", "", "", "", "", "", "", "", "", "", "", "C", "A", "2", "w", "2", "0.361326394985495", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "1", "", "", "", "", "1", "2", "", "", "0.906580712", "", "", "2 2", "2 2 1", "", "", "", "", "", "", "0.17296561", "", "", "", "", "", "", "", "", "", "", "", "A", "B", "2", "w", "2", "0.174068381702241", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "2", "", "", "", "", "1", "2", "", "", "0.652133574", "", "", "2 2", "2 2 2", "", "", "", "", "", "", "0.740499013", "", "", "", "", "", "", "", "", "", "", "", "B", "B", "2", "w", "2", "0.522052032659922", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "3", "", "", "", "", "1", "2", "", "", "0.878751541", "", "", "2 2", "2 2 3", "", "", "", "", "", "", "0.815158072", "", "", "", "", "", "", "", "", "", "", "", "C", "B", "2", "w", "2", "0.395874967441359", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "1", "", "", "", "", "1", "2", "", "", "0.282026609", "", "", "2 3", "2 3 1", "", "", "", "", "", "", "0.430207789", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "2", "", "", "", "", "1", "2", "", "", "0.689774468", "", "", "2 3", "2 3 2", "", "", "", "", "", "", "0.994652118", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "3", "", "", "", "", "1", "2", "", "", "0.932265049", "", "", "2 3", "2 3 3", "", "", "", "", "", "", "0.486378265", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "1", "", "", "", "", "1", "2", "", "", "0.376409944", "", "", "3 1", "3 1 1", "", "", "", "", "", "", "0.986372577", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "2", "", "", "", "", "1", "2", "", "", "0.985890813", "", "", "3 1", "3 1 2", "", "", "", "", "", "", "0.933385049", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "3", "", "", "", "", "1", "2", "", "", "0.783823326", "", "", "3 1", "3 1 3", "", "", "", "", "", "", "0.6450028", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "1", "", "", "", "", "1", "2", "", "", "0.192779789", "", "", "3 2", "3 2 1", "", "", "", "", "", "", "0.140207866", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "2", "", "", "", "", "1", "2", "", "", "0.780105109", "", "", "3 2", "3 2 2", "", "", "", "", "", "", "0.501636165", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "3", "", "", "", "", "1", "2", "", "", "0.604432169", "", "", "3 2", "3 2 3", "", "", "", "", "", "", "0.623601782", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "1", "", "", "", "", "1", "2", "", "", "0.028049981", "", "", "3 3", "3 3 1", "", "", "", "", "", "", "0.339661615", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "2", "", "", "", "", "1", "2", "", "", "0.608892883", "", "", "3 3", "3 3 2", "", "", "", "", "", "", "0.690194233", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "3", "", "", "", "", "1", "2", "", "", "0.005354799", "", "", "3 3", "3 3 3", "", "", "", "", "", "", "0.148334592", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "1", "", "", "", "", "2", "2", "", "", "0.95234975", "", "", "1 1", "1 1 1", "", "", "", "", "", "", "0.800808576", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "2", "", "", "", "", "2", "2", "", "", "0.789683552", "", "", "1 1", "1 1 2", "", "", "", "", "", "", "0.23822201", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "3", "", "", "", "", "2", "2", "", "", "0.01112396", "", "", "1 1", "1 1 3", "", "", "", "", "", "", "0.693493514", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "1", "", "", "", "", "2", "2", "", "", "0.259584099", "", "", "1 2", "1 2 1", "", "", "", "", "", "", "0.459734065", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "2", "", "", "", "", "2", "2", "", "", "0.7930584", "", "", "1 2", "1 2 2", "", "", "", "", "", "", "0.586761199", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "3", "", "", "", "", "2", "2", "", "", "0.935902073", "", "", "1 2", "1 2 3", "", "", "", "", "", "", "0.837870337", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "1", "", "", "", "", "2", "2", "", "", "0.81383252", "", "", "1 3", "1 3 1", "", "", "", "", "", "", "0.705590317", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "2", "", "", "", "", "2", "2", "", "", "0.248739588", "", "", "1 3", "1 3 2", "", "", "", "", "", "", "0.860506813", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "3", "", "", "", "", "2", "2", "", "", "0.568418881", "", "", "1 3", "1 3 3", "", "", "", "", "", "", "0.082818154", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "1", "", "", "", "", "2", "2", "", "", "0.870918547", "", "", "2 1", "2 1 1", "", "", "", "", "", "", "0.653157478", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "2", "", "", "", "", "2", "2", "", "", "0.069552365", "", "", "2 1", "2 1 2", "", "", "", "", "", "", "0.502378396", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "3", "", "", "", "", "2", "2", "", "", "0.214773896", "", "", "2 1", "2 1 3", "", "", "", "", "", "", "0.285103701", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "1", "", "", "", "", "2", "2", "", "", "0.265715602", "", "", "2 2", "2 2 1", "", "", "", "", "", "", "0.505758516", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "2", "", "", "", "", "2", "2", "", "", "0.829104076", "", "", "2 2", "2 2 2", "", "", "", "", "", "", "0.804257996", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "3", "", "", "", "", "2", "2", "", "", "0.028995851", "", "", "2 2", "2 2 3", "", "", "", "", "", "", "0.842461834", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "1", "", "", "", "", "2", "2", "", "", "0.684411851", "", "", "2 3", "2 3 1", "", "", "", "", "", "", "0.979581823", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "2", "", "", "", "", "2", "2", "", "", "0.526530519", "", "", "2 3", "2 3 2", "", "", "", "", "", "", "0.820111516", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "3", "", "", "", "", "2", "2", "", "", "0.871543262", "", "", "2 3", "2 3 3", "", "", "", "", "", "", "0.267555261", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "1", "", "", "", "", "2", "2", "", "", "0.097208183", "", "", "3 1", "3 1 1", "", "", "", "", "", "", "0.63770348", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "2", "", "", "", "", "2", "2", "", "", "0.352648766", "", "", "3 1", "3 1 2", "", "", "", "", "", "", "0.892896988", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "3", "", "", "", "", "2", "2", "", "", "0.933293097", "", "", "3 1", "3 1 3", "", "", "", "", "", "", "0.574862231", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "1", "", "", "", "", "2", "2", "", "", "0.668001048", "", "", "3 2", "3 2 1", "", "", "", "", "", "", "0.082828294", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "2", "", "", "", "", "2", "2", "", "", "0.163017489", "", "", "3 2", "3 2 2", "", "", "", "", "", "", "0.649623428", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "3", "", "", "", "", "2", "2", "", "", "0.166981575", "", "", "3 2", "3 2 3", "", "", "", "", "", "", "0.206084478", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "1", "", "", "", "", "2", "2", "", "", "0.37179156", "", "", "3 3", "3 3 1", "", "", "", "", "", "", "0.13737506", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "2", "", "", "", "", "2", "2", "", "", "0.414807821", "", "", "3 3", "3 3 2", "", "", "", "", "", "", "0.576234954", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "3", "", "", "", "", "2", "2", "", "", "0.641346207", "", "", "3 3", "3 3 3", "", "", "", "", "", "", "0.038940028", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "1", "", "", "", "", "3", "2", "", "", "0.262910505", "", "", "1 1", "1 1 1", "", "", "", "", "", "", "0.872421503", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "2", "", "", "", "", "3", "2", "", "", "0.459119831", "", "", "1 1", "1 1 2", "", "", "", "", "", "", "0.255396374", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "1", "3", "", "", "", "", "3", "2", "", "", "0.42164397", "", "", "1 1", "1 1 3", "", "", "", "", "", "", "0.227187691", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "1", "", "", "", "", "3", "2", "", "", "0.106415423", "", "", "1 2", "1 2 1", "", "", "", "", "", "", "0.176753395", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "2", "", "", "", "", "3", "2", "", "", "0.394025439", "", "", "1 2", "1 2 2", "", "", "", "", "", "", "0.31719608", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "2", "3", "", "", "", "", "3", "2", "", "", "0.437790644", "", "", "1 2", "1 2 3", "", "", "", "", "", "", "0.935162047", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "1", "", "", "", "", "3", "2", "", "", "0.784697854", "", "", "1 3", "1 3 1", "", "", "", "", "", "", "0.753240339", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "2", "", "", "", "", "3", "2", "", "", "0.243678086", "", "", "1 3", "1 3 2", "", "", "", "", "", "", "0.728951466", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "1", "3", "3", "", "", "", "", "3", "2", "", "", "0.424501836", "", "", "1 3", "1 3 3", "", "", "", "", "", "", "0.373812562", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "1", "", "", "", "", "3", "2", "", "", "0.099419613", "", "", "2 1", "2 1 1", "", "", "", "", "", "", "0.243853792", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "2", "", "", "", "", "3", "2", "", "", "0.239853841", "", "", "2 1", "2 1 2", "", "", "", "", "", "", "0.611345945", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "1", "3", "", "", "", "", "3", "2", "", "", "0.135996552", "", "", "2 1", "2 1 3", "", "", "", "", "", "", "0.815897024", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "1", "", "", "", "", "3", "2", "", "", "0.692553384", "", "", "2 2", "2 2 1", "", "", "", "", "", "", "0.833467185", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "2", "", "", "", "", "3", "2", "", "", "0.048460663", "", "", "2 2", "2 2 2", "", "", "", "", "", "", "0.778111917", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "2", "3", "", "", "", "", "3", "2", "", "", "0.479952376", "", "", "2 2", "2 2 3", "", "", "", "", "", "", "0.143495431", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "1", "", "", "", "", "3", "2", "", "", "0.920441815", "", "", "2 3", "2 3 1", "", "", "", "", "", "", "0.823613595", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "2", "", "", "", "", "3", "2", "", "", "0.303724529", "", "", "2 3", "2 3 2", "", "", "", "", "", "", "0.870389207", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "2", "3", "3", "", "", "", "", "3", "2", "", "", "0.36359941", "", "", "2 3", "2 3 3", "", "", "", "", "", "", "0.089924883", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "1", "", "", "", "", "3", "2", "", "", "0.867200511", "", "", "3 1", "3 1 1", "", "", "", "", "", "", "0.121133884", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "2", "", "", "", "", "3", "2", "", "", "0.893723238", "", "", "3 1", "3 1 2", "", "", "", "", "", "", "0.987545301", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "1", "3", "", "", "", "", "3", "2", "", "", "0.047365157", "", "", "3 1", "3 1 3", "", "", "", "", "", "", "0.467247331", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "1", "", "", "", "", "3", "2", "", "", "0.740278339", "", "", "3 2", "3 2 1", "", "", "", "", "", "", "0.384536091", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "2", "", "", "", "", "3", "2", "", "", "0.389638593", "", "", "3 2", "3 2 2", "", "", "", "", "", "", "0.484897496", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "2", "3", "", "", "", "", "3", "2", "", "", "0.199362195", "", "", "3 2", "3 2 3", "", "", "", "", "", "", "0.851948685", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "1", "", "", "", "", "3", "2", "", "", "0.261657778", "", "", "3 3", "3 3 1", "", "", "", "", "", "", "0.147444286", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "2", "", "", "", "", "3", "2", "", "", "0.343509031", "", "", "3 3", "3 3 2", "", "", "", "", "", "", "0.952360471", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + dt.Rows.Add(new object[] { "True", "", "", "", "", "", "", "", "", "3", "3", "3", "", "", "", "", "3", "2", "", "", "0.833756537", "", "", "3 3", "3 3 3", "", "", "", "", "", "", "0.813524328", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }); + + return dt; + } + + private Dataset GetDataset() + { + Dataset dataset = new Dataset + { + DatasetID = 6, + DatasetName = "_test dataset.xlsx [unpairedttest]", + DateUpdated = new DateTime(2018, 11, 16, 9, 14, 35), + TheData = "SilveRSelected,Resp 1,Resp2,Resp 3,Resp4,Resp 5,Resp 6,Resp 7,Resp8,Resp:9,Resp-10,Resp^11,Treat1,Treat2,Treat3,Treat4,Treat(5,Treat£6,Treat:7,Treat}8,PVTestresponse1,PVTestresponse2,PVTestgroup\r\nTrue,65,65,65,x,,-2,0,-2,65,65,0.1,A,A,1,A,1,A,A,A,1,1,1\r\nTrue,32,,32,32,32,32,32,0.1,32,32,0.1,A,A,1,A,1,A,A,A,2,2,1\r\nTrue,543,,543,543,543,543,543,0.2,543,543,0.2,A,A,1,A,1,A,A,A,3,3,1\r\nTrue,675,,675,675,675,675,675,0.1,675,675,0.1,A,A,1,B,1,A,A,A,4,4,1\r\nTrue,876,,876,876,876,876,876,0.2,876,876,0.2,A,A,1,B,1,A,A,A,11,10,2\r\nTrue,54,,54,54,54,54,54,0.3,54,54,0.3,A,A,1,B,1,A,A,A,12,11,2\r\nTrue,432,,,432,432,432,432,0.45,432,432,0.45,B,B,2,C,2,B,B,B,13,12,2\r\nTrue,564,,,564,564,564,564,0.2,564,564,0.2,B,B,2,C,2,B,B,,14,13,2\r\nTrue,76,,,76,76,76,76,0.14,76,76,0.14,B,B,2,C,2,B,B,,,,\r\nTrue,54,,,54,54,54,54,0.2,54,54,0.2,B,B,2,D,3,B,B,,,,\r\nTrue,32,,,32,32,32,32,0.1,32,32,0.1,B,B,2,D,3,B,B,,,,\r\nTrue,234,,,234,234,234,234,0.4,234,234,0.4,B,,2,D,3,B,B,,,,", + VersionNo = 1 + }; + + return dataset; + } + } +} \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9f6506d21..a7f8d7fd0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -73,8 +73,8 @@ jobs: action: edit target: 'master' tagSource: manual - tag: '4.0.2' - title: '4.0.2' + tag: '4.1.0' + title: '4.1.0' assetUploadMode: 'replace' isPreRelease: true isDraft: false @@ -107,12 +107,12 @@ jobs: workingDirectory: ./SilveR displayName: Build for Win-x64 - - script: 'xcopy $(Build.SourcesDirectory)\SilveR\bin\Desktop\"InVivoStat Setup 4.0.2.exe" $(Build.ArtifactStagingDirectory)' - displayName: Copy InVivoStat Setup 4.0.2.exe + - script: 'xcopy $(Build.SourcesDirectory)\SilveR\bin\Desktop\"InVivoStat Setup 4.1.0.exe" $(Build.ArtifactStagingDirectory)' + displayName: Copy InVivoStat Setup 4.1.0.exe - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.SourcesDirectory)\SilveR\bin\Desktop\InVivoStat Setup 4.0.2.exe' + PathtoPublish: '$(Build.SourcesDirectory)\SilveR\bin\Desktop\InVivoStat Setup 4.1.0.exe' ArtifactName: 'drop' - task: GitHubRelease@0 @@ -122,8 +122,8 @@ jobs: action: edit target: 'master' tagSource: manual - tag: '4.0.2' - title: '4.0.2' + tag: '4.1.0' + title: '4.1.0' assetUploadMode: 'replace' isPreRelease: true isDraft: false @@ -159,12 +159,12 @@ jobs: workingDirectory: ./SilveR displayName: Build for Linux - - script: 'cp $(Build.SourcesDirectory)/SilveR/bin/Desktop/InVivoStat-4.0.2.AppImage $(Build.ArtifactStagingDirectory)' - displayName: Copy InVivoStat Setup 4.0.2.AppImage + - script: 'cp $(Build.SourcesDirectory)/SilveR/bin/Desktop/InVivoStat-4.1.0.AppImage $(Build.ArtifactStagingDirectory)' + displayName: Copy InVivoStat Setup 4.1.0.AppImage - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/InVivoStat-4.0.2.AppImage' + PathtoPublish: '$(Build.ArtifactStagingDirectory)/InVivoStat-4.1.0.AppImage' ArtifactName: 'drop' - task: GitHubRelease@0 @@ -174,8 +174,8 @@ jobs: action: edit target: 'master' tagSource: manual - tag: '4.0.2' - title: '4.0.2' + tag: '4.1.0' + title: '4.1.0' assetUploadMode: 'replace' isPreRelease: true isDraft: false @@ -208,12 +208,12 @@ jobs: workingDirectory: ./SilveR displayName: Build for MacOS - - script: 'cp $(Build.SourcesDirectory)/SilveR/bin/Desktop/InVivoStat-4.0.2.dmg $(Build.ArtifactStagingDirectory)' - displayName: Copy InVivoStat Setup 4.0.2.dmg + - script: 'cp $(Build.SourcesDirectory)/SilveR/bin/Desktop/InVivoStat-4.1.0.dmg $(Build.ArtifactStagingDirectory)' + displayName: Copy InVivoStat Setup 4.1.0.dmg - task: PublishBuildArtifacts@1 inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)/InVivoStat-4.0.2.dmg' + PathtoPublish: '$(Build.ArtifactStagingDirectory)/InVivoStat-4.1.0.dmg' ArtifactName: 'drop' - task: GitHubRelease@0 @@ -223,8 +223,8 @@ jobs: action: edit target: 'master' tagSource: manual - tag: '4.0.2' - title: '4.0.2' + tag: '4.1.0' + title: '4.1.0' assetUploadMode: 'replace' isPreRelease: true isDraft: false \ No newline at end of file