Example #1
0
        /// <summary>
        /// Produces the item names to rates for the Judgement Deductions (e.g. alimony paid-out)
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal Dictionary <string, double> GetJudgmentDeductionName2RandomRates(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();
            const string CHILD_SUPPORT = "Child Support";
            const string ALIMONY       = "Alimony";

            var pay = GetPay(options);

            if (options.IsPayingChildSupport &&
                !options.AnyGivenDirectlyOfNameAndGroup(CHILD_SUPPORT, DeductionGroupNames.JUDGMENTS))
            {
                var adjPay               = AmericanEquations.GetInflationAdjustedAmount(pay, 2015, options.Inception);
                var adjMonthlyPay        = adjPay / 12;
                var childSupportEquation =
                    AmericanEquations.GetChildSupportMonthlyCostEquation(options.GetChildrenAges().Count);
                var childSupport = Math.Round(childSupportEquation.SolveForY(adjMonthlyPay), 2);

                //need to turn this back into annual amount
                childSupport = childSupport * 12;
                options.AddGivenDirectly(CHILD_SUPPORT, DeductionGroupNames.JUDGMENTS, childSupport);
            }

            if (options.IsPayingSpousalSupport &&
                !options.AnyGivenDirectlyOfNameAndGroup(ALIMONY, DeductionGroupNames.JUDGMENTS))
            {
                //this is technically computed as 0.25 * (diff in spousal income)
                var randRate      = Etx.RandomDouble(0.01, 0.25);
                var spouseSupport = Math.Round(randRate * pay, 2);
                options.AddGivenDirectly(ALIMONY, DeductionGroupNames.JUDGMENTS, spouseSupport);
            }

            var d = GetItemNames2Portions(DeductionGroupNames.JUDGMENTS, options);

            return(d.ToDictionary(t => t.Item1, t => t.Item2));
        }
Example #2
0
        /// <summary>
        /// Produces the item names to rates for the Government Deductions (i.e. taxes)
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal Dictionary <string, double> GetGovernmentDeductionName2Rates(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();

            //if the caller has assign values themselves - then just use those and leave
            if (options.AnyGivenDirectly())
            {
                return(GetItemNames2Portions(DeductionGroupNames.GOVERNMENT, options)
                       .ToDictionary(t => t.Item1, t => t.Item2));
            }

            var pay = GetPay(options);

            var fedTaxRate   = AmericanEquations.FederalIncomeTaxRate.SolveForY(pay);
            var stateTaxRate = GetRandomValueFrom(fedTaxRate, 5);

            var fedTaxAmt      = pay * fedTaxRate;
            var stateTaxAmt    = pay * stateTaxRate;
            var ficaTaxAmt     = pay * AmericanData.FICA_DEDUCTION_TAX_RATE;
            var medicareTaxAmt = pay * AmericanData.MEDICARE_DEDUCTION_TAX_RATE;

            options.AddGivenDirectly("Federal tax", DeductionGroupNames.GOVERNMENT, fedTaxAmt);
            options.AddGivenDirectly("State tax", DeductionGroupNames.GOVERNMENT, stateTaxAmt);
            options.AddGivenDirectly("FICA", DeductionGroupNames.GOVERNMENT, ficaTaxAmt);
            options.AddGivenDirectly("Medicare", DeductionGroupNames.GOVERNMENT, medicareTaxAmt);

            //this will be used later, only overwrite it if is unassigned
            if (options.SumTotal == null || options.SumTotal == 0)
            {
                options.SumTotal = (fedTaxAmt + stateTaxAmt + ficaTaxAmt + medicareTaxAmt);
            }

            return(GetItemNames2Portions(DeductionGroupNames.GOVERNMENT, options)
                   .ToDictionary(t => t.Item1, t => t.Item2));
        }
Example #3
0
        /// <summary>
        /// Produces the item names to rates for the Employment Deductions (e.g. 401K)
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal Dictionary <string, double> GetEmploymentDeductionName2Rates(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();

            options.AddPossibleZeroOuts(GetAllowZeroNames(Division, DeductionGroupNames.EMPLOYMENT));

            //if the caller has assign values themselves - then just use those and leave
            if (options.AnyGivenDirectly())
            {
                return(GetItemNames2Portions(DeductionGroupNames.EMPLOYMENT, options)
                       .ToDictionary(t => t.Item1, t => t.Item2));
            }

            var pay = GetPay(options);

            var retirementRate = Etx.RandomPickOne(new[] { 0.01D, 0.02D, 0.03D, 0.04D, 0.05D });
            var retirementAmt  = pay * retirementRate;

            options.AddGivenDirectly("Registered Retirement Savings Plan", DeductionGroupNames.EMPLOYMENT,
                                     retirementAmt);

            var unionDuesAmt = StandardOccupationalClassification.IsLaborUnion(_employment.Occupation)
                ? pay * GetRandomValueFrom(0.04)
                : 0.0D;

            options.AddGivenDirectly("Union Dues", DeductionGroupNames.EMPLOYMENT, unionDuesAmt);

            //we need to have a SumTotal exceeding the current GivenDirectly's sum to have any of the others show up at random
            var someRandRate = GetRandomRateFromClassicHook(options.FactorOptions.GetAge());

            //we will use to force the SumTotal to exceed current GivenDirectly's sum
            var currentTotal   = retirementAmt + unionDuesAmt;
            var someRandAmount = currentTotal * someRandRate;

            //this will be used later, only overwrite it if is unassigned
            if (options.SumTotal == null || options.SumTotal == 0)
            {
                options.SumTotal = currentTotal + someRandAmount;
            }

            return(GetItemNames2Portions(DeductionGroupNames.EMPLOYMENT, options)
                   .ToDictionary(t => t.Item1, t => t.Item2));
        }
Example #4
0
        /// <summary>
        /// Produces the item names to rates for the Insurance Deductions
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal Dictionary <string, double> GetInsuranceDeductionName2RandRates(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();

            options.AddPossibleZeroOuts(GetAllowZeroNames(Division, DeductionGroupNames.INSURANCE));

            //if the caller has assign values themselves - then just use those and leave
            if (options.AnyGivenDirectly())
            {
                return(GetItemNames2Portions(DeductionGroupNames.INSURANCE, options)
                       .ToDictionary(t => t.Item1, t => t.Item2));
            }

            var expectedHealthInsCost = GetRandomEmployeeHealthInsCost(options.Inception);
            var expectedDentalInsCost = GetRandomValueFrom(expectedHealthInsCost, 8);
            var expectedVisionInsCost = GetRandomValueFrom(expectedHealthInsCost, 13);

            options.AddGivenDirectly("Health", DeductionGroupNames.INSURANCE, expectedHealthInsCost);

            options.AddGivenDirectly("Dental", DeductionGroupNames.INSURANCE, expectedDentalInsCost);

            options.AddGivenDirectly("Vision", DeductionGroupNames.INSURANCE, expectedVisionInsCost);

            var someRandRate = GetRandomRateFromClassicHook(options.FactorOptions.GetAge());

            //we will use to force the SumTotal to exceed current GivenDirectly's sum
            var currentTotal = expectedHealthInsCost + expectedDentalInsCost + expectedVisionInsCost;
            var otherInsCost = currentTotal * someRandRate;

            //this will be used later, only overwrite it if is unassigned
            if (options.SumTotal == null || options.SumTotal == 0)
            {
                options.SumTotal = otherInsCost + currentTotal;
            }

            var d = GetItemNames2Portions(DeductionGroupNames.INSURANCE, options);

            return(d.ToDictionary(t => t.Item1, t => t.Item2));
        }