gausspred: Gauss predictor

Description Usage Arguments Value References Examples

View source: R/gausspred.R

Description

Prediction intervals based on the Gauss linear model

Usage

1
gausspred(train,test,epsilons=c(0.05,0.01))

Arguments

train

Training set as a matrix of size N times K+1. Each row describes an observation. Columns 1 to K are the explanatory variables, and column K+1 is the response variables.

test

Test set as a matrix of size N2 times K. Each row corresponds to an observation (but without the response variable). Columns 1 to K are the explanatory variables.

epsilons

Vector of several significance levels. Each significance level epsilons[j] is a number between 0 and 1. The default value is (5%,1%).

Value

The output is a list of three elements.

output[[1]]

The matrix of lower bounds of prediction intervals. Its size is N2 times Neps, where N2 is the number of test observations and Neps is the number of significance levels. The element output[[1]][i,j] of output[[1]] is the lower bound a of the prediction interval [a,b] for the i-th test observation and for the j-th significance level epsilons[j] in the vector epsilons.

output[[2]]

The matrix of upper bounds b, with the same structure as output[[1]]. Typically a = output[[1]][i,j] and b = output[[2]][i,j] are real numbers such that a <= b. Exceptions: a is allowed to be -infinity and b is allowed to be infinity; the only case where a > b is a = infinity and b = - infinity (the empty prediction [a,b]).

output[[3]]

The termination code: 0 = normal termination; 1 = illegal parameters (the training and test sets have different numbers of explanatory variables); 2 = too few observations.

References

Vovk, V., Nouretdinov, I., and Gammerman, A. (2009) On-line predictive linear regression. Annals of Statistics 37, 1566 - 1590. This paper describes this standard textbook procedure and its properties when used in the on-line mode.

Examples

1
2
3
4
5
  train <- matrix(c(1,2,3,4, 2.01,2.99,4.01,4.99), nrow=4, ncol=2);
  test <- matrix(c(0,10,20), nrow=3, ncol=1);
  output <- gausspred(train,test,c(0.05,0.2));
  print(output[[1]]);
  print(output[[2]]);

Example output

           [,1]       [,2]
[1,]  0.9239469  0.9722876
[2,] 10.7775795 10.8856726
[3,] 20.4997347 20.7414382
          [,1]      [,2]
[1,]  1.096053  1.047712
[2,] 11.162420 11.054327
[3,] 21.360265 21.118562

PredictiveRegression documentation built on May 2, 2019, 8:16 a.m.