Пример #1
0
        protected internal void AssignFactorValues(AmericanFactorOptions factorOptions, double stdDev = DF_STD_DEV_PERCENT)
        {
            if (_factorsSet)
            {
                return;
            }
            var factors = new AmericanFactors(factorOptions);

            _randCheckingAcctAmt = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.CheckingAccount,
                                                                        factors.CheckingAcctFactor, stdDev);
            _randSavingsAcctAmt = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.SavingsAccount,
                                                                       factors.SavingsAcctFactor, stdDev);

            _randHomeEquity = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.HomeEquity,
                                                                   factors.HomeEquityFactor,
                                                                   DF_STD_DEV_PERCENT);

            _randCarEquity = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.VehicleEquity,
                                                                  factors.VehicleEquityFactor, stdDev);

            var randCcDebt = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.CreditCardDebt,
                                                                  factors.CreditCardDebtFactor,
                                                                  DF_STD_DEV_PERCENT);

            _randHomeDebt = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.HomeDebt, factors.HomeDebtFactor,
                                                                 DF_STD_DEV_PERCENT);

            _randCarDebt = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.VehicleDebt,
                                                                factors.VehicleDebtFactor, stdDev);

            _totalEquity = _randCheckingAcctAmt + _randSavingsAcctAmt + _randHomeEquity + _randCarEquity;

            var randNetWorth = AmericanFactors.GetRandomFactorValue(AmericanFactorTables.NetWorth,
                                                                    factors.NetWorthFactor, stdDev);

            var allOtherAssetEquity = _totalEquity - randNetWorth;

            _totalEquity += allOtherAssetEquity;
            if (_totalEquity == 0.0D)
            {
                _totalEquity = 1.0D;
            }
            _homeEquityRate      = Math.Round(_randHomeEquity / _totalEquity, DF_ROUND_DECIMAL_PLACES);
            _carEquityRate       = Math.Round(_randCarEquity / _totalEquity, DF_ROUND_DECIMAL_PLACES);
            _checkingAccountRate = Math.Round(_randCheckingAcctAmt / _totalEquity, DF_ROUND_DECIMAL_PLACES);
            _savingsAccountRate  = Math.Round(_randSavingsAcctAmt / _totalEquity, DF_ROUND_DECIMAL_PLACES);

            var totalDebt = _randHomeDebt + _randCarDebt + randCcDebt;

            _homeDebtRate = Math.Round(_randHomeDebt / totalDebt, DF_ROUND_DECIMAL_PLACES);
            _carDebtRate  = Math.Round(_randCarDebt / totalDebt, DF_ROUND_DECIMAL_PLACES);

            _factorsSet = true;
        }
Пример #2
0
        public AmericanFactorOptions GetClone()
        {
            var o = new AmericanFactorOptions();

            var pi = GetType().GetProperties(NfSettings.DefaultFlags).Where(p => p.CanWrite).ToList();

            foreach (var p in pi)
            {
                var gVal = p.GetValue(this);
                p.SetValue(o, gVal);
            }
            return(o);
        }
Пример #3
0
        /// <summary>
        /// Assigns the scalar factor values based on the given <see cref="options"/>
        /// </summary>
        /// <param name="options"></param>
        public AmericanFactors(AmericanFactorOptions options)
        {
            if (options == null)
            {
                HomeDebtFactor       = 1;
                VehicleDebtFactor    = 1;
                CreditCardDebtFactor = 1;
                SavingsAcctFactor    = 1;
                CheckingAcctFactor   = 1;
                NetWorthFactor       = 1;
                HomeEquityFactor     = 1;
                VehicleEquityFactor  = 1;
                OtherDebtFactor      = 1;
                return;
            }

            var edu           = options.EducationLevel;
            var race          = options.Race;
            var region        = options.Region;
            var age           = options.GetAge();
            var gender        = options.Gender;
            var maritalStatus = options.MaritalStatus;

            HomeDebtFactor = GetFactor(AmericanFactorTables.HomeDebt, edu, race, region, age, gender,
                                       maritalStatus);
            VehicleDebtFactor = GetFactor(AmericanFactorTables.VehicleDebt, edu, race, region, age, gender,
                                          maritalStatus);
            CreditCardDebtFactor = GetFactor(AmericanFactorTables.CreditCardDebt, edu, race, region, age, gender,
                                             maritalStatus);
            SavingsAcctFactor = GetFactor(AmericanFactorTables.SavingsAccount, edu, race, region, age, gender,
                                          maritalStatus);
            CheckingAcctFactor = GetFactor(AmericanFactorTables.CheckingAccount, edu, race, region, age, gender,
                                           maritalStatus);
            NetWorthFactor = GetFactor(AmericanFactorTables.NetWorth, edu, race, region, age, gender,
                                       maritalStatus);
            HomeEquityFactor = GetFactor(AmericanFactorTables.HomeEquity, edu, race, region, age, gender,
                                         maritalStatus);
            VehicleEquityFactor = GetFactor(AmericanFactorTables.VehicleEquity, edu, race, region, age, gender,
                                            maritalStatus);
            OtherDebtFactor = GetFactor(AmericanFactorTables.OtherDebt, edu, race, region, age, gender,
                                        maritalStatus);
        }
Пример #4
0
 public AmericanDomusOpesOptions(AmericanFactorOptions factorOptions = null)
 {
     FactorOptions = factorOptions ?? AmericanFactorOptions.RandomFactorOptions();
 }