Description Usage Arguments Value Author(s) References See Also Examples
Similar to other predict methods, this function returns predictions from a fitted "apple"
or "cv.apple"
object.
1 2 3 |
object |
fitted |
X |
matrix of values at which predictions are to be made. |
which |
indices of the penalty parameter |
type |
type of prediction: |
... |
see |
The object returned depends on type.
Yi Yu and Yang Feng
Yi Yu and Yang Feng, APPLE: Approximate Path for Penalized Likelihood Estimator, manuscript.
apple
, cv.apple
and plot.apple
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | p=10
n=200
d=5
coefs=c(3,1.5,0,0,2)
intercept=0
beta=rep(0,p)
beta[1:d]=coefs
set.seed(2)
X=matrix(rnorm(p*n), nrow=n)
mu=1/(1+exp(-X %*% beta-intercept))
y=rbinom(n,1,mu)
fit.apple=apple(X, y, family="binomial")
set.seed(3)
testX=matrix(rnorm(p*n), nrow=n)
predict(fit.apple,testX,type="link")
predict(fit.apple,testX,type="response")
predict(fit.apple,testX,type="class")
fit=cv.apple(X, y, family="binomial", alpha=0)
predict(fit.apple,testX,type="link", which = fit$cv.loc)
predict(fit.apple,testX,type="response", which = fit$cv.loc)
predict(fit.apple,testX,type="class", which = fit$cv.loc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.