Skip to contents

Cubic splines are piecewise cubic functions that are linked together in a way to guarantee smoothness at data points. Additivity constraints are added for benchmarking purpose and sub-period estimates are derived from each spline. When a sub-period indicator (or disaggregated series) is used, cubic splines are no longer drawn based on the low frequency data but the Benchmark-to-Indicator (BI ratio) is the one being smoothed. Sub- period estimates are then simply the product between the smoothed high frequency BI ratio and the indicator.

Usage

cubicspline(
  s = NULL,
  t,
  nfreq = 4,
  conversion = c("Sum", "Average", "Last", "First", "UserDefined"),
  obsposition = 1
)

Arguments

s

Disaggregated series. If not NULL, it must be the same class as t.

t

Aggregation constraint. Mandatory. it must be either an object of class ts or a numeric vector.

nfreq

Annual frequency of the disaggregated variable. Used if no disaggregated series is provided.

conversion

Conversion rule. Usually "Sum" or "Average". Sum by default.

obsposition

Postion of the observation in the aggregated period (only used with "UserDefined" conversion)

Value

The benchmarked series is returned

Examples

data("qna_data")
Y<-ts(qna_data$B1G_Y_data[,"B1G_FF"], frequency=1, start=c(2009,1))

# cubic spline without disaggregated series
y1<-rjd3bench::cubicspline(t=Y, nfreq=4)

# cubic spline with disaggregated series
x1<-y1+rnorm(n=length(y1), mean=0, sd=10)
y2<-rjd3bench::cubicspline(s=x1, t=Y)

# cubic splines used for temporal disaggregation
x2<-ts(qna_data$TURN_Q_data[,"TURN_INDEX_FF"], frequency=4, start=c(2009,1))
y3<-rjd3bench::cubicspline(s=x2, t=Y)