The package is an function that estimates sparse nonlinear components using the COSSO penalty. This package is available from the Comprehensive R Archive Network. This script describes a example of how to use the package.
We first load the library for and set a seed for reproducibility.
The function data_generation
generates example datasets
with continuous response. We generate a training set with \(n=200\) and \(p=20\), and a test set with \(n=1000\) and \(p=20\).
The function cossonet
is the main function that fits the
model. We have to input training set in this function. And Specific
values are required to the arguments, such as family
,
lambda0
, and lambda_theta
.
The function cossonet.predict
is used to predict new
data based on the fitted model. The output includes predicted values
\(\hat{f}\) (from f.new
)
and \(\hat{\mu}\) (from
mu.new
) for the new data. The predicted value and
predictive accuracy for the test set using our fitted model can be
obtained by