Title: | Interpretation of Point Forecasts as State-Dependent Quantiles and Expectiles |
---|---|
Description: | Estimate specification models for the state-dependent level of an optimal quantile/expectile forecast. Wald Tests and the test of overidentifying restrictions are implemented. Plotting of the estimated specification model is possible. The package contains two data sets with forecasts and realizations: the daily accumulated precipitation at London, UK from the high-resolution model of the European Centre for Medium-Range Weather Forecasts (ECMWF, <https://www.ecmwf.int/>) and GDP growth Greenbook data by the US Federal Reserve. See Schmidt, Katzfuss and Gneiting (2015) <arXiv:1506.01917> for more details on the identification and estimation of a directive behind a point forecast. |
Authors: | Patrick Schmidt [aut, cre] |
Maintainer: | Patrick Schmidt <[email protected]> |
License: | CC0 |
Version: | 0.2.0.9000 |
Built: | 2025-02-23 03:47:26 UTC |
Source: | https://github.com/schmidtpk/pointfore |
All specification models can be used as parameter in estimate.functional
.
Specification models are used to denote the quantile or expectile level
(depending on the identification function).
The constant specification model returns the parameter theta irrespective of
the state variable. If theta is not in the unit interval, the constant specification
model returns 0 or 1 (depending on which is closer).
constant(stateVariable, theta, ...)
constant(stateVariable, theta, ...)
stateVariable |
state variable |
theta |
parameter |
... |
... |
numeric level
Other specification models:
logistic_linear()
,
probit_break()
,
probit_linear()
,
probit_spline2()
,
probit_spline3()
# the returned level does not depend on the state variable constant(0,.5) constant(1,.5) # if theta is not in the unit interval, the constant specification model forces it to be so constant(0, 2) constant(0, -1)
# the returned level does not depend on the state variable constant(0,.5) constant(1,.5) # if theta is not in the unit interval, the constant specification model forces it to be so constant(0, 2) constant(0, -1)
Estimates the parameter in a specification model for state-dependent quantile or expectile forecasts. For additional detail see the vignettes of the PointFore package.
estimate.functional( iden.fct = quantiles, model = constant, theta0 = NULL, Y, X, stateVariable = NULL, other_data = NULL, instruments = c("X", "lag(Y)"), prewhite = F, kernel = "Bartlett", bw = bwNeweyWest1987, ... )
estimate.functional( iden.fct = quantiles, model = constant, theta0 = NULL, Y, X, stateVariable = NULL, other_data = NULL, instruments = c("X", "lag(Y)"), prewhite = F, kernel = "Bartlett", bw = bwNeweyWest1987, ... )
iden.fct |
identification function. Standard choice is |
model |
specification model. See |
theta0 |
starting value for optimization |
Y |
realized values |
X |
forecasts |
stateVariable |
state variable(s) as vector or matrix of column vectors. |
other_data |
optional for construction of instruments |
instruments |
instruments (list of character describing instruments or matrix of actual instruments). Use "const" for just the constant as instrument. Standard ist c("X","lag(Y)"), which uses the constant, the forecast and the lagged value of the outcome. |
prewhite |
logical or integer. Should the estimating functions be prewhitened? Standard is FALSE. If TRUE or greater than 0 a VAR model of order as.integer(prewhite) is fitted. (see ?gmm) |
kernel |
choose kernel for HAC-covariance estimation (see ?gmm). Standard is "Bartlett" Kernel as proposed in Newey and West (1987). |
bw |
function describing bandwidth selection (see ?gmm for alternatives). Standard is that the bandwidth depends on the sample length $T$ by $m(T)=T^1/5$. |
... |
other parameters for gmm function (see ?gmm) |
Object of type pointfore
. Use summary
and plot
methods to illustrate results.
# estimate constant quantile level of GDP forecast res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant) summary(res) plot(res) # estimate constant quantile level with only the constant as instrument res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const") summary(res) ## Not run: # estimate constant expectile level res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const", iden.fct = expectiles) summary(res) plot(res) # estimate state-dependent quantile level with linear probit specification model res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, stateVariable = GDP$forecast, model = probit_linear) summary(res) plot(res) ## End(Not run)
# estimate constant quantile level of GDP forecast res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant) summary(res) plot(res) # estimate constant quantile level with only the constant as instrument res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const") summary(res) ## Not run: # estimate constant expectile level res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const", iden.fct = expectiles) summary(res) plot(res) # estimate state-dependent quantile level with linear probit specification model res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, stateVariable = GDP$forecast, model = probit_linear) summary(res) plot(res) ## End(Not run)
Identification function for state-dependent expectiles
expectiles(x, y, stateVariable, theta, model, ...)
expectiles(x, y, stateVariable, theta, model, ...)
x |
forecast |
y |
realization |
stateVariable |
state variable |
theta |
model parameter to be estimated |
model |
model function |
... |
... |
Other identification functions:
quantiles()
## Estimate expectile level for constant specification model with estimate.functional res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const", iden.fct = expectiles) summary(res) plot(res)
## Estimate expectile level for constant specification model with estimate.functional res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const", iden.fct = expectiles) summary(res) plot(res)
A dataset containing real GDP growth rate in the United States and according one quarter ahead point forecasts from Federal Reserve's Greenbook. The forecasts were selected to be closest to the middle of the respective quarter among the published Greenbook forecasts of one quarter. The forecasts issued latest in the respective quarter are also given under forecast_late.
GDP
GDP
A data frame with 176 rows and 2 variables:
observation: realized GDP growth rate in percentage measured at first vintage (-10.4 – 11.2)
observation_second: realized GDP growth rate in percentage measured at second vintage (-11.3 – 13.2)
observation_recent: realized GDP growth rate in percentage measured at most recent vintage (-8.2 – 16.5)
forecast: according point forecast issued one quarter before (-4.7 – 8.5)
forecast_late: according point forecast issued latest in the quarter before (-4.7 – 7.9)
Lagging variables for use in estimate functional
lag(vector, lag = 1)
lag(vector, lag = 1)
vector |
vector to be lagged |
lag |
number of lags |
lagged vector of same length with NAs at beginning
#lag example vector by one lag lag(c(1,2,3)) #lag example vector by two lags lag(c(1,2,3,4),lag=2)
#lag example vector by one lag lag(c(1,2,3)) #lag example vector by two lags lag(c(1,2,3,4),lag=2)
All specification models can be used as parameter in estimate.functional
.
Specification models are used to denote the quantile or expectile level
(depending on the identification function).
The linear logistic specification model depends linear on the state variable with a logistic link function.
logistic_linear(stateVariable, theta, ...)
logistic_linear(stateVariable, theta, ...)
stateVariable |
state variable |
theta |
parameter |
... |
... |
numeric level
Other specification models:
constant()
,
probit_break()
,
probit_linear()
,
probit_spline2()
,
probit_spline3()
# plot linear logistic specification model with constant quantile/expectile level plot(function(x) logistic_linear(x,theta=c(0,0)), xlim=c(-1,1)) # plot linear logistic specification model with state-dependent quantile/expectile level plot(function(x) logistic_linear(x,theta=c(0,5)), xlim=c(-1,1))
# plot linear logistic specification model with constant quantile/expectile level plot(function(x) logistic_linear(x,theta=c(0,0)), xlim=c(-1,1)) # plot linear logistic specification model with state-dependent quantile/expectile level plot(function(x) logistic_linear(x,theta=c(0,5)), xlim=c(-1,1))
Plots object of class "pointfore"
## S3 method for class 'pointfore' plot( x, conf.levels = c(0.6, 0.9), pdf = TRUE, hline = TRUE, adjust.factor = 1, limits = NULL, ... )
## S3 method for class 'pointfore' plot( x, conf.levels = c(0.6, 0.9), pdf = TRUE, hline = TRUE, adjust.factor = 1, limits = NULL, ... )
x |
object of class "pointfore" |
conf.levels |
one or two confidence levels for pointwise confidence intervals |
pdf |
logic if pdf estimate should be plotted |
hline |
if TRUE plots horizontal line at 0.5. if numeric plot horizontal line at value. |
adjust.factor |
adjust factor for estimating pdf (controls smoothness) |
limits |
2-dimensional vector defining range of x-axis |
... |
other parameters |
plot
#estimate linear probit specification model for quantiles on GDP forecast res <- estimate.functional(Y=GDP$observation,X=GDP$forecast, model=probit_linear, stateVariable = GDP$forecast) #plot results plot(res)
#estimate linear probit specification model for quantiles on GDP forecast res <- estimate.functional(Y=GDP$observation,X=GDP$forecast, model=probit_linear, stateVariable = GDP$forecast) #plot results plot(res)
Estimate specification models for the state-dependent level of an optimal quantile/expectile forecast. Wald Tests and the test of overidentifying restrictions are implemented. Plotting of the estimated specification model is possible. The package contains daily accumulated precipitation at London, UK from the high-resolution model of the European Centre for Medium-Range Weather Forecasts (ECMWF, https://www.ecmwf.int/). The package further contains quarterly GDP growth data with observations and forecasts from the Federal Reserve's Greenbook. Based on "Interpretation of Point Forecasts" by Patrick Schmidt, Matthias Katzfuss, and Tilmann Gneiting.
The main function is estimate.functional
. It returns an object which can be
analyzed with plot.pointfore
and summary.pointfore
.
24-hour ahead forecasts of daily accumulated precipitation at London, UK from the high-resolution model of the European Centre for Medium-Range Weather Forecasts (ECMWF). The data contains observations from 2012 to 2016.
precipitation
precipitation
A data frame with 2192 rows and 2 variables:
Y: daily accumulated precipitation in millimeter at London, UK (0 – 45)
X: according point forecast in millimeter issued one day ahead (0 – 40)
We thank the ECMWF for their support. Further details can be found on https://www.ecmwf.int/.
All specification models can be used as parameter in estimate.functional
.
Specification models are used to denote the quantile or expectile level
(depending on the identification function).
The probit break specification model depends has a break at zero and a constant level above and below.
It applies the probit link function.
probit_break(stateVariable, theta, ...)
probit_break(stateVariable, theta, ...)
stateVariable |
state variable |
theta |
parameter |
... |
... |
numeric level
Other specification models:
constant()
,
logistic_linear()
,
probit_linear()
,
probit_spline2()
,
probit_spline3()
# plot break probit specification model with constant quantile/expectile level plot(function(x) probit_break(x,theta=c(0,0)), xlim=c(-1,1)) # plot linear break specification model with state-dependent quantile/expectile level plot(function(x) probit_break(x,theta=c(0,5)), xlim=c(-1,1))
# plot break probit specification model with constant quantile/expectile level plot(function(x) probit_break(x,theta=c(0,0)), xlim=c(-1,1)) # plot linear break specification model with state-dependent quantile/expectile level plot(function(x) probit_break(x,theta=c(0,5)), xlim=c(-1,1))
All specification models can be used as parameter in estimate.functional
.
Specification models are used to denote the quantile or expectile level
(depending on the identification function).
The linear probit specification model depends linear on the state variable with a probit link function.
probit_linear(stateVariable, theta, ...)
probit_linear(stateVariable, theta, ...)
stateVariable |
state variable |
theta |
parameter |
... |
other parameters |
numeric level
Other specification models:
constant()
,
logistic_linear()
,
probit_break()
,
probit_spline2()
,
probit_spline3()
# plot linear probit specification model with constant quantile/expectile level plot(function(x) probit_linear(x,theta=c(0,0)), xlim=c(-1,1)) # plot linear probit specification model with state-dependent quantile/expectile level plot(function(x) probit_linear(x,theta=c(0,5)), xlim=c(-1,1))
# plot linear probit specification model with constant quantile/expectile level plot(function(x) probit_linear(x,theta=c(0,0)), xlim=c(-1,1)) # plot linear probit specification model with state-dependent quantile/expectile level plot(function(x) probit_linear(x,theta=c(0,5)), xlim=c(-1,1))
All specification models can be used as parameter in estimate.functional
.
Specification models are used to denote the quantile or expectile level
(depending on the identifciation function).
This specification model depends through a quadratic spline on the state
variable and applies a probit link function.
probit_spline2(stateVariable, theta, ...)
probit_spline2(stateVariable, theta, ...)
stateVariable |
state variable |
theta |
parameter |
... |
... |
numeric level
Other specification models:
constant()
,
logistic_linear()
,
probit_break()
,
probit_linear()
,
probit_spline3()
# plot example of quadratic spline specification model with state-dependent quantile/expectile level plot(function(x) probit_spline2(x,theta=c(0,1,-1)), xlim=c(-2,2))
# plot example of quadratic spline specification model with state-dependent quantile/expectile level plot(function(x) probit_spline2(x,theta=c(0,1,-1)), xlim=c(-2,2))
All specification models can be used as parameter in estimate.functional
.
Specification models are used to denote the quantile or expectile level
(depending on the identification function).
This specification model depends through a cubic spline on the state
variable and applies a probit link function.
probit_spline3(stateVariable, theta, ...)
probit_spline3(stateVariable, theta, ...)
stateVariable |
state variable |
theta |
parameter |
... |
... |
numeric level
Other specification models:
constant()
,
logistic_linear()
,
probit_break()
,
probit_linear()
,
probit_spline2()
# plot example of cubic spline specification model with state-dependent quantile/expectile level plot(function(x) probit_spline3(x,theta=c(0,1,1,-1)), xlim=c(-2,2))
# plot example of cubic spline specification model with state-dependent quantile/expectile level plot(function(x) probit_spline3(x,theta=c(0,1,1,-1)), xlim=c(-2,2))
Main alternative to estimating state-dependent quantiles based on the quantile identification function are state-dependent expectiles
.
quantiles(x, y, stateVariable, theta, model, ...)
quantiles(x, y, stateVariable, theta, model, ...)
x |
forecast |
y |
realization |
stateVariable |
state variable |
theta |
model parameter to be estimated |
model |
model function |
... |
... |
Other identification functions:
expectiles()
### estimate expectation of identification function for quantile forecasts set.seed(1) y <- rnorm(1000) x <- qnorm(0.6) # expectation of identification with quantile level 0.6 is zero mean(quantiles(x,y,0,0.6,constant)) # expectation of identification function with different quantile level # (0.5 is the median) is not zero mean(quantiles(x,y,0,0.5, constant))
### estimate expectation of identification function for quantile forecasts set.seed(1) y <- rnorm(1000) x <- qnorm(0.6) # expectation of identification with quantile level 0.6 is zero mean(quantiles(x,y,0,0.6,constant)) # expectation of identification function with different quantile level # (0.5 is the median) is not zero mean(quantiles(x,y,0,0.5, constant))
It presents results from the estimate.functional
estimation as summary does
for the lm
or gmm
class objects for example.
It also computes the test of overidentifying restrictions.
## S3 method for class 'pointfore' summary(object, ...)
## S3 method for class 'pointfore' summary(object, ...)
object |
An object of class |
... |
Other arguments when summary is applied to another class object |
It returns a list with the parameter estimates and their standard deviations, t-stat and p-values. It also returns the J-test and p-value for the null hypothesis that the forecast is generated by the postulated functional with an information set that contains the instruments.
# estimate.functional generates a pointfore object... res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const") # ...which can be summarized with the \code{summary} function. summary(res)
# estimate.functional generates a pointfore object... res <- estimate.functional(Y=GDP$observation, X=GDP$forecast, model=constant, instruments="const") # ...which can be summarized with the \code{summary} function. summary(res)