DecCF./ˈdɛk.ɛf/

Swedish credit planning (2025)

Use swedishDebtRatio({owner, debt, annualIncome}) to report chosen debt divided by chosen annual credit-eligible income. Supply ordinary amount sources, using expr.sum for collection totals. Count a joint loan once in consolidated debt. Legal ownership, payment shares and each borrower's solidary exposure are separate assumptions; this calculation applies no approval threshold or amortization policy. Zero income returns a null ratio and no-income, or no-debt-no-income if both are zero. The record identifies version 1.

swedishInterestAllocation2025 estimates an annual allocation of eligible secured interest among an explicit keyed recipients map. Include only liable co-borrowers who can deduct this interest. Annual interest is positive SEK; it must be paid, deductible interest and must not already appear in the supplied baseline bases. Profiles contain complete annual tax assumptions for each recipient. Each profile field is a keyed source map; repeat columns work directly:

Declare the allocation under model calculations and recognition under components. Recognition transfers the existing expense between owners without another cash payment. The loan or payment component remains responsible for the actual payment. Supply a consistent annual planning amount; using an annualized month's interest is an assumption, not a reconstruction of the final tax return. An allocation for one loan must include other allocated interest in each recipient's baseline if jointly optimizing multiple loans; independently optimizing loans against identical empty baselines can reuse tax capacity. Prefer allocating their combined eligible annual interest once when the eligible borrowers are the same.

Each tax basis defaults to annual SEK, or accepts {amount: keyedMap, period: "monthly"}. Sources can include capital income, existing secured and unsecured interest, ROT/RUT and other supported credits, property fees and all other supported 2025 bases. Rules are keyed by recipient too. Optional profiles.propertyAssessments maps each person to a literal assessment array or an assessment calculation source. These are complete baseline profiles, not automatically inferred from accounts. Avoid counting account income again as an extra basis when feeding the tax wrappers.

The result publishes allocations, normalized weights, savings, baselineLiabilities, allocatedLiabilities, ruleYear: 2025, status, savingsGapBound and engineEvaluations. Every reported liability and saving uses the supported 2025 income-tax calculation, including limits on usable tax credits. This is an annual planning estimate; actual tax payment and refund dates come from the separately composed personal tax component.

For whole-kr totals up to 100 kr the bounded reference search is exact (exact-whole-kr). Larger totals use a piecewise capacity allocation and deterministic pair improvements around tax thresholds (bounded-estimate), not a certified exact optimum. savingsGapBound is a conservative upper bound in SEK on additional savings that a better allocation could achieve for these supplied profiles. The relaxation allows 61 kr per recipient for integer rounding and the supported engine's 200 kr capital-tax threshold, then subtracts the actual achieved savings from its upper bound. Typical allocation error is smaller; do not hide this bound or label the estimate exact. Running time depends on recipient count, not one iteration per kr of interest. Stable recipient-id order resolves equal-value choices. Zero total interest gives zero allocations and a unit weight to the first recipient, permitting zero-cost postings.

Set enabled: false with an explicit nonnegative weights map to use a manual split. The optimizer is skipped, while baseline and allocated liabilities still explain the tax impact. Manual splits return savingsGapBound: null because they make no optimality claim. Weight maps must match recipients exactly, have a positive total, and may be ordinary calculation projections or object inputs. A distribution's center remains an ordinary source; use a sampled calculation or a loan's stochastic source when variation is intended.

The rule year is 2025, even when a projection runs in later calendar years. No municipality dataset or 2026 tax upgrade is implied. Skatteverket describes deductible interest and liability requirements and joint-borrower reallocation and limits from final tax. Borrowers must make matching reductions and increases in their declarations. The model does not decide legal eligibility.

Several loans with different borrowers

Use swedishInterestPortfolio2025 when interest belongs to several explicit pools, such as homes with different borrowers. Each pool supplies annualInterest, an eligible map and manual weights; all maps include every recipient ID. Eligibility uses true/false or 1/0. Ineligible people must have zero manual weight. A positive pool needs at least one eligible person with a positive weight. An optional name is retained in the results.

Supply recipients as the people map and profiles as the matching map of personalTax({publishProfile:true}) outputs. Exclude the interest bases allocated by this portfolio from those profiles, while retaining other loans and consumer-interest activity. The helper reads the actual projected income, tax rules, existing interest and keyed property assessments. Rules remain explicitly from 2025, even when the projected calendar year is later.

The published result contains perPool, recipient totals in perRecipient, aggregate weights, totalInterest, baseline and allocated liabilities, taxSavings, status, savingsGapBound and engineEvaluations. All monetary values in this result are numbers in SEK, including perPool[id].taxSavings; pool amount inputs may also be SEK Money sources. Each pool includes all recipients, with zero allocation to ineligible people. The result itself creates no payment, expense or account.

With enabled:false, normalized manual weights determine the allocation. With allocation enabled, the model starts from those choices and makes at most three ordered passes. Each pool is optimized with the other pools' allocated interest already included in each person's tax profile. Only a lower total liability is accepted. This shares actual capacity between overlapping borrower groups and cannot make the manual starting allocation worse.

The result is a bounded estimate, not a claim of the best possible constrained allocation. savingsGapBound conservatively bounds the possible additional saving using the unrestricted allocation helper and its rounding envelope; manual mode reports null. Fractional allocations remain possible. For small whole-krona cases, the unrestricted helper's integer search still receives a rounding envelope because manual allocations may contain fractions.

Pool savings are attributed in sorted pool-ID order: starting from the original profiles, the model adds each pool's final allocation and measures the change in actual liability. These amounts sum to the actual total saving. The attribution is order-dependent where pools share capacity; it is not a separate deduction entitlement or a flat percentage assigned to each home.

Empty pools are valid and leave the profiles' baseline liabilities intact. A zero-interest pool may have zero manual weights. Its output weights then use the first eligible recipient, or the first recipient if nobody is eligible, solely to support a zero-value downstream posting. All actual allocations remain zero; changing that pool to positive interest requires valid eligible recipients and positive manual weights. A zero portfolio similarly returns aggregate weight one for the first recipient. Missing, unknown and duplicate recipient identities remain errors.

For consolidated numeric conservation, totalInterest uses the sum of the final perRecipient totals in the published recipient order. Each recipient total is the sum of that person's final pool allocations, and each pool retains its own amount and eligible allocation. Aggregate weights divide those recipient totals by the same canonical total. Adding the original pool amounts in a different grouping can differ by floating-point rounding: for example, (0.1 + 0.2) + 0.4 and (0.1 + 0.4) + 0.2 do not produce identical numeric results. The helper preserves the pool and recipient relationships without imposing cent rounding or changing borrowers to erase that regrouping difference.