Learn R Programming

quantification (version 0.2.0)

ra: Regression approach

Description

ra implements the regression approach developed by Pesaran (1984).

Usage

ra(y.series, survey.up, survey.same, survey.down, forecast.horizon, first.period = 1, last.period = (length(survey.up) - forecast.horizon), distrib.type = "normal", distrib.mean = 0, distrib.sd = 1, distrib.log.location = 0, distrib.log.scale = 1, distrib.t.df = (first.period - last.period), growth.limit = NA, symmetry.error = "white", suppress.warnings = FALSE)

Arguments

y.series
a numerical vector containing the variable whose change is the subject of the qualitative survey question. If, for example the survey asks participants to assess whether inflation will increase, decrease or stay the same, y.series would be the series of inflation data.
survey.up
a numerical vector containing the number or the share of survey respondents expecting the variable contained in y.series to increase. This vector needs to be of the same length as y.series.
survey.same
a numerical vector containing the number or the share of survey respondents expecting the variable contained in y.series to stay the same. This vector needs to be of the same length as y.series.
survey.down
a numerical vector containing the number or the share of survey respondents expecting the variable contained in y.series to decrease. This vector needs to be of the same length as y.series.
forecast.horizon
a numeric value defining the number of periods the survey question looks in to the future. If the data in y.series is monthly data and the survey question asks respondents to assess the development of the variable over the next six months then forecast.horizon=6.
first.period
an optional numeric value indexing the first period for which survey data in survey.up, survey.same and survey.down shall be used for quantification; default value is 1.
last.period
an optional numeric value indexing the last period for which survey data in survey.up, survey.same and survey.down shall be used for quantification; default value is length(survey.up) - forecast.horizon.
distrib.type
an optional character vector describing the type of distribution used for quantification. Possible values are:
  • "normal": the normal distribution is used. Default value for distrib.type. Parameters distrib.mean and distrib.sd can be used to specify the distribution.
  • "logistic": the logistic distribution is used. Parameters distrib.log.location and distrib.log.scale can be used to specify the distribution.
  • "t": the t distribution is used. Parameter distrib.t.df can be used to specify the distribution.

distrib.mean
an optional numerical value defining the mean of the normal distribution (used in case distrib.type="normal"). Default value is 0.
distrib.sd
an optional numerical value defining the standard deviation of the normal distribution (used in case distrib.type="normal"). Default value is 1.
distrib.log.location
an optional numerical value defining the location of the logistic distribution (used in case distrib.type="logistic"). Default value is 0.
distrib.log.scale
an optional numerical value defining the scale of the logistic distribution (used in case distrib.type="logistic"). Default value is 1.
distrib.t.df
an optional numerical value defining the degrees of freedom (df) of the t distribution (used in case distrib.type="t"). Default value is last.period - first.period.
growth.limit
serves to limit the effect of outliers when expectations are quantified under the assumption that survey respondents form expectations on the percentage change of y. growth.limit defines a limit for percentage change of y. When this limit is exceeded the growth rate is set automatically to the median growth of y over the period covered by the expectations. Default value is NA.
symmetry.error
an optional character vector indicating the type of standard error used for testing the symmetry of the estimated upper and lower indifference limens. Can be either "white" (for White standard error) or "small.sample" (for small sample standard error, HC3), see MacKinnon/White (1985) for details. Default value is "white".
suppress.warnings
a logical value indicating if runtime warnings shall be displayed (FALSE) or not (TRUE). Default value is FALSE.

