public static TwoByTwo GetInstance(Dictionary <string, int> cidToVal1, Dictionary <string, int> cidToVal2, bool rememberCases) { TwoByTwo twoByTwo = rememberCases ? (TwoByTwo) new TwoByTwoCases() : (TwoByTwo) new TwoByTwoCounts(); twoByTwo.Var1 = null; twoByTwo.Var2 = null; twoByTwo.TabulateCounts(cidToVal1, cidToVal2); return(twoByTwo); }
public static TwoByTwo GetInstance(string var1, string var2) { TwoByTwo twoByTwo = new TwoByTwo(); twoByTwo.Var1 = var1; twoByTwo.Var2 = var2; twoByTwo.Counts = new int[2, 2]; //C# init's to 0's return(twoByTwo); }
public static TwoByTwo GetInstance(KeyValuePair <string, Dictionary <string, int> > varAndCidToVal1, KeyValuePair <string, Dictionary <string, int> > varAndCidToVal2, bool rememberCases) { TwoByTwo twoByTwo = rememberCases ? (TwoByTwo) new TwoByTwoCases() : (TwoByTwo) new TwoByTwoCounts(); twoByTwo.Var1 = varAndCidToVal1.Key; twoByTwo.Var2 = varAndCidToVal2.Key; twoByTwo.TabulateCounts(varAndCidToVal1.Value, varAndCidToVal2.Value); return(twoByTwo); }
public static TwoByTwo GetInstance(Dictionary <string, int> cidToVal1, Dictionary <string, int> cidToVal2) { TwoByTwo twoByTwo = new TwoByTwo(); twoByTwo.Var1 = null; twoByTwo.Var2 = null; twoByTwo.TabulateCounts(cidToVal1, cidToVal2); return(twoByTwo); }
public static TwoByTwo GetInstance(KeyValuePair <string, Dictionary <string, int> > varAndCidToVal1, KeyValuePair <string, Dictionary <string, int> > varAndCidToVal2) { TwoByTwo twoByTwo = new TwoByTwo(); twoByTwo.Var1 = varAndCidToVal1.Key; twoByTwo.Var2 = varAndCidToVal2.Key; twoByTwo.TabulateCounts(varAndCidToVal1.Value, varAndCidToVal2.Value); return(twoByTwo); }
public static IEnumerable <TwoByTwo> GetCollection(bool lowMemory, bool unsorted, string inputSparseFileName1, string inputSparseFileName2, bool rememberCases) { if (unsorted) { return(TwoByTwo.GetUnsortedCollection(inputSparseFileName1, inputSparseFileName2, lowMemory, rememberCases)); } else { return(TwoByTwo.GetSortedCollection(inputSparseFileName1, inputSparseFileName2, lowMemory, rememberCases)); } }
private static IEnumerable <TwoByTwo> ProcessCore(string inputSparseFileName1, IEnumerable <KeyValuePair <string, Dictionary <string, int> > > varToCidToVal2, bool rememberCases) { foreach (KeyValuePair <string, Dictionary <string, int> > varAndCidToVal1 in GroupByVariableLowMemory(inputSparseFileName1)) { foreach (KeyValuePair <string, Dictionary <string, int> > varAndCidToVal2 in varToCidToVal2) { TwoByTwo twoByTwo = TwoByTwo.GetInstance(varAndCidToVal1, varAndCidToVal2, rememberCases); yield return(twoByTwo); } } }
private static List <TwoByTwo> ProcessCore(string inputSparseFileName1, IEnumerable <KeyValuePair <string, Dictionary <string, int> > > varToCidToVal2) { List <TwoByTwo> twoByTwoCollection = new List <TwoByTwo>(); foreach (KeyValuePair <string, Dictionary <string, int> > varAndCidToVal1 in GroupByVariableLowMemory(inputSparseFileName1)) { foreach (KeyValuePair <string, Dictionary <string, int> > varAndCidToVal2 in varToCidToVal2) { TwoByTwo twoByTwo = TwoByTwo.GetInstance(varAndCidToVal1, varAndCidToVal2); twoByTwoCollection.Add(twoByTwo); } } return(twoByTwoCollection); }
public static TwoByTwo GetInstance(int[] fisherCounts) { SpecialFunctions.CheckCondition(fisherCounts.Length == 4); TwoByTwo twoByTwo = new TwoByTwo(); twoByTwo.Var1 = null; twoByTwo.Var2 = null; twoByTwo.Counts = new int[2, 2]; twoByTwo.Counts[1, 1] = fisherCounts[(int)TwoByTwo.ParameterIndex.TT]; twoByTwo.Counts[1, 0] = fisherCounts[(int)TwoByTwo.ParameterIndex.TF]; twoByTwo.Counts[0, 1] = fisherCounts[(int)TwoByTwo.ParameterIndex.FT]; twoByTwo.Counts[0, 0] = fisherCounts[(int)TwoByTwo.ParameterIndex.FF]; return(twoByTwo); }