Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robalexclark committed Oct 20, 2021
1 parent 56f03ed commit 85d6cab
Show file tree
Hide file tree
Showing 25 changed files with 4,058 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
html{font-size:14px}a.navbar-brand{white-space:normal;text-align:center;word-break:break-all}.dropdown-submenu{position:relative}.dropdown-submenu a::after{transform:rotate(-90deg);position:absolute;right:6px;top:.8em}.dropdown-submenu .dropdown-menu{top:0;left:100%;margin-left:.1rem;margin-right:.1rem}.checkbox-fix{margin-top:15px}#grid{height:calc(75vh)}#spreadsheet{width:100%;height:calc(75vh)}.text-block{padding-top:10px;padding-bottom:10px;text-align:justify;line-height:150%;font-size:16px}table.dataframe{border:1px solid #808080;background-color:#fff;width:100%;text-align:center;border-collapse:collapse}table.dataframe td,table.dataframe th{border:1px solid #808080;padding:3px 13px}table.dataframe tbody td{font-size:13px;text-align:center;padding:3px 13px}td:nth-child(1){background:#ccc}table.dataframe th{font-size:15px;background-color:#ccc;text-align:center}.k-button{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.k-button:focus,.k-button.focus{color:#fff;background-color:#449d44;border-color:#255625}.k-button:hover{color:#fff;background-color:#449d44;border-color:#398439}.k-button:active,.k-button.active,.open>.dropdown-toggle.k-button{color:#fff;background-color:#449d44;border-color:#398439}.k-button:active:hover,.k-button.active:hover,.open>.dropdown-toggle.k-button:hover,.k-button:active:focus,.k-button.active:focus,.open>.dropdown-toggle.k-button:focus,.k-button:active.focus,.k-button.active.focus,.open>.dropdown-toggle.k-button.focus{color:#fff;background-color:#398439;border-color:#255625}.k-button:active,.k-button.active,.open>.dropdown-toggle.k-button{background-image:none}.k-button.disabled:hover,.k-button[disabled]:hover,fieldset[disabled] .k-button:hover,.k-button.disabled:focus,.k-button[disabled]:focus,fieldset[disabled] .k-button:focus,.k-button.disabled.focus,.k-button[disabled].focus,fieldset[disabled] .k-button.focus{background-color:#5cb85c;border-color:#4cae4c}.k-button .badge{color:#5cb85c;background-color:#fff}.k-numeric-wrap{width:100px}.disabledpanel{pointer-events:none;opacity:.4}
</style>
<link rel="stylesheet" type="text/css" href='r2html.css'>

<h1> InVivoStat Equivalence TOST Test Analysis</h1>

<p class='character'>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.</p>
277 changes: 277 additions & 0 deletions SilveR.IntegrationTests/ExpectedResults/EquivalenceTOSTTest/ETT22.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2> Model coefficients</h2>

<h2> Table of the back-transformed geometric means with 95% confidence intervals</h2>

<p class='character'>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.</p>
<p class='character'>As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.</p>


<p align="left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2> Model coefficients</h2>

<h2> Table of the back-transformed geometric means with 95% confidence intervals</h2>

<p class='character'>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.</p>
<p class='character'>As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.</p>


<p align="left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2> Model coefficients</h2>

<h2> Table of the back-transformed geometric means with 95% confidence intervals</h2>

<p class='character'>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.</p>
<p class='character'>As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.</p>


<p align="left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2> Model coefficients</h2>

<h2> Table of the back-transformed geometric means with 95% confidence intervals</h2>

<p class='character'>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.</p>
<p class='character'>As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.</p>


<p align="left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2> Model coefficients</h2>

<h2> Table of the back-transformed geometric means with 95% confidence intervals</h2>

<p class='character'>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.</p>
<p class='character'>As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.</p>


<p align="left">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2> Model coefficients</h2>

<h2> Table of the back-transformed geometric means with 95% confidence intervals</h2>

<p class='character'>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.</p>
<p class='character'>As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.</p>


<p align="left">
Expand Down
941 changes: 941 additions & 0 deletions SilveR.IntegrationTests/ExpectedResults/EquivalenceTOSTTest/ETT55.html

Large diffs are not rendered by default.

905 changes: 905 additions & 0 deletions SilveR.IntegrationTests/ExpectedResults/EquivalenceTOSTTest/ETT56.html

Large diffs are not rendered by default.

909 changes: 909 additions & 0 deletions SilveR.IntegrationTests/ExpectedResults/EquivalenceTOSTTest/ETT57.html

Large diffs are not rendered by default.

945 changes: 945 additions & 0 deletions SilveR.IntegrationTests/ExpectedResults/EquivalenceTOSTTest/ETT58.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion SilveR.IntegrationTests/SilveR.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="ExcelDataReader" Version="3.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
Expand Down
48 changes: 40 additions & 8 deletions SilveR.IntegrationTests/StatsTests/EquivalenceTOSTTestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public async Task ETT1()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp 1";
model.Treatments = new string[] { "Resp 1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -53,6 +56,9 @@ public async Task ETT2()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp6";
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -75,6 +81,9 @@ public async Task ETT3()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp 1";
model.Treatments = new string[] { "Treat7" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -98,6 +107,9 @@ public async Task ETT4()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp 1";
model.Treatments = new string[] { "Tre at4" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -120,6 +132,9 @@ public async Task ETT5()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp4";
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -143,6 +158,9 @@ public async Task ETT6()
model.Response = "Resp 1";
model.Treatments = new string[] { "Treat1" };
model.Covariates = new string[] { "Cov4" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -165,6 +183,9 @@ public async Task ETT7()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp5";
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -189,6 +210,9 @@ public async Task ETT8()
model.Treatments = new string[] { "Treat1" };
model.Covariates = new string[] { "Cov5" };
model.PrimaryFactor = "Treat1";
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -211,6 +235,9 @@ public async Task ETT9()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp 1";
model.Treatments = new string[] { "T reat5" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand All @@ -233,6 +260,9 @@ public async Task ETT10()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp 1";
model.Treatments = new string[] { "Treat6" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.LowerBoundPercentageChange = 10;
model.UpperBoundPercentageChange = 20;

//Act
HttpResponseMessage response = await client.PostAsync("Analyses/EquivalenceTOSTTest", new FormUrlEncodedContent(model.ToKeyValue()));
Expand Down Expand Up @@ -336,7 +366,7 @@ public async Task ETT14()
model.Covariates = new string[] { "Cov2" };
model.CovariateTransformation = "Log10";
model.PrimaryFactor = "Treat1";
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Absolute;
model.LowerBoundAbsolute = 10;
model.UpperBoundAbsolute = 20;

Expand Down Expand Up @@ -364,7 +394,7 @@ public async Task ETT15()
model.Covariates = new string[] { "Cov3" };
model.CovariateTransformation = "Loge";
model.PrimaryFactor = "Treat1";
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Absolute;
model.LowerBoundAbsolute = 10;
model.UpperBoundAbsolute = 20;

Expand Down Expand Up @@ -528,6 +558,7 @@ public async Task ETT21()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp8";
model.Treatments = new string[] { "Treat12", "Treat13" };
model.SelectedEffect = "Treat12";
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Absolute;
model.LowerBoundAbsolute = 10;
model.UpperBoundAbsolute = 20;
Expand All @@ -553,6 +584,7 @@ public async Task ETT22()
model.DatasetID = _factory.SheetNames.Single(x => x.Value == "Equivalence TOST").Key;
model.Response = "Resp11";
model.Treatments = new string[] { "Treat14" };
model.SelectedEffect = "Treat14";
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Absolute;
model.LowerBoundAbsolute = 10;
model.UpperBoundAbsolute = 20;
Expand Down Expand Up @@ -612,7 +644,7 @@ public async Task ETT25()
IEnumerable<string> errors = await Helpers.ExtractErrors(response);

//Assert
Assert.Contains("The field Lower bound percentage must be between 0 and 100.", errors);
Assert.Contains("User cannot select a negative Percentage change.", errors);
Helpers.SaveOutput("EquivalenceTOSTTest", testName, errors);
}

Expand All @@ -637,7 +669,7 @@ public async Task ETT26()
IEnumerable<string> errors = await Helpers.ExtractErrors(response);

//Assert
Assert.Contains("The field Lower bound percentage must be between 0 and 100.", errors);
Assert.Contains("User cannot select a negative Percentage change.", errors);
Helpers.SaveOutput("EquivalenceTOSTTest", testName, errors);
}

Expand Down Expand Up @@ -1531,7 +1563,7 @@ public async Task ETT55()
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
//model.LowerBoundAbsolute = 0.2m;
model.UpperBoundAbsolute = 10m;
model.UpperBoundPercentageChange = 10m;
model.Significance = "0.05";
model.PRPlotSelected = true;
model.SelectedEffect = "Treat1";
Expand Down Expand Up @@ -1572,7 +1604,7 @@ public async Task ETT56()
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
//model.LowerBoundAbsolute = 0.2m;
model.UpperBoundAbsolute = 10m;
model.UpperBoundPercentageChange = 10m;
model.Significance = "0.05";
model.PRPlotSelected = true;
model.SelectedEffect = "Treat1";
Expand Down Expand Up @@ -1614,7 +1646,7 @@ public async Task ETT57()
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
//model.LowerBoundAbsolute = 0.2m;
model.UpperBoundAbsolute = 10m;
model.UpperBoundPercentageChange = 10m;
model.Significance = "0.05";
model.PRPlotSelected = true;
model.SelectedEffect = "Treat1";
Expand Down Expand Up @@ -1646,7 +1678,7 @@ public async Task ETT58()
model.Treatments = new string[] { "Treat1" };
model.EquivalenceBoundsType = EquivalenceTOSTTestModel.EquivalenceBoundsOption.Percentage;
//model.LowerBoundAbsolute = 0.2m;
model.UpperBoundAbsolute = 10m;
model.UpperBoundPercentageChange = 10m;
model.Significance = "0.05";
model.PRPlotSelected = true;
model.SelectedEffect = "Treat1";
Expand Down
4 changes: 2 additions & 2 deletions SilveR/Scripts/EquivalenceTOSTTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -900,10 +900,10 @@ if(showLSMeans =="Y") {
HTML.title(CITitle2, HR=2, align="left")

if (GeomDisplay == "geometricmeansandpredictedmeansonlogscale") {
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")
HTML("As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.", align="left")
}
if (GeomDisplay == "geometricmeansonly") {
HTML("As the response was log transformed prior to analysis the least square (predicted) means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.", align="left")
HTML("As the response was log transformed prior to analysis the means are presented back transformed onto the original scale. These are known as the back-transformed geometric means.", align="left")
}

#Calculate LS Means Table
Expand Down
6 changes: 3 additions & 3 deletions SilveR/SilveR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<PackageReference Include="ElectronNET.API" Version="13.5.1" />
<PackageReference Include="ExcelDataReader.DataSet" Version="3.6.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.37" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
7 changes: 1 addition & 6 deletions SilveR/StatsModels/AnalysisModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ protected AnalysisModelBase(string scriptFileName)
this.ScriptFileName = scriptFileName;
}

public string CustomRCode { get; private set; }

public void SetCustomRCode(string rCode)
{
CustomRCode = rCode;
}
public string CustomRCode { get; set; }

public abstract ValidationInfo Validate();

Expand Down

0 comments on commit 85d6cab

Please sign in to comment.