コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 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));
     }
 }
コード例 #7
0
 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);
         }
     }
 }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }