Skip to content
Snippets Groups Projects
Commit 1d270d65 authored by Nathalie Vialaneix's avatar Nathalie Vialaneix
Browse files

added a class to the output and documented the function

parent 394ee094
No related branches found
No related tags found
No related merge requests found
......@@ -19,4 +19,4 @@ Imports:
RSpectra,
glmnet
License: GPL (>= 2)
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
# Generated by roxygen2: do not edit by hand
S3method(print,SISIRres)
S3method(print,ridgeRes)
S3method(print,sparseRes)
S3method(project,sparseRes)
S3method(summary,SISIRres)
S3method(summary,ridgeRes)
S3method(summary,sparseRes)
export(SISIR)
export(project)
export(ridgeSIR)
export(sfcb)
export(sparseSIR)
export(tune.ridgeSIR)
import(adjclust)
import(doParallel)
import(foreach)
import(glmnet)
import(magrittr)
importFrom(Boruta,Boruta)
importFrom(CORElearn,attrEval)
importFrom(Matrix,forceSymmetric)
importFrom(RSpectra,eigs)
importFrom(dplyr,arrange)
importFrom(dplyr,filter)
importFrom(dplyr,inner_join)
importFrom(dplyr,mutate)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,ungroup)
importFrom(expm,sqrtm)
importFrom(mixOmics,pls)
importFrom(parallel,detectCores)
importFrom(purrr,map_dfc)
importFrom(ranger,ranger)
importFrom(stats,cor)
importFrom(stats,cov)
importFrom(stats,predict)
importFrom(stats,quantile)
importFrom(tidyr,gather)
importFrom(tidyr,spread)
importFrom(utils,head)
## Q: name of the main function?
# Main function ####
# inputs:
# parallel : à voir (+ uniformiser dans SISIR)
# rep : répétitions de l'algorithme RF
# Q: which choices for rep?
# Q: other inputs?
#
# outputs:
# points sélectionnés ou importance + statistiques sur les "vrais" intervalles (mieux a posteriori) ?
# mse
# paramètres d'entrées
# computational times
# Q: other outputs?
################################################################################
# SFCB
################################################################################
#' @title SFCB
#' @export
#'
#' @description
#' \code{SFCB} performs interval selection based on random forests
#'
#' @param X input predictors (matrix or data.frame)
#' @param Y target variable (vector whose length is equal to the number of rows
#' in X)
#' @param group.method group method. Default to \code{"adjclust"}
#' @param summary.method summary method. Default to \code{"pls"}
#' @param selection.method selection method. Default to \code{"none"} (no
#' selection performed)
#' @param at number of groups targeted for output results (integer). Not used
#' when \code{range.at} is not \code{NULL}
#' @param range.at (vector of integer) sequence of the numbers of groups for
#' output results
#' @param seed random seed (integer)
#' @param repeats number of repeats for the final random forest computation
#' @param parallel not implemented yet
#'
#' @return an object of class \code{"SFCB"} with elements:
#' \item{dendro}{a dendrogram corresponding to the method chosen in
#' \code{group.method}}
#' \item{groups}{a list of length \code{length(range.at)} (or of length 1 if
#' \code{range.at == NULL}) that contains the clusterings of input variables
#' for the selected group numbers}
#' \item{summaries}{a list of the same length than \code{$groups} that
#' contains the summarized predictors according to the method chosen in
#' \code{summary.methods}}
#' \item{selected}{a list of the same length than \code{$groups} that contains
#' the names of the variable selected by \code{selection.method} if it is not
#' equal to \code{"none"}}
#' \item{mse}{a data.frame with \code{repeats} \eqn{\times}
#' \code{length($groups)} rows that contains Mean Squared Errors of the
#' \code{repeats} random forests fitted for each number of groups}
#' \item{importance}{a list of the same length than \code{$groups} that
#' contains a data.frame providing variable importances for the variables in
#' selected groups in \code{repeats} columns (one for each iteration of the
#' random forest method). When \code{summary.method == "basics"}, importance
#' for mean and sd are provided in separated columns, in which case, the
#' number of columns is equal to 2\code{repeats}}
#'
#' @author {Remi Servien, \email{remi.servien@inrae.fr}\cr
#' Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
#'
## TODO: add seealso, details, references and example in doc
## TODO: add parallel backend
## TODO: add computational time computations
sfcb <- function(X, Y, group.method = c("adjclust", "cclustofvar"),
summary.method = c("pls", "basics", "cclustofvar"),
selection.method = c("none", "boruta", "relief"),
at = round(0.15 * ncol(X)), range.at = NULL, seed = NULL,
repeats = 5, parallel = FALSE) {
# Input checking ####
group.method <- match.arg(group.method)
summary.method <- match.arg(summary.method)
......@@ -131,6 +167,8 @@ sfcb <- function(X, Y, group.method = c("adjclust", "cclustofvar"),
"importances" = all_qualities$importances)
}
class(out) <- "SFCB"
return(out)
}
......@@ -147,7 +185,6 @@ sfcb <- function(X, Y, group.method = c("adjclust", "cclustofvar"),
# out9 <- sfcb(x, Y, group.method = "adjclust", summary.method = "basics", selection.method = "relief")
# out10 <- sfcb(x, Y, group.method = "adjclust", summary.method = "pls", selection.method = "boruta", seed = 3)
# Methods #####
# plots
# pour "at"
......@@ -155,4 +192,4 @@ sfcb <- function(X, Y, group.method = c("adjclust", "cclustofvar"),
# pour range_at représenter l'évolution de la mse + représenter une dizaine d'intervalles max
# aussi : option dendrogramme pour représenter le dendrogramme avec le at ou le range_at identifié dessus
# qualities (requiert la vérité) + un éventuel seuil pour l'importance et calcule les valeurs de qualité (rand index, différence entre les importances avec un boxplot ?)
# ajout d'une méthode de plot dessus pour range_at, pour voir l'évolution de la qualité
# ajout d'une méthode de plot dessus pour range_at, pour voir l'évolution de la qualité
\ No newline at end of file
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparseSIR.R
\name{SISIR}
\alias{SISIR}
\title{Interval Sparse SIR}
\usage{
SISIR(
object,
inter_len = rep(1, nrow(object$EDR)),
sel_prop = 0.05,
itermax = Inf,
minint = 2,
parallel = TRUE,
ncores = NULL
)
}
\arguments{
\item{object}{an object of class \code{ridgeRes} as obtained from the
function \code{\link{ridgeSIR}}}
\item{inter_len}{(numeric) vector with interval lengths for the initial
state. Default is to set one interval for each variable (all intervals have
length 1)}
\item{sel_prop}{fraction of the coefficients that will be considered as
strong zeros and strong non zeros. Default to 0.05}
\item{itermax}{maximum number of iterations. Default to Inf}
\item{minint}{minimum number of intervals. Default to 2}
\item{parallel}{whether the computation should be performed in parallel or
not. Logical. Default is FALSE}
\item{ncores}{number of cores to use if \code{parallel = TRUE}. If left to
NULL, all available cores minus one are used}
}
\value{
S3 object of class \code{SISIR}: a list consisting of
\itemize{
\item{\code{sEDR}}{ the estimated EDR spaces (a list of p x d matrices)}
\item{\code{alpha}}{ the estimated shrinkage coefficients (a list of
vectors)}
\item{\code{intervals}}{ the interval lengths (a list of vectors)}
\item{\code{quality}}{ a data frame with various qualities for the model.
The chosen quality measures are the same than for the function
\code{\link{sparseSIR}} plus the number of intervals \code{nbint}}
\item{\code{init_sel_prop}}{ initial fraction of the coefficients which
are considered as strong zeros or strong non zeros}
\item{\code{rSIR}}{ same as the input \code{object}}
}
}
\description{
\code{SISIR} performs an automatic search of relevant intervals
}
\details{
Different quality criteria used to select the best models among a list of
models with different interval definitions. Quality criteria are:
log-likelihood (\code{loglik}), cross-validation error as provided by the
function \code{\link[glmnet]{glmnet}}, two versions of the AIC (\code{AIC}
and \code{AIC2}) and of the BIC (\code{BIC} and \code{BIC2}) in which the
number of parameters is either the number of non null intervals or the
number of non null parameters with respect to the original variables
}
\examples{
set.seed(1140)
tsteps <- seq(0, 1, length = 200)
nsim <- 100
simulate_bm <- function() return(c(0, cumsum(rnorm(length(tsteps)-1, sd=1))))
x <- t(replicate(nsim, simulate_bm()))
beta <- cbind(sin(tsteps*3*pi/2), sin(tsteps*5*pi/2))
beta[((tsteps < 0.2) | (tsteps > 0.5)), 1] <- 0
beta[((tsteps < 0.6) | (tsteps > 0.75)), 2] <- 0
y <- log(abs(x \%*\% beta[ ,1]) + 1) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(nsim, sd = 0.1)
res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
\dontrun{res_fused <- SISIR(res_ridge, rep(1, ncol(x)))}
}
\references{
{Picheny, V., Servien, R. and Villa-Vialaneix, N. (2016)
Interpretable sparse SIR for digitized functional data.
\emph{Statistics and Computing}, \strong{29}(2), 255--267.}
}
\seealso{
\code{\link{ridgeSIR}}, \code{\link{sparseSIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparseSIR.R
\name{SISIRres}
\alias{SISIRres}
\alias{summary.SISIRres}
\alias{print.SISIRres}
\title{Print SISIRres object}
\usage{
\method{summary}{SISIRres}(object, ...)
\method{print}{SISIRres}(x, ...)
}
\arguments{
\item{object}{a \code{SISIRres} object}
\item{...}{not used}
\item{x}{a \code{SISIRres} object}
}
\description{
Print a summary of the result of \code{\link{SISIRres}} (
\code{SISIRres} object)
}
\seealso{
\code{\link{SISIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparseSIR.R
\name{project}
\alias{project}
\alias{project.sparseRes}
\title{sparse SIR}
\usage{
\method{project}{sparseRes}(object)
project(object)
}
\arguments{
\item{object}{an object of class \code{sparseRes} as obtained from the
function \code{\link{sparseSIR}}}
}
\value{
a matrix of dimension n x d with the projection of the observations
on the d dimensions of the sparse EDR space
}
\description{
\code{project} performs the projection on the sparse EDR space (as obtained
by the \code{\link[glmnet]{glmnet}})
}
\details{
The projection is obtained by the function
\code{\link[glmnet]{predict.glmnet}}.
}
\examples{
set.seed(1140)
tsteps <- seq(0, 1, length = 200)
nsim <- 100
simulate_bm <- function() return(c(0, cumsum(rnorm(length(tsteps)-1, sd=1))))
x <- t(replicate(nsim, simulate_bm()))
beta <- cbind(sin(tsteps*3*pi/2), sin(tsteps*5*pi/2))
beta[((tsteps < 0.2) | (tsteps > 0.5)), 1] <- 0
beta[((tsteps < 0.6) | (tsteps > 0.75)), 2] <- 0
y <- log(abs(x \%*\% beta[ ,1]) + 1) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(nsim, sd = 0.1)
\dontrun{
res_ridge <- ridgeSIR(x, y, H = 10, d = 2)
res_sparse <- sparseSIR(res_ridge, rep(1, ncol(x)))
proj_data <- project(res_sparse)
}
}
\references{
{Picheny, V., Servien, R. and Villa-Vialaneix, N. (2016)
Interpretable sparse SIR for digitized functional data.
\emph{Statistics and Computing}, \strong{29}(2), 255--267.}
}
\seealso{
\code{\link{sparseSIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ridgeSIR.R
\name{ridgeRes}
\alias{ridgeRes}
\alias{summary.ridgeRes}
\alias{summary.ridgeRes()}
\alias{print.ridgeRes}
\alias{ridgeRes-class}
\title{Print ridgeRes object}
\usage{
\method{summary}{ridgeRes}(object, ...)
\method{print}{ridgeRes}(x, ...)
}
\arguments{
\item{object}{a \code{ridgeRes} object}
\item{...}{not used}
\item{x}{a \code{ridgeRes} object}
}
\description{
Print a summary of the result of \code{\link{ridgeSIR}} (
\code{ridgeRes} object)
}
\seealso{
\code{\link{ridgeSIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ridgeSIR.R
\name{ridgeSIR}
\alias{ridgeSIR}
\title{ridge SIR}
\usage{
ridgeSIR(x, y, H, d, mu2 = NULL)
}
\arguments{
\item{x}{explanatory variables (numeric matrix or data frame)}
\item{y}{target variable (numeric vector)}
\item{H}{number of slices (integer)}
\item{d}{number of dimensions to be kept}
\item{mu2}{ridge regularization parameter (numeric, positive)}
}
\value{
S3 object of class \code{ridgeRes}: a list consisting of
\itemize{
\item{\code{EDR}}{ the estimated EDR space (a p x d matrix)}
\item{\code{condC}}{ the estimated slice projection on EDR (a d x H
matrix)}
\item{\code{eigenvalues}}{ the eigenvalues obtained during the generalized
eigendecomposition performed by SIR}
\item{\code{parameters}}{ a list of hyper-parameters for the method:
\itemize{
\item{\code{H}}{ number of slices}
\item{\code{d}}{ dimension of the EDR space}
\item{\code{mu2}}{ regularization parameter for the ridge penalty}
}}
\item{\code{utils}}{ useful outputs for further computations:
\itemize{
\item{\code{Sigma}}{ covariance matrix for x}
\item{\code{slices}}{ slice number for all observations}
\item{\code{invsqrtS}}{ value of the inverse square root of the
regularized covariance matrix for x}
}}
}
}
\description{
\code{ridgeSIR} performs the first step of the method (ridge regularization
of SIR)
}
\details{
SI-SIR
}
\examples{
set.seed(1140)
tsteps <- seq(0, 1, length = 50)
simulate_bm <- function() return(c(0, cumsum(rnorm(length(tsteps)-1, sd=1))))
x <- t(replicate(50, simulate_bm()))
beta <- cbind(sin(tsteps*3*pi/2), sin(tsteps*5*pi/2))
y <- log(abs(x \%*\% beta[ ,1])) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(50, sd = 0.1)
res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
\dontrun{print(res_ridge)}
}
\references{
{Picheny, V., Servien, R. and Villa-Vialaneix, N. (2016)
Interpretable sparse SIR for digitized functional data.
\emph{Statistics and Computing}, \strong{29}(2), 255--267.}
}
\seealso{
\code{\link{sparseSIR}}, \code{\link{SISIR}},
\code{\link{tune.ridgeSIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SFCB.R
\name{sfcb}
\alias{sfcb}
\title{SFCB}
\usage{
sfcb(
X,
Y,
group.method = c("adjclust", "cclustofvar"),
summary.method = c("pls", "basics", "cclustofvar"),
selection.method = c("none", "boruta", "relief"),
at = round(0.15 * ncol(X)),
range.at = NULL,
seed = NULL,
repeats = 5,
parallel = FALSE
)
}
\arguments{
\item{X}{input predictors (matrix or data.frame)}
\item{Y}{target variable (vector whose length is equal to the number of rows
in X)}
\item{group.method}{group method. Default to \code{"adjclust"}}
\item{summary.method}{summary method. Default to \code{"pls"}}
\item{selection.method}{selection method. Default to \code{"none"} (no
selection performed)}
\item{at}{number of groups targeted for output results (integer). Not used
when \code{range.at} is not \code{NULL}}
\item{range.at}{(vector of integer) sequence of the numbers of groups for
output results}
\item{seed}{random seed (integer)}
\item{repeats}{number of repeats for the final random forest computation}
\item{parallel}{not implemented yet}
}
\value{
an object of class \code{"SFCB"} with elements:
\item{dendro}{a dendrogram corresponding to the method chosen in
\code{group.method}}
\item{groups}{a list of length \code{length(range.at)} (or of length 1 if
\code{range.at == NULL}) that contains the clusterings of input variables
for the selected group numbers}
\item{summaries}{a list of the same length than \code{$groups} that
contains the summarized predictors according to the method chosen in
\code{summary.methods}}
\item{selected}{a list of the same length than \code{$groups} that contains
the names of the variable selected by \code{selection.method} if it is not
equal to \code{"none"}}
\item{mse}{a data.frame with \code{repeats} \eqn{\times}
\code{length($groups)} rows that contains Mean Squared Errors of the
\code{repeats} random forests fitted for each number of groups}
\item{importance}{a list of the same length than \code{$groups} that
contains a data.frame providing variable importances for the variables in
selected groups in \code{repeats} columns (one for each iteration of the
random forest method). When \code{summary.method == "basics"}, importance
for mean and sd are provided in separated columns, in which case, the
number of columns is equal to 2\code{repeats}}
}
\description{
\code{SFCB} performs interval selection based on random forests
}
\author{
{Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparseSIR.R
\name{sparseRes}
\alias{sparseRes}
\alias{summary.sparseRes}
\alias{print.sparseRes}
\alias{sparseRes-class}
\title{Print sparseRes object}
\usage{
\method{summary}{sparseRes}(object, ...)
\method{print}{sparseRes}(x, ...)
}
\arguments{
\item{object}{a \code{sparseRes} object}
\item{...}{not used}
\item{x}{a \code{sparseRes} object}
}
\description{
Print a summary of the result of \code{\link{sparseSIR}} (
\code{sparseRes} object)
}
\seealso{
\code{\link{sparseSIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inra.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sparseSIR.R
\name{sparseSIR}
\alias{sparseSIR}
\title{sparse SIR}
\usage{
sparseSIR(
object,
inter_len,
adaptive = FALSE,
sel_prop = 0.05,
parallel = FALSE,
ncores = NULL
)
}
\arguments{
\item{object}{an object of class \code{ridgeRes} as obtained from the
function \code{\link{ridgeSIR}}}
\item{inter_len}{(numeric) vector with interval lengths}
\item{adaptive}{should the function returns the list of strong zeros and non
strong zeros (logical). Default to FALSE}
\item{sel_prop}{used only when \code{adaptive = TRUE}. Fraction of the
coefficients that will be considered as strong zeros and strong non zeros.
Default to 0.05}
\item{parallel}{whether the computation should be performed in parallel or
not. Logical. Default is FALSE}
\item{ncores}{number of cores to use if \code{parallel = TRUE}. If left to
NULL, all available cores minus one are used}
}
\value{
S3 object of class \code{sparseRes}: a list consisting of
\itemize{
\item{\code{sEDR}}{ the estimated EDR space (a p x d matrix)}
\item{\code{alpha}}{ the estimated shrinkage coefficients (a vector having
a length similar to \code{inter_len})}
\item{\code{quality}}{ a vector with various qualities for the model (see
Details)}
\item{\code{adapt_res}}{ if \code{adaptive = TRUE}, a list of two vectors:
\itemize{
\item{\code{nonzeros}}{ indexes of variables that are strong non zeros}
\item{\code{zeros}}{ indexes of variables that are strong zeros}
}}
\item{\code{parameters}}{ a list of hyper-parameters for the method:
\itemize{
\item{\code{inter_len}}{ lengths of intervals}
\item{\code{sel_prop}}{ if \code{adaptive = TRUE}, fraction of the
coefficients which are considered as strong zeros or strong non zeros}
}}
\item{\code{rSIR}}{ same as the input \code{object}}
\item{\code{fit}}{ a list for LASSO fit with:
\itemize{
\item{\code{glmnet}} result of the \code{\link[glmnet]{glmnet}} function
\item{\code{lambda}} value of the best Lasso parameter by CV
\item{\code{x}} exploratory variable values as passed to fit the model
}}
}
@details Different quality criteria used to select the best models among a
list of models with different interval definitions. Quality criteria are:
log-likelihood (\code{loglik}), cross-validation error as provided by the
function \code{\link[glmnet]{glmnet}}, two versions of the AIC (\code{AIC}
and \code{AIC2}) and of the BIC (\code{BIC} and \code{BIC2}) in which the
number of parameters is either the number of non null intervals or the
number of non null parameters with respect to the original variables.
}
\description{
\code{sparseSIR} performs the second step of the method (shrinkage of ridge
SIR results
}
\examples{
set.seed(1140)
tsteps <- seq(0, 1, length = 200)
nsim <- 100
simulate_bm <- function() return(c(0, cumsum(rnorm(length(tsteps)-1, sd=1))))
x <- t(replicate(nsim, simulate_bm()))
beta <- cbind(sin(tsteps*3*pi/2), sin(tsteps*5*pi/2))
beta[((tsteps < 0.2) | (tsteps > 0.5)), 1] <- 0
beta[((tsteps < 0.6) | (tsteps > 0.75)), 2] <- 0
y <- log(abs(x \%*\% beta[ ,1]) + 1) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(nsim, sd = 0.1)
res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
res_sparse <- sparseSIR(res_ridge, rep(10, 20))
}
\references{
{Picheny, V., Servien, R. and Villa-Vialaneix, N. (2016)
Interpretable sparse SIR for digitized functional data.
\emph{Statistics and Computing}, \strong{29}(2), 255--267.}
}
\seealso{
\code{\link{ridgeSIR}}, \code{\link{project.sparseRes}},
\code{\link{SISIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ridgeSIR.R
\name{tune.ridgeSIR}
\alias{tune.ridgeSIR}
\title{Cross-Validation for ridge SIR}
\usage{
tune.ridgeSIR(
x,
y,
listH,
list_mu2,
list_d,
nfolds = 10,
parallel = TRUE,
ncores = NULL
)
}
\arguments{
\item{x}{explanatory variables (numeric matrix or data frame)}
\item{y}{target variable (numeric vector)}
\item{listH}{list of the number of slices to be tested (numeric vector)}
\item{list_mu2}{list of ridge regularization parameters to be tested
(numeric vector)}
\item{list_d}{list of the dimensions to be tested (numeric vector)}
\item{nfolds}{number of folds for the cross validation. Default is 10}
\item{parallel}{whether the computation should be performed in parallel or
not. Logical. Default is FALSE}
\item{ncores}{number of cores to use if \code{parallel = TRUE}. If left to
NULL, all available cores minus one are used}
}
\value{
a data frame with tested parameters and corresponding CV error and
estimation of R(d)
}
\description{
\code{tune.ridgeSIR} performs a Cross Validation for ridge SIR estimation
}
\examples{
set.seed(1115)
tsteps <- seq(0, 1, length = 200)
nsim <- 100
simulate_bm <- function() return(c(0, cumsum(rnorm(length(tsteps)-1, sd=1))))
x <- t(replicate(nsim, simulate_bm()))
beta <- cbind(sin(tsteps*3*pi/2), sin(tsteps*5*pi/2))
y <- log(abs(x \%*\% beta[ ,1])) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(nsim, sd = 0.1)
list_mu2 <- 10^(0:10)
listH <- c(5, 10)
list_d <- 1:4
set.seed(1129)
\dontrun{
res_tune <- tune.ridgeSIR(x, y, listH, list_mu2, list_d,
nfolds = 10, parallel = TRUE)}
}
\references{
{Picheny, V., Servien, R. and Villa-Vialaneix, N. (2016)
Interpretable sparse SIR for digitized functional data.
\emph{Statistics and Computing}, \strong{29}(2), 255--267.}
}
\seealso{
\code{\link{ridgeSIR}}
}
\author{
{Victor Picheny, \email{victor.picheny@inrae.fr}\cr
Remi Servien, \email{remi.servien@inrae.fr}\cr
Nathalie Vialaneix, \email{nathalie.vialaneix@inrae.fr}}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment