Description Usage Arguments Details Value See Also Examples
'lm.pred' takes a formula and returns a function that, when provided data, returns a predictor function. See examples.
1 | lm.pred(form)
|
form |
A formula. The formula will be passed without changes to the 'lm' function, so it must be compatible with it. |
The function can be used to generate a pair of predictors for use with the 'gob' function, e.g.
> gob(Y~X, Z, lm.pred(Y~X))
However, the 'gob' function provides a shorthand for this. The above call is exactly equivalent to:
> gob(lm(Y~X), Z)
Behind the scenes, the argument lm(Y~X) is not evaluated: instead, the function name 'lm' is matched to 'lm.pred', and the formula is extracted.
A list of two functions
The functions returned have two arguments – a response vector 'Y' and covariates 'X' (which may be a vector a dataframe) – and they each return a predictor function; that is, a function that takes a covariate value and returns a prediction. The first function of the list returns a function that learns a predictor for the control potential outcomes, while the second returns a function that learns a predictor for the treatment potential outcomes.
Other predictor builders: glm.pred
1 2 3 4 5 6 7 8 9 10 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.