predictInt: Prediction Inteval for Quantile Regression

Description Usage Arguments Value Author(s) Examples

View source: R/predictInt.R

Description

Predicts future values using the median and finds a prediction interval for future values using an upper and lower quantile. The lower quantile is (1-level)/2 and the upper quantile is .5 + level/2.

Usage

1
predictInt(fit, level=.95, newdata=NULL, ...)

Arguments

fit

a fitted model of class "plaqr" or "rq" to be used for prediction.

level

the prediction level required. The lower quantile is (1-level)/2 and the upper quantile is .5 + level/2.

newdata

an optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

...

additional argument(s) for methods.

Value

a matrix with columns giving the predicted median and lower and upper prediction bounds.

Author(s)

Adam Maidman

Examples

1
2
3
data(simData)
fit <- plaqr(y~.,~z1+z2,data=simData)
predictInt(fit, level=.95)

Example output

Loading required package: quantreg
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

Loading required package: splines
         median          lwr        upr
1   -4.27402641  -6.00414004 -2.7568317
2   -1.23514531  -2.18799558  0.6152485
3   10.47434405   8.70866119 13.0990018
4    8.39321822   6.48179070 10.1522098
5   13.58776244  11.96755755 16.0312317
6   -6.48979313  -8.60308522 -5.0772586
7    1.68314641  -0.49550401  3.0516227
8    2.61004227   1.49597371  3.3084326
9   -3.35508138  -4.31455131 -1.7321634
10   3.69317850   1.46559196  5.2792420
11  -0.69265048  -3.97261766  0.4850592
12   0.10936333  -2.80916406  1.0587215
13  -0.42177861  -1.36784815  0.7057401
14   3.05604868   0.44057729  5.1989571
15  -1.86864586  -4.04908210  0.2336958
16   1.08639804   0.32080843  2.1285327
17  -2.08901956  -4.59193304 -0.1498740
18   7.78601496   6.33597407  9.2908011
19   3.79412782   1.92720900  5.7864674
20  10.64906278   9.20322376 13.7333080
21  10.24991985   7.61122507 12.0430318
22   5.21824630   3.71718631  6.9133953
23   6.18868642   4.80984910  8.1010899
24  -3.92109693  -5.21358894 -2.9173386
25   5.41758323   1.51016508  6.8617843
26   1.45808281   0.02462894  3.3335508
27  -9.63732279 -10.95868163 -8.7326061
28  -0.44011035  -3.38032385  1.6313171
29  -4.35274683  -6.24828250 -2.4880057
30   4.38763526   3.14098084  5.9421531
31   4.90595218   1.57355490  5.0513321
32   3.35210209   1.97079735  4.6955939
33   5.03084097   3.45216377  6.9292846
34  -2.77616756  -3.36471756 -1.4274741
35  -2.90526897  -4.47768001 -0.8830390
36  -3.24361584  -4.85262761 -1.3070044
37  -4.49077103  -6.82678941 -2.5617533
38   4.97809469   3.53234428  6.3461122
39   3.49045821   2.14688005  5.7015125
40   3.33227425   2.27930114  4.8386562
41  -4.31184739  -7.00553255 -2.9994444
42  -1.54539424  -2.16976259 -0.8493990
43   2.32085511  -0.30363065  4.9685749
44  -1.37752832  -3.92961616 -1.2547604
45   5.24812480   3.83540880  7.0620779
46   6.38353942   5.32222762  8.6690611
47   5.65412992   4.43764641  7.3316801
48   1.89644876  -0.54116024  4.2666304
49   1.93407966  -0.29092139  3.2315261
50   8.82355918   6.50436713 11.0190547
51   8.88375188   7.25304479 10.8265549
52  -3.62237181  -6.17294650 -2.5977822
53  -0.02270687  -1.37451765  1.8041862
54   4.84979847   3.28683113  6.6859646
55  -3.08574884  -5.59791305 -2.1777412
56   7.03613291   5.38913451  9.4130785
57   2.33937849   1.97010011  3.3709712
58   2.85879944   1.17064111  4.2299754
59   7.64006250   5.10036337  9.8004243
60   5.94162579   4.18577762  7.4913718
61   7.83940783   6.20813020 10.2448443
62  -1.06358411  -3.22399690  1.4491256
63   6.84325125   5.06479494  9.5531340
64  10.95885278   8.88312203 12.9004870
65   6.30766612   4.05833615  8.2583443
66   6.69669974   5.17147279  7.9688581
67  -2.11669215  -3.66342834 -0.8552710
68  -4.12557328  -6.63114955 -3.1928147
69  11.03687137   9.15951403 12.6218221
70  -2.19413069  -3.83694133 -0.2547648
71  -1.93356653  -4.45482142 -0.3537605
72   1.26677219  -2.19562183  2.1462941
73   5.81822659   4.07578292  7.1249443
74  -2.74728059  -5.48680808 -1.5551042
75   3.59877325   1.06530078  5.9374675
76   5.80641143   3.77049997  8.1799071
77  -4.89219392  -5.87257269 -3.2261129
78   1.15857320  -0.63024157  2.6598896
79  -4.07313432  -6.39002428 -2.0647262
80  -5.83948896  -7.84285648 -3.2869815
81  -0.91837189  -3.28252599  0.8983273
82  13.92127677  11.84827747 16.6723860
83   2.96432392  -0.55140393  3.1973374
84   3.24317669   0.83311562  4.7566487
85  -6.10349277  -7.21526317 -4.7267431
86   0.96857695  -0.63774559  2.2481417
87   5.49058719   4.27745225  6.9378182
88   0.49475738  -1.27294112  2.5225660
89  -6.50661991  -7.19349478 -4.8731547
90   7.08020586   3.42000891  8.1831463
91   3.30276637   2.07473655  4.4453285
92  -1.98179173  -4.47489483 -0.2750446
93   4.37372584   3.04881037  5.9709725
94   4.33548905   2.98552021  6.1690405
95   3.85769718   3.02183287  5.6765309
96  -3.37712413  -6.01833422 -1.5504050
97   4.12297313   2.43771117  6.4399923
98   0.26879650  -0.29489148  1.5443767
99   2.44446166   1.34300200  3.7123299
100  1.06151709  -1.10058985  2.1225785

plaqr documentation built on May 2, 2019, 3:32 p.m.

Related to predictInt in plaqr...