Description Usage Arguments Value See Also Examples
View source: R/predict.fwelnet.R
This function returns the predictions from a "fwelnet
" object
for a new data matrix.
1 2 |
object |
Fitted " |
xnew |
Matrix of new values for |
type |
Type of prediction required. Type "link" (default) gives the linear predictors. Type "response" gives the linear predictor for "gaussian" family and fitted probabilities for "binomial" family. |
... |
Potentially other arguments to be passed to and from methods; currently not in use. |
Predictions which the model object
makes at xnew
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set.seed(1)
n <- 100; p <- 20
x <- matrix(rnorm(n * p), n, p)
beta <- matrix(c(rep(2, 5), rep(0, 15)), ncol = 1)
y <- x %*% beta + rnorm(n)
z <- cbind(1, abs(beta) + rnorm(p))
fit <- fwelnet(x, y, z)
predict(fit, xnew = x[1:5, ])
biny <- ifelse(y > 0, 1, 0)
fit <- fwelnet(x, biny, z, family = "binomial")
# linear predictor values
predict(fit, xnew = x[1:5, ])
# fitted probabilities
predict(fit, xnew = x[1:5, ], type = "response")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.