Description Usage Arguments Value Author(s) Examples
This file defines some classes and methods that are used to make some of the predictions in the corresponding paper's empirical exercise (Calhoun, 2011).
1 2 3 4 5 6 7 8 |
model |
An object with a “predict” method. |
model.list |
A list of objects with “predict” methods. |
fn |
A function that can take and aggregate a vector: “mean,” for example. |
object |
A variable belonging to an S3 class. |
newdata |
A new data set to use to create the new forecasts. |
... |
For “predict.CT”, additional arguments to pass to the underlying “predict” method. For “predict.Aggregate”, additional arguments to pass to the individual “predict” methods. |
method.name |
A character vector giving the names of different S3 methods. |
“CT” and “Aggregate” return objects with (S3) classes “CT” and “Aggregate” respectively. The “predict” methods each return a single forecast. “HasMethod” returns a logical vector with the same length as “method.name” indicating whether “object” has each method defined.
Gray Calhoun gcalhoun@iastate.edu
1 2 3 4 5 6 7 8 9 10 11 12 13 | olddata <- data.frame(y = rnorm(30), x = rnorm(30))
newdata <- data.frame(y = rnorm(3), x = rnorm(3))
m1 <- lm(y ~ 1, data = olddata)
m2 <- lm(y ~ x, data = olddata)
m3 <- CT(m2)
m4 <- Aggregate(list(m1, m2, m3), median)
predict(m3, newdata)
predict(m4, newdata)
HasMethod(m1, c("plot", "print", "predict", "median"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.