Description Usage Arguments Value Examples
Creates a valid autograde file when supplied with a single prediction vector
1 | gen_agfile(yhat, file.name = "ag_sub")
|
yhat |
A |
file.name |
A |
A .csv
with observations on each new line written to the working
directory given by getwd()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Set seed for reproducibility
set.seed(1337)
# Simulate values
n = 100
beta = 2.5
x = beta*rnorm(n, 0, 1)
y = x + rnorm(n, 1, 2)
# Create a regression model
mod = lm(y~x)
## Predict under model
yhat = predict(mod)
gen_agfile(yhat,file.name="ag_org")
## Predict under new data
new = data.frame(x = seq(-3, 3, 0.5))
yhat2 = predict(mod, new)
gen_agfile(yhat2, file.name="ag_new")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.