Skip to content

Commit

Permalink
Add checks to paramtric modules that categorical factors have at leas…
Browse files Browse the repository at this point in the history
…t 2 levels
  • Loading branch information
robalexclark committed Mar 24, 2020
1 parent aa1f794 commit 4a04b14
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions SilveR/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public async void ElectronBootstrap()
BrowserWindow browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Title = Program.AppName,
Fullscreen = true,
Width = 1280,
Height = 1024,
AutoHideMenuBar = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;

namespace SilveR.Validators
Expand All @@ -26,9 +25,17 @@ public override ValidationInfo Validate()
allVars.AddVariables(ifpVariables.Response);
allVars.AddVariables(ifpVariables.Covariates);

if (!CheckColumnNames(allVars)) return ValidationInfo;
if (!CheckColumnNames(allVars))
return ValidationInfo;

//First create a list of catogorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
categorical.AddVariables(ifpVariables.Treatments);
categorical.AddVariables(ifpVariables.OtherDesignFactors);

if (!CheckFactorsHaveLevels(ifpVariables.Treatments, true)) return ValidationInfo;
//check that the factors have at least 2 levels
if (!CheckFactorsHaveLevels(categorical, true))
return ValidationInfo;

//Do checks to ensure that treatments contain a response etc and the responses contain a treatment etc...
if (!CheckResponsesPerLevel(ifpVariables.Treatments, ifpVariables.Response, ReflectionExtensions.GetPropertyDisplayName<IncompleteFactorialParametricAnalysisModel>(i => i.Treatments)))
Expand All @@ -37,11 +44,6 @@ public override ValidationInfo Validate()
if (!CheckResponsesPerLevel(ifpVariables.OtherDesignFactors, ifpVariables.Response, ReflectionExtensions.GetPropertyDisplayName<IncompleteFactorialParametricAnalysisModel>(i => i.OtherDesignFactors)))
return ValidationInfo;

//First create a list of catogorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
categorical.AddVariables(ifpVariables.Treatments);
categorical.AddVariables(ifpVariables.OtherDesignFactors);

//do data checks on the treatments/other factors and response
if (!CategoricalAgainstContinuousVariableChecks(categorical, ifpVariables.Response))
return ValidationInfo;
Expand Down
18 changes: 10 additions & 8 deletions SilveR/Validators/NestedDesignAnalysisValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;

namespace SilveR.Validators
Expand All @@ -26,9 +25,17 @@ public override ValidationInfo Validate()
allVars.AddVariables(ndaVariables.Response);
allVars.AddVariables(ndaVariables.Covariates);

if (!CheckColumnNames(allVars)) return ValidationInfo;
if (!CheckColumnNames(allVars))
return ValidationInfo;

//First create a list of catogorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
categorical.AddVariables(ndaVariables.Treatments);
categorical.AddVariables(ndaVariables.OtherDesignFactors);

if (!CheckFactorsHaveLevels(ndaVariables.Treatments, true)) return ValidationInfo;
//check that the factors have at least 2 levels
if (!CheckFactorsHaveLevels(categorical, true))
return ValidationInfo;

//Do checks to ensure that treatments contain a response etc and the responses contain a treatment etc...
if (!CheckResponsesPerLevel(ndaVariables.Treatments, ndaVariables.Response, ReflectionExtensions.GetPropertyDisplayName<NestedDesignAnalysisModel>(i => i.Treatments)))
Expand All @@ -37,11 +44,6 @@ public override ValidationInfo Validate()
if (!CheckResponsesPerLevel(ndaVariables.OtherDesignFactors, ndaVariables.Response, ReflectionExtensions.GetPropertyDisplayName<NestedDesignAnalysisModel>(i => i.OtherDesignFactors)))
return ValidationInfo;

//First create a list of catogorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
categorical.AddVariables(ndaVariables.Treatments);
categorical.AddVariables(ndaVariables.OtherDesignFactors);

//do data checks on the treatments/other factors and response
if (!CategoricalAgainstContinuousVariableChecks(categorical, ndaVariables.Response))
return ValidationInfo;
Expand Down
5 changes: 3 additions & 2 deletions SilveR/Validators/PairedTTestAnalysisValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;

namespace SilveR.Validators
Expand All @@ -27,14 +26,16 @@ public override ValidationInfo Validate()
allVars.AddVariables(pttVariables.Response);
allVars.AddVariables(pttVariables.Covariates);

if (!CheckColumnNames(allVars)) return ValidationInfo;
if (!CheckColumnNames(allVars))
return ValidationInfo;

//First create a list of categorical variables selected (i.e. as treatments and other factors)
List<string> categoricalVariables = new List<string>();
categoricalVariables.AddVariables(pttVariables.Treatment);
categoricalVariables.AddVariables(pttVariables.OtherDesignFactors);
categoricalVariables.AddVariables(pttVariables.Subject);

//check that the factors have at least 2 levels
if (!CheckFactorsHaveLevels(categoricalVariables, true))
return ValidationInfo;

Expand Down
12 changes: 4 additions & 8 deletions SilveR/Validators/RepeatedMeasuresParametricAnalysisValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ public override ValidationInfo Validate()
}
}

//?
if (!CheckFactorsHaveLevels(rmVariables.Treatments, true))
return ValidationInfo;
if (!CheckFactorsHaveLevels(rmVariables.RepeatedFactor, true))
return ValidationInfo;
if (!CheckFactorsHaveLevels(rmVariables.Subject, true))
return ValidationInfo;


//First create a list of categorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
Expand All @@ -67,6 +59,10 @@ public override ValidationInfo Validate()
categorical.Add(rmVariables.RepeatedFactor);
categorical.Add(rmVariables.Subject);

//check that the factors have at least 2 levels
if (!CheckFactorsHaveLevels(categorical, true))
return ValidationInfo;

//do data checks on the treatments/other factors and response
if (!CategoricalAgainstContinuousVariableChecks(categorical, rmVariables.Response))
return ValidationInfo;
Expand Down
14 changes: 7 additions & 7 deletions SilveR/Validators/SingleMeasuresParametricAnalysisValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;

namespace SilveR.Validators
Expand All @@ -28,8 +27,14 @@ public override ValidationInfo Validate()

if (!CheckColumnNames(allVars))
return ValidationInfo;

//First create a list of catogorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
categorical.AddVariables(smVariables.Treatments);
categorical.AddVariables(smVariables.OtherDesignFactors);

if (!CheckFactorsHaveLevels(smVariables.Treatments, true))
//check that the factors have at least 2 levels
if (!CheckFactorsHaveLevels(categorical, true))
return ValidationInfo;

//Do checks to ensure that treatments contain a response etc and the responses contain a treatment etc...
Expand All @@ -39,11 +44,6 @@ public override ValidationInfo Validate()
if (!CheckResponsesPerLevel(smVariables.OtherDesignFactors, smVariables.Response, ReflectionExtensions.GetPropertyDisplayName<SingleMeasuresParametricAnalysisModel>(i => i.OtherDesignFactors)))
return ValidationInfo;

//First create a list of catogorical variables selected (i.e. as treatments and other factors)
List<string> categorical = new List<string>();
categorical.AddVariables(smVariables.Treatments);
categorical.AddVariables(smVariables.OtherDesignFactors);

//do data checks on the treatments/other factors and response
if (!CategoricalAgainstContinuousVariableChecks(categorical, smVariables.Response))
return ValidationInfo;
Expand Down
1 change: 0 additions & 1 deletion SilveR/Validators/UnpairedTTestAnalysisValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;

namespace SilveR.Validators
{
Expand Down

0 comments on commit 4a04b14

Please sign in to comment.