public void test_StartItems_D(int numofItems)
        {
            resultFlag = true;

            REngine.SetEnvironmentVariables();

            REngine engineObj = REngine.GetInstance();

            // Loading a library from R
            engineObj.Evaluate("library(catR)");

            // Dichotomous Items
            DataFrame DichoItems = engineObj.Evaluate("DichoItems <- genDichoMatrix(items = " + numofItems + ")").AsDataFrame();

            engineObj.SetSymbol("DichoItems", DichoItems);

            // Adapting with the existing "CAT-Items" type (Wrapper)
            CATItems itemBank = new CATItems(DichoItems[0].Length, false);

            // New Dictionary
            itemBank.SetItemParamter(CATItems.ColumnNames.a, DichoItems[0].Select(y => (double)y).ToArray());
            itemBank.SetItemParamter(CATItems.ColumnNames.b, DichoItems[1].Select(y => (double)y).ToArray());
            itemBank.SetItemParamter(CATItems.ColumnNames.c, DichoItems[2].Select(y => (double)y).ToArray());
            itemBank.SetItemParamter(CATItems.ColumnNames.d, DichoItems[3].Select(y => (double)y).ToArray());

            // Call "StartItems" function from R, "MFI" criterion
            GenericVector r_StartItems = engineObj.Evaluate("r_StartItems <- startItems(DichoItems, nrItems = 3, theta = 1, halfRange = 2)").AsList();

            // Resulting item numbers
            IntegerVector items = r_StartItems[0].AsInteger();

            DataFrame tempitems = r_StartItems[1].AsDataFrame();

            // Resulting Items
            CATItems r_CatItems = new CATItems(tempitems[0].Length, false);

            r_CatItems.SetItemParamter(CATItems.ColumnNames.a, tempitems[0].Select(y => (double)y).ToArray());
            r_CatItems.SetItemParamter(CATItems.ColumnNames.b, tempitems[1].Select(y => (double)y).ToArray());
            r_CatItems.SetItemParamter(CATItems.ColumnNames.c, tempitems[2].Select(y => (double)y).ToArray());
            r_CatItems.SetItemParamter(CATItems.ColumnNames.d, tempitems[3].Select(y => (double)y).ToArray());

            // Ability value
            NumericVector thStart = r_StartItems[2].AsNumeric();

            // Criterion
            CharacterVector startSelect = r_StartItems[3].AsCharacter();

            // Call "StartItems" function from CS
            StartItemsModel cs_StartItems = CatRLib.StartItems(itemBank, nrItems: 3, theta: 1, halfRange: 2);

            // Check selected items
            if (items.Length == cs_StartItems.items.Length)
            {
                for (int ind = 0; ind < cs_StartItems.items.Length; ind++)
                {
                    if (items[ind] != cs_StartItems.items[ind])
                    {
                        resultFlag = false;
                    }
                }
            }

            // Check starting ability values
            if (thStart.Length == cs_StartItems.thStart.Length)
            {
                for (int ind2 = 0; ind2 < cs_StartItems.thStart.Length; ind2++)
                {
                    if (thStart[ind2] != cs_StartItems.thStart[ind2])
                    {
                        resultFlag = false;
                    }
                }
            }

            Assert.IsTrue(resultFlag);
        }
        public void test_StartItems_P(int numofItems, ModelNames.Models paramModel)
        {
            resultFlag = true;

            REngine.SetEnvironmentVariables();

            REngine engineObj = REngine.GetInstance();

            // Loading a library from R
            engineObj.Evaluate("library(catR)");

            // Polytomous Items
            CharacterVector modelName = engineObj.CreateCharacterVector(new string[] { paramModel.EnumToString() });

            engineObj.SetSymbol("modelName", modelName);
            DataFrame PolyItems = engineObj.Evaluate("PolyItems <- genPolyMatrix(" + numofItems + ", 5, model = modelName, same.nrCat = TRUE)").AsDataFrame();

            engineObj.SetSymbol("PolyItems", PolyItems);

            // Adapting with the existing "CAT-Items" type (Wrapper)

            Console.WriteLine("*******************************************");
            Console.WriteLine("Polytomous Items, Model : " + paramModel.EnumToString());
            Console.WriteLine("*******************************************");

            CATItems itemBank = new CATItems(PolyItems[0].Length, paramModel.EnumToString(), 5);

            Tuple <CATItems.ColumnNames, int>[] cols = itemBank.GetKeys();

            for (int i = 0; i < cols.Length; i++)
            {
                itemBank.SetItemParamter(cols[i], PolyItems[i].Select(y => (double)y).ToArray());
            }

            // Call "StartItems" function from R, "MFI" criterion
            GenericVector r_StartItems = engineObj.Evaluate("r_StartItems <- startItems(PolyItems, model = modelName, nrItems = 3, theta = 1, halfRange = 2)").AsList();

            // Resulting item numbers
            IntegerVector items = r_StartItems[0].AsInteger();

            DataFrame tempitems = r_StartItems[1].AsDataFrame();

            // Resulting Items
            CATItems r_CatItems = new CATItems(tempitems[0].Length, paramModel.EnumToString(), 5);

            for (int i = 0; i < cols.Length; i++)
            {
                r_CatItems.SetItemParamter(cols[i], tempitems[i].Select(y => (double)y).ToArray());
            }

            // Resulting
            NumericVector   thStart     = r_StartItems[2].AsNumeric();
            CharacterVector startSelect = r_StartItems[3].AsCharacter();

            // Call "StartItems" function from CS
            StartItemsModel cs_StartItems = CatRLib.StartItems(itemBank, paramModel.EnumToString(), nrItems: 3, theta: 1, halfRange: 2);

            // Check items
            if (items.Length == cs_StartItems.items.Length)
            {
                for (int ind = 0; ind < cs_StartItems.items.Length; ind++)
                {
                    if (items[ind] != cs_StartItems.items[ind])
                    {
                        resultFlag = false;
                    }
                }
            }

            // Check starting ability values
            if (thStart.Length == cs_StartItems.thStart.Length)
            {
                for (int ind2 = 0; ind2 < cs_StartItems.thStart.Length; ind2++)
                {
                    if (thStart[ind2] != cs_StartItems.thStart[ind2])
                    {
                        resultFlag = false;
                    }
                }
            }

            Assert.IsTrue(resultFlag);
        }