Skip to content

Commit

Permalink
Logistic Regression Analysis module
Browse files Browse the repository at this point in the history
  • Loading branch information
robalexclark committed Mar 27, 2020
1 parent 4a04b14 commit bc7c3ef
Show file tree
Hide file tree
Showing 41 changed files with 4,120 additions and 104 deletions.
2 changes: 1 addition & 1 deletion SilveR.IntegrationTests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"parallelizeTestCollections": true
"parallelizeTestCollections": false
}
6 changes: 6 additions & 0 deletions SilveR/Controllers/AnalysesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ public async Task<IActionResult> LinearRegressionAnalysis(LinearRegressionAnalys
return await RunAnalysis(model, ignoreWarnings);
}

[HttpPost]
public async Task<IActionResult> LogisticRegressionAnalysis(LogisticRegressionAnalysisModel model, bool ignoreWarnings)
{
return await RunAnalysis(model, ignoreWarnings);
}

[HttpPost]
public async Task<IActionResult> DoseResponseAndNonLinearRegressionAnalysis(DoseResponseAndNonLinearRegressionAnalysisModel model, bool ignoreWarnings)
{
Expand Down
16 changes: 14 additions & 2 deletions SilveR/Scripts/ChiSquaredAndFishersExactTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,27 @@ 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)
{
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")

Expand Down
32 changes: 28 additions & 4 deletions SilveR/Scripts/Common_Functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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) +
Expand All @@ -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 {
Expand All @@ -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) +
Expand All @@ -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 {
Expand All @@ -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) +
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 13 additions & 2 deletions SilveR/Scripts/ComparisonOfMeansPowerAnalysisDatasetBasedInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
15 changes: 13 additions & 2 deletions SilveR/Scripts/ComparisonOfMeansPowerAnalysisUserBasedInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
18 changes: 16 additions & 2 deletions SilveR/Scripts/CorrelationAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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")
Expand Down
15 changes: 13 additions & 2 deletions SilveR/Scripts/DoseResponseAndNonLinearRegressionAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
23 changes: 20 additions & 3 deletions SilveR/Scripts/GraphicalAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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), ]
}

Expand Down Expand Up @@ -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")
Expand Down
15 changes: 13 additions & 2 deletions SilveR/Scripts/IncompleteFactorialParametricAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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")
Expand Down
15 changes: 13 additions & 2 deletions SilveR/Scripts/LinearRegressionAnalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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")
Expand Down

0 comments on commit bc7c3ef

Please sign in to comment.