Description Usage Arguments Value Examples
View source: R/method_predict.R
Predictions from a model fitted by york
.
1 2 |
object |
a fitted object of class inheriting from "york". |
newdata |
a vector or a dataframe to be used for the prediction. If not specified the original x-values with their respective fitted y-values will be returned. |
... |
additional arguments affecting the predictions produced. |
Returns a list, containing a dataframe with predicted values.
a dataframe containing either the original x-values or the specified newdata in the first column and the corresponding predicted values in the second column.
1 2 3 4 5 6 7 8 9 10 11 12 | # Example: York's regression with weight data taken from Pearson (1901):
x <- c(0.0, 0.9, 1.8, 2.6, 3.3, 4.4, 5.2, 6.1, 6.5, 7.4)
y <- c(5.9, 5.4, 4.4, 4.6, 3.5, 3.7, 2.8, 2.8, 2.4, 1.5)
weights_x <- c(1e+3, 1e+3, 5e+2, 8e+2, 2e+2, 8e+1, 6e+1, 2e+1, 1.8, 1)
weights_y <- c(1, 1.8, 4, 8, 20, 20, 70, 70, 1e+2, 5e+2)
# fit york model
york_fit <- york(x, y, weights_x, weights_y, r_xy_errors = 0)
# values for prediction
new <- c(2,3,4,3.6)
predict(york_fit, new)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.