A calendar year index of levels, for on-leveling historical data.
Holds an index level per calendar year (e.g. total insured value, a price index, or any series whose ratio between two years gives the change between them). A value from year Y is on-levelled to the current year by multiplying by level(currentYear) / level(Y).
For year-on-year change factors (e.g. 1.05 for +5%) rather than levels, use CalendarYearRateChanges.
Value parameters
- currentYear
-
The current/reference year. Must equal
years.head. - levels
-
Array of index levels corresponding to each year. All levels must be strictly positive. The constructor is private: the companion
applymethods defensively copy the input arrays, so mutating the arrays passed in cannot bypass validation. - years
-
Array of contiguous years in descending order (most recent first), i.e.
years(i) == currentYear - i. Use the companionapply(years, levels)to construct from years in any order.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
The earliest year covered
The earliest year covered
Attributes
Checks whether this instance is equal to that. This universal equality method is defined in AnyRef.
Checks whether this instance is equal to that. This universal equality method is defined in AnyRef.
Attributes
- Definition Classes
-
Equals -> Any
Calculates a hash code value for the object.
Calculates a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.
Attributes
- Returns
-
the hash code value for this object.
- Definition Classes
-
Any
The latest year covered (always equals currentYear)
The latest year covered (always equals currentYear)
Attributes
Get the index level for a specific year.
Get the index level for a specific year.
Value parameters
- year
-
The calendar year
Attributes
- Returns
-
The index level for that year
- Throws
-
NoSuchElementException
if year is not in the index
Number of years covered by this index
Number of years covered by this index
Attributes
On-level a single value from fromYear to the current year.
On-level a single value from fromYear to the current year.
Prefer named arguments - an Int value silently widens to Double, so swapping the arguments compiles:
idx.onLevel(value = 1.0, fromYear = 2023)
Value parameters
- fromYear
-
The calendar year of the value
- value
-
The historical value, in
fromYearterms
Attributes
- Returns
-
The value in current-year terms
- Throws
-
IllegalArgumentException
if
fromYearis earlier than earliestYear
On-level a single value from fromYear to the current year, extrapolating with fallbackFactor per year if fromYear is earlier than the index covers.
On-level a single value from fromYear to the current year, extrapolating with fallbackFactor per year if fromYear is earlier than the index covers.
idx.onLevel(value = 1.0, fromYear = 2015, fallbackFactor = 1.09)
Attributes
Apply on-leveling to an array of values, given their corresponding years.
Apply on-leveling to an array of values, given their corresponding years.
Value parameters
- fromYears
-
The calendar year for each value (same length as values)
- values
-
The historical values to on-level
Attributes
- Returns
-
Array of on-leveled values
- Throws
-
IllegalArgumentException
if any year in
fromYearsis earlier than earliestYear
Apply on-leveling to an array of values, extrapolating with fallbackFactor per year for years earlier than the index covers.
Apply on-leveling to an array of values, extrapolating with fallbackFactor per year for years earlier than the index covers.
Attributes
The factor which on-levels a value from fromYear to the current year: level(currentYear) / level(fromYear).
The factor which on-levels a value from fromYear to the current year: level(currentYear) / level(fromYear).
Years after currentYear return 1.0.
Value parameters
- fromYear
-
The historical year
Attributes
- Throws
-
IllegalArgumentException
if
fromYearis earlier than earliestYear. Use the overload with afallbackFactorto extrapolate.
The factor which on-levels a value from fromYear to the current year, extrapolating the index backwards with a constant fallbackFactor growth per year for any years before earliestYear.
The factor which on-levels a value from fromYear to the current year, extrapolating the index backwards with a constant fallbackFactor growth per year for any years before earliestYear.
Value parameters
- fallbackFactor
-
The assumed growth per year before earliestYear (e.g. 1.05 for 5% per year)
- fromYear
-
The historical year
Attributes
The reporting threshold in current-year terms, for a threshold that was set in thresholdYear.
The reporting threshold in current-year terms, for a threshold that was set in thresholdYear.
Value parameters
- reportThreshold
-
The threshold, in
thresholdYearmoney - thresholdYear
-
The year the threshold was set
Attributes
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Any
Inherited methods
An iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
Attributes
- Inherited from:
- Product
An iterator over all the elements of this product.
An iterator over all the elements of this product.
Attributes
- Returns
-
in the default implementation, an
Iterator[Any] - Inherited from:
- Product