predict.logilasso {logilasso} | R Documentation |
Predicts the interaction vector beta of a loglinear interaction
model.
Description
Predicts the interaction vector(s) beta of a loglinear model
log(p)=X*beta
, fitted either
by logilasso
or levelcv
. If lambda
is specified,
this lambda is taken to predict the beta for this value of lambda. If no
value for lambda
is specified, then the optimal value calculated
by cross-validation is taken for objects of class
cvlogilasso
. For objects of class logilasso
where no
cross-validation was performed, the whole solution path for all lambdas
is returned.
Usage
## S3 method for class 'logilasso':
predict(object, lambda = NULL, ...)
## S3 method for class 'cvlogilasso':
predict(object, lambda = NULL, ...)
## S3 method for class 'levellogilasso':
predict(object, lambda = NULL, to.which.int =
NULL, ...)
Arguments
object |
Object of class levellogilasso , cvlogilasso or class logilasso . |
lambda |
Value for the penalization parameter lambda ,
for which the corresponding beta should be calculated. |
to.which.int |
The number of factors the model should be
predicted for. |
... |
Additional arguments to predict function. |
Value
Is either an object of class predlogilasso
if a value for
lambda
was specified or if the optimal lambda can was
assessed by cross-validation. Otherwise, if no value for lambda
was specified and at the same time cvfold
was chosen to be 1
(no cross-validation) it is of class predlogispez
. The
difference between these two classes is described below.
beta |
A predicted value for beta if the object is of class
predlogilasso . For the class predlogispez this is a
matrix consisting of the columns beta for the whole solution
path. |
lambda |
The lambda(s) for which the beta(s) was/were calculated. |
probs |
Probabilities according to the model probs=exp(X*beta) |
nls |
Negative likelihood score. For details see http://stat.ethz.ch/~dahinden/Paper/BMC.pdf |
betapath |
The whole solution originally calculated path. For objects of class
predlogispez this equals beta . |
lambdapath |
The lambdas corresponding to the value betapath . |
losspath |
nls for the whole solution path. |
See Also
logilasso
Examples
library(gRbase)
data(reinis)
fit <- logilasso(reinis,lambdainit=1,lambdamin=0.1)
pred1 <- predict(fit,lambda=0.5)
pred2 <- predict(fit)
fitcv <- logilasso(reinis,lambdainit=1,lambdamin=0.1,cvfold=3)
predcv1 <- predict(fitcv)
levellogi <- levelcv(reinis,lambdainit=1,lambdamin=0.1,to.which.int=3,cvfold=3)
predlevel <- predict(levellogi)
## Methods plot and graphmod exist for all predicted models
## Except for pred2, there is no graphmod method, because no
## lambda was specified
plot(predcv1)
graphmod(predcv1)
[Package
logilasso version 0.1.0
Index]