CalendarYearRateChanges

vecxt_re.CalendarYearRateChanges
See theCalendarYearRateChanges companion object

Year-on-year rate changes by calendar year, for on-leveling historical data.

Each entry is the change factor for a year (e.g. 1.05 for +5%), not an index level. For an index level series (TIV, CPI, ...) use CalendarYearLevels instead.

The factor labelled with year Y is the change from year Y - 1 to year Y. Hence a value from year Y is on-levelled to the current year by multiplying the factors of years Y + 1 to currentYear inclusive, and the earliest year that can be fully on-levelled is earliestYear - 1.

Value parameters

currentYear

The current/reference year (period 0). Must equal years.head.

factors

Array of change factors corresponding to each year. All factors must be strictly positive. The constructor is private: the companion apply methods defensively copy the input arrays, so mutating the arrays passed in cannot bypass validation or desynchronise the cached cumulative factors.

years

Array of contiguous years in descending order (most recent first), i.e. years(i) == currentYear - i. Use the companion apply(years, factors) to construct from years in any order.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def cumulativeToCurrentFrom(fromYear: Int): Double

Calculate the cumulative on-leveling factor from a historical year to the current year.

Calculate the cumulative on-leveling factor from a historical year to the current year.

Years after currentYear return 1.0.

Value parameters

fromYear

The historical year

Attributes

Returns

The cumulative factor to on-level from that year to current

Throws
IllegalArgumentException

if fromYear is earlier than earliestOnLevelYear - the index does not cover it. Use the overload with a fallbackFactor to extrapolate.

def cumulativeToCurrentFrom(fromYear: Int, fallbackFactor: Double): Double

Calculate the cumulative on-leveling factor from a historical year to the current year, extrapolating with a constant fallbackFactor per year for any years before those covered by the index.

Calculate the cumulative on-leveling factor from a historical year to the current year, extrapolating with a constant fallbackFactor per year for any years before those covered by the index.

Value parameters

fallbackFactor

The factor applied for each year earlier than earliestOnLevelYear (e.g. 1.05 for 5% per year)

fromYear

The historical year

Attributes

inline def earliestOnLevelYear: Int

The earliest data year which can be on-levelled using only the factors in this index.

The earliest data year which can be on-levelled using only the factors in this index.

Attributes

inline def earliestYear: Int

The earliest year covered

The earliest year covered

Attributes

override def equals(that: Any): Boolean

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
def factorAt(year: Int): Double

Get the change factor for a specific year.

Get the change factor for a specific year.

Value parameters

year

The calendar year

Attributes

Returns

The change factor for that year

Throws
NoSuchElementException

if year is not in the index

override def hashCode: Int

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
inline def latestYear: Int

The latest year covered (always equals currentYear)

The latest year covered (always equals currentYear)

Attributes

inline def numYears: Int

Number of years covered by this index

Number of years covered by this index

Attributes

def onLevel(value: Double, fromYear: Int): Double

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 fromYear terms

Attributes

Returns

The value in current-year terms

Throws
IllegalArgumentException

if fromYear is earlier than earliestOnLevelYear

def onLevel(value: Double, fromYear: Int, fallbackFactor: Double): Double

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

def onLevel(values: Array[Double], fromYears: Array[Int]): Array[Double]

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 fromYears is earlier than earliestOnLevelYear

def onLevel(values: Array[Double], fromYears: Array[Int], fallbackFactor: Double): Array[Double]

Apply on-leveling to an array of values, extrapolating with fallbackFactor per year for data years earlier than the index covers.

Apply on-leveling to an array of values, extrapolating with fallbackFactor per year for data years earlier than the index covers.

Attributes

def suggestedNewThreshold(reportThreshold: Double, thresholdYear: Int): Double

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 thresholdYear money

thresholdYear

The year the threshold was set

Attributes

override def toString: String

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

def productElementNames: Iterator[String]

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
def productIterator: Iterator[Any]

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