predict.rq.counts.RdThis function computes predictions based on fitted linear quantile models.
# S3 method for class 'rq.counts'
predict(object, newdata, offset,
na.action = na.pass, type = "response",
namevec = NULL, ...)an rq.counts object.
an optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.
an offset to be used with newdata.
function determining what should be done with missing values in newdata. The default is to predict NA.
the type of prediction required. The default "response" is on the scale of the response variable, i.e. the values are back-transformed using the inverse of the transformation \(h^{-1}(Xb)\); the alternative "link" is on the scale of the linear predictors \(h(y) = Xb\); finally, predictions for marginal effects are given with "maref".
character giving the name of the covariate with respect to which the marginal effect is to be computed. If type = "maref", this argument is required. See maref.rq.counts.
not used.
a vector or a matrix or an array of predictions.
# Esterase data
data(esterase)
# Fit quantiles 0.25 and 0.75
fit <- rq.counts(Count ~ Esterase, tau = 0.5, data = esterase, M = 50)
cbind(fit$fitted.values, predict(fit, type = "response"))
#> [,1] [,2]
#> 1 125.0841 125.0841
#> 2 141.4248 141.4248
#> 3 144.9417 144.9417
#> 4 147.0938 147.0938
#> 5 147.8182 147.8182
#> 6 149.2779 149.2779
#> 7 157.5686 157.5686
#> 8 159.1250 159.1250
#> 9 159.1250 159.1250
#> 10 159.9089 159.9089
#> 11 160.6967 160.6967
#> 12 162.2840 162.2840
#> 13 163.8870 163.8870
#> 14 163.8870 163.8870
#> 15 165.5059 165.5059
#> 16 167.1409 167.1409
#> 17 168.7920 168.7920
#> 18 171.2995 171.2995
#> 19 178.1702 178.1702
#> 20 179.9306 179.9306
#> 21 180.8174 180.8174
#> 22 182.6040 182.6040
#> 23 183.5040 183.5040
#> 24 184.4084 184.4084
#> 25 185.3173 185.3173
#> 26 186.2306 186.2306
#> 27 189.9295 189.9295
#> 28 189.9295 189.9295
#> 29 191.8064 191.8064
#> 30 194.6568 194.6568
#> 31 196.5806 196.5806
#> 32 199.5020 199.5020
#> 33 201.4738 201.4738
#> 34 201.4738 201.4738
#> 35 204.4682 204.4682
#> 36 204.4682 204.4682
#> 37 206.4892 206.4892
#> 38 206.4892 206.4892
#> 39 210.5915 210.5915
#> 40 211.6298 211.6298
#> 41 211.6298 211.6298
#> 42 212.6732 212.6732
#> 43 213.7218 213.7218
#> 44 214.7755 214.7755
#> 45 217.9681 217.9681
#> 46 220.1229 220.1229
#> 47 220.1229 220.1229
#> 48 220.1229 220.1229
#> 49 222.2990 222.2990
#> 50 224.4967 224.4967
#> 51 226.7161 226.7161
#> 52 226.7161 226.7161
#> 53 226.7161 226.7161
#> 54 233.5073 233.5073
#> 55 234.6588 234.6588
#> 56 235.8161 235.8161
#> 57 235.8161 235.8161
#> 58 236.9790 236.9790
#> 59 240.5024 240.5024
#> 60 246.4918 246.4918
#> 61 247.7075 247.7075
#> 62 248.9292 248.9292
#> 63 253.8766 253.8766
#> 64 256.3872 256.3872
#> 65 261.4832 261.4832
#> 66 270.6466 270.6466
#> 67 273.3234 273.3234
#> 68 276.0266 276.0266
#> 69 294.2626 294.2626
#> 70 294.2626 294.2626
#> 71 298.6395 298.6395
#> 72 298.6395 298.6395
#> 73 298.6395 298.6395
#> 74 300.1129 300.1129
#> 75 304.5770 304.5770
#> 76 307.5899 307.5899
#> 77 313.7056 313.7056
#> 78 313.7056 313.7056
#> 79 318.3722 318.3722
#> 80 332.7933 332.7933
#> 81 336.0858 336.0858
#> 82 341.0858 341.0858
#> 83 344.4605 344.4605
#> 84 346.1604 346.1604
#> 85 353.0442 353.0442
#> 86 356.5374 356.5374
#> 87 360.0652 360.0652
#> 88 370.8596 370.8596
#> 89 370.8596 370.8596
#> 90 376.3777 376.3777
#> 91 403.2361 403.2361
#> 92 409.2367 409.2367
#> 93 413.2866 413.2866
#> 94 419.4369 419.4369
#> 95 447.1647 447.1647
#> 96 447.1647 447.1647
#> 97 476.7277 476.7277
#> 98 488.6122 488.6122
#> 99 560.8607 560.8607
#> 100 606.8504 606.8504
#> 101 703.4973 703.4973
#> 102 717.4976 717.4976
#> 103 735.3906 735.3906
#> 104 787.9023 787.9023
#> 105 803.5835 803.5835
#> 106 815.5489 815.5489
#> 107 835.8889 835.8889
#> 108 959.5400 959.5400
#> 109 983.4733 983.4733
#> 110 1064.1475 1064.1475
#> 111 1388.5712 1388.5712
#> 112 1395.4311 1395.4311
#> 113 1416.2147 1416.2147