Value

  • y.e.mean.abs: a numeric vector containing the quantified mean expectations of the variable y, assuming that survey respondents form expectations on the absolute change in y. For all periods which are not in scope of the survey the value is NA.
  • y.e.mean.perc: a numeric vector containing the quantified mean expectations of the variable y, assuming that survey respondents form expectations on the relative change in y. For all periods which are not in scope of the survey the value is NA.
  • delta.y.e.mean.abs: a numeric vector containing the quantified mean absolute change of the variable y, assuming that survey respondents form expectations on the absolute change in y. For all periods which are not in scope of the survey the value is NA.
  • delta.y.e.mean.perc: a numeric vector containing the quantified mean percentage change of the variable y, assuming that survey respondents form expectations on the relative change in y. For all periods which are not in scope of the survey the value is NA.
  • upper.limit.abs: a numeric value containing the estimated upper indifference limen when survey respondents form expectations on the absolute change in variable y.
  • lower.limit.abs: a numeric value containing the estimated upper indifference limen when survey respondents form expectations on the absolute change in variable y.
  • upper.limit.per: a numeric value containing the estimated upper indifference limen when survey respondents form expectations on the relative change in variable y.
  • lower.limit.perc: a numeric value containing the estimated upper indifference limen when survey respondents form expectations on the relative change in variable y.
  • nob: a numeric value showing the number of periods for which expectations have been quantified.
  • mae.abs: a numeric value showing the mean absolute error (MAE) of expectations when survey respondents form expectations on the absolute change in variable y.
  • rmse.abs: a numeric value showing the root mean squared error (RMSE) of expectations when survey respondents form expectations on the absolute change in variable y.
  • mae.perc: a numeric value showing the mean absolute error (MAE) of expectations when survey respondents form expectations on the relative change in variable y.
  • rmse.perc: a numeric value showing the root mean squared error (RMSE) of expectations when survey respondents form expectations on the relative change in variable y.
  • symmetry.abs: a numeric value containing the p-value of the test for symmetry of the estimated indifference limens when survey respondents form expectations on the absolute change in variable y. The standard error used for testing depends on the argument symmetry.error.
  • symmetry.perc: a numeric value containing the p-value of the test for symmetry of the estimated indifference limens when survey respondents form expectations on the relative change in variable y. The standard error used for testing depends on the argument symmetry.error.

Please cite as:

Zuckarelli, Joachim (2014). Quantification of qualitative survey data in R. R package version 1.0.0. http://CRAN.R-project.org/package=quantification

Details

ra estimates the time-invariant, asymmetric indifference limens using OLS regression with non-robust standard errors.

The function ra provides two alternative versions of quantified expectations, depending on the assumed expectation formation process of survey respondents. The basic common assumption of the regression approach is that survey participants are asked to assess whether variable y will go up or down or stay the same. Survey respondents can now form expectations on either the absolute or the relative change of y. The reg function calculates both versions.

The survey result vectors survey.up, survey.down and survey.same as well as the variable y.series must be of the same length and must cover the forecasted horizon (i.e. last.period + forecast.horizon $\le$ length(survey.up)).

Data in survey.up, survey.down and survey.same outside the survey period interval [first.period, last.period] are ignored. Similiarly, y.series data with a period index greater than last.period is ignored.

survey.up, survey.down and survey.same need not sum up to 100% or 1 (which may happen, for example, if the survey has a 'Don't know' answer option).

References

MacKinnon, J.G./White, H. (1985), Some heteroskedasticity-consistent covariance matrix estimators with immproved finite sample properties, Journal of Econometrics 29, 305--325.

Pesaran, M. (1984), Expectations formation and macroeconomic modelling, in: Malgrange, M. (1984), Contemporary macroeconomic modelling, 27--55.

See Also

quantification-package, cp, bal, ce

Examples

Run this code
## Data preparation: generate a sample dataset with inflation and survey data
inflation<-c(1.7, 1.9, 2, 1.9, 2, 2.1, 2.1, 2.1, 2.4, 2.3, 2.4)
answer.up<-c(67, 75.1, 76.4, 72.4, 69.7, 49.7, 45.2, 31.6, 14.9, 19.3, 19.2)
answer.same<-c(30.1, 19.6, 19.5, 21.3, 20.1, 33.1, 34.4, 33.5, 44.6, 38.1, 35.3)
answer.down<-c(2.9, 5.3, 4.1, 6.3, 10.2, 17.2, 20.4, 34.9, 40.5, 42.6, 45.5)

## Call ra for quantification
quant.ra<-ra(inflation, answer.up, answer.same, answer.down, first.period=5, 
	last.period=7, forecast.horizon=4, symmetry.error="small.sample")

Run the code above in your browser using DataLab