predict.betareg: Prediction Method for betareg Objects

Description Usage Arguments Examples

View source: R/betareg.R

Description

Extract various types of predictions from beta regression models: either on the scale of responses in (0, 1) or the scale of the linear predictor.

Usage

1
2
3
4
## S3 method for class 'betareg'
predict(object, newdata = NULL,
  type = c("response", "link", "precision", "variance", "quantile"),
  na.action = na.pass, at = 0.5, ...)

Arguments

object

fitted model object of class "betareg".

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted, the original observations are used.

type

character indicating type of predictions: fitted means of response ("response"), corresponding linear predictor ("link"), fitted precision parameter phi ("precision"), fitted variances of response ("variance"), or fitted quantile(s) of the response distribution ("quantile").

na.action

function determining what should be done with missing values in newdata. The default is to predict NA.

at

numeric vector indicating the level(s) at which quantiles should be predicted (only if type = "quantile"), defaulting to the median at = 0.5.

...

currently not used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
options(digits = 4)

data("GasolineYield", package = "betareg")

gy2 <- betareg(yield ~ batch + temp | temp, data = GasolineYield)

cbind(
  predict(gy2, type = "response"),
  predict(gy2, type = "link"),
  predict(gy2, type = "precision"),
  predict(gy2, type = "variance"),
  predict(gy2, type = "quantile", at = c(0.25, 0.5, 0.75))
)

Example output

                                      q_0.25   q_0.5  q_0.75
1  0.09997 -2.1976   77.56 1.145e-03 0.07549 0.09653 0.12074
2  0.18658 -1.4724  215.06 7.024e-04 0.16816 0.18561 0.20394
3  0.32143 -0.7472  596.36 3.651e-04 0.30842 0.32123 0.33422
4  0.47379 -0.1049 1471.75 1.693e-04 0.46500 0.47378 0.48256
5  0.08568 -2.3676   93.73 8.269e-04 0.06490 0.08273 0.10328
6  0.14212 -1.7978  208.89 5.809e-04 0.12525 0.14097 0.15774
7  0.26285 -1.0312  614.00 3.151e-04 0.25073 0.26259 0.27469
8  0.10324 -2.1617   85.88 1.066e-03 0.07972 0.10017 0.12344
9  0.17652 -1.5401  205.86 7.027e-04 0.15806 0.17547 0.19384
10 0.30245 -0.8357  554.46 3.798e-04 0.28916 0.30221 0.31547
11 0.07881 -2.4587  120.07 5.996e-04 0.06119 0.07647 0.09390
12 0.14365 -1.7853  309.57 3.961e-04 0.12981 0.14288 0.15665
13 0.24751 -1.1120  798.12 2.331e-04 0.23709 0.24730 0.25769
14 0.34394 -0.6458 1537.51 1.467e-04 0.33573 0.34387 0.35208
15 0.16957 -1.5887  342.81 4.096e-04 0.15556 0.16892 0.18287
16 0.27545 -0.9671  821.72 2.426e-04 0.26484 0.27527 0.28586
17 0.33691 -0.6771 1235.66 1.806e-04 0.32780 0.33683 0.34594
18 0.10548 -2.1378  191.40 4.904e-04 0.08984 0.10410 0.11962
19 0.23606 -1.1744  742.04 2.427e-04 0.22542 0.23583 0.24645
20 0.32316 -0.7393 1368.34 1.597e-04 0.31459 0.32308 0.33164
21 0.05383 -2.8665  120.07 4.207e-04 0.03893 0.05137 0.06608
22 0.07928 -2.4521  215.06 3.379e-04 0.06624 0.07798 0.09091
23 0.16906 -1.5923  720.73 1.946e-04 0.15949 0.16876 0.17831
24 0.27063 -0.9914 1677.97 1.176e-04 0.26326 0.27054 0.27789
25 0.08270 -2.4062  248.80 3.037e-04 0.07039 0.08158 0.09380
26 0.17116 -1.5774  798.12 1.775e-04 0.16202 0.17088 0.18000
27 0.31885 -0.7590 2523.27 8.604e-05 0.31257 0.31881 0.32509
28 0.12701 -1.9276  650.84 1.701e-04 0.11801 0.12663 0.13560
29 0.23661 -1.1714 1885.42 9.575e-05 0.22995 0.23651 0.24316
30 0.10508 -2.1420  798.12 1.177e-04 0.09759 0.10475 0.11221
31 0.11952 -1.9970  978.71 1.074e-04 0.11239 0.11926 0.12637
32 0.18402 -1.4894 1998.57 7.509e-05 0.17811 0.18391 0.18980

betareg documentation built on Feb. 10, 2021, 1:07 a.m.