LazyData: yes
URL: http://git.auder.net/?p=valse.git
License: MIT
+RoxygenNote: 5.0.1
--- /dev/null
+# Generated by roxygen2: do not edit by hand
+
+export(basic_Init_Parameters)
+export(discardSimilarModels)
+export(discardSimilarModels2)
+export(generateIO)
+export(generateIOdefault)
+export(gridLambda)
+export(indicesSelection)
+export(initSmallEM)
+export(modelSelection)
#' @param rho covariance matrix
#' @param pi weight parameters
#'
-#' @return
+#' @return a list with B1, in, rho, pi
#' @export
#'
-#' @examples
discardSimilarModels2 = function(B1,rho,pi)
{ ind = c()
dim_B1 = dim(B1)
glambda = rep(0,sizeLambda)
suppressmodel = discardSimilarModels(B1,B2,glambda,rho,pi)
- return (list(B1 = suppressmodel$B1, ind = suppressmodel$B2,
+ return (list(B1 = suppressmodel$B1, ind = suppressmodel$ind,
rho = suppressmodel$rho, pi = suppressmodel$pi))
}
#' Generate a sample of (X,Y) of size n
-#' @param covX covariance for covariates
-#' @param covY covariance for the response vector
+#' @param covX covariance for covariates (of size p*p*K)
+#' @param covY covariance for the response vector (of size m*m*K)
#' @param pi proportion for each cluster
#' @param beta regression matrix
#' @param n sample size
+#'
#' @return list with X and Y
#' @export
#-----------------------------------------------------------------------
generateIO = function(covX, covY, pi, beta, n)
{
- size_covX = dim(covX)
- p = size_covX[1]
- k = size_covX[3]
+ p = dim(covX)[1]
- size_covY = dim(covY)
- m = size_covY[1]
+ m = dim(covY)[1]
+ k = dim(covY)[3]
Y = matrix(0,n,m)
BX = array(0, dim=c(n,m,k))
-#' Construct the set of relevant indices
+#' Construct the set of relevant indices -> ED: je crois que cette fonction n'est pas utile
#'
#' @param phi regression matrix, of size p*m
#' @param thresh threshold to say a cofficient is equal to zero
LLFinit1 = list()
require(MASS) #Moore-Penrose generalized inverse of matrix
+ require(mclust) # K-means with selection of K
for(repet in 1:20)
{
- clusters = hclust(dist(y)) #default distance : euclidean
- #cutree retourne les indices (? quel cluster indiv_i appartient) d'un clustering hierarchique
- clusterCut = cutree(clusters,k)
- Zinit1[,repet] = clusterCut
+ clusters = Mclust(matrix(c(X,Y),nrow=n),k) #default distance : euclidean
+ Zinit1[,repet] = clusters$classification
for(r in 1:k)
{
# initialisation for the allocations probabilities in each component
tauInit,
# values for the regularization parameter grid
- gridLambda = [];
+ gridLambda = c(),
# je ne crois pas vraiment qu'il faille les mettre en sortie, d'autant plus qu'on construit
# une matrice A1 et A2 pour chaque k, et elles sont grandes, donc ca coute un peu cher ...
A1,
Pi,
#immutable
- seuil = 1e-15;
+ seuil = 1e-15
),
methods = list(
#' and D1, a vector of corresponding dimensions
#' @export
#'
-#' @examples
modelSelection = function(LLF)
{
D = LLF[,2]
--- /dev/null
+## Programme qui sélectionne un modèle
+## proposer à l'utilisation différents critères (BIC, AIC, slope heuristic)
\ No newline at end of file
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/basicInitParameters.R
+\name{basic_Init_Parameters}
+\alias{basic_Init_Parameters}
+\title{Initialize the parameters in a basic way (zero for the conditional mean,
+ uniform for weights, identity for covariance matrices, and uniformly distributed forthe clustering)}
+\usage{
+basic_Init_Parameters(n, p, m, k)
+}
+\arguments{
+\item{n}{sample size}
+
+\item{p}{number of covariates}
+
+\item{m}{size of the response}
+
+\item{k}{number of clusters}
+}
+\value{
+list with phiInit, rhoInit,piInit,gamInit
+}
+\description{
+Initialize the parameters in a basic way (zero for the conditional mean,
+ uniform for weights, identity for covariance matrices, and uniformly distributed forthe clustering)
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/discardSimilarModels.R
+\name{discardSimilarModels}
+\alias{discardSimilarModels}
+\title{Discard models which have the same relevant variables}
+\usage{
+discardSimilarModels(B1, B2, glambda, rho, pi)
+}
+\arguments{
+\item{B1}{array of relevant coefficients (of size p*m*length(gridlambda))}
+
+\item{B2}{array of irrelevant coefficients (of size p*m*length(gridlambda))}
+
+\item{glambda}{grid of regularization parameters (vector)}
+
+\item{rho}{covariance matrix (of size m*m*K*size(gridLambda))}
+
+\item{pi}{weight parameters (of size K*size(gridLambda))}
+}
+\value{
+a list with update B1, B2, glambda, rho and pi, and ind the vector of indices
+ of selected models.
+}
+\description{
+Discard models which have the same relevant variables
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/discardSimilarModels2.R
+\name{discardSimilarModels2}
+\alias{discardSimilarModels2}
+\title{Similar to discardSimilarModels, for Lasso-rank procedure (focus on columns)}
+\usage{
+discardSimilarModels2(B1, rho, pi)
+}
+\arguments{
+\item{B1}{array of relevant coefficients (of size p*m*length(gridlambda))}
+
+\item{rho}{covariance matrix}
+
+\item{pi}{weight parameters}
+}
+\value{
+a list with B1, in, rho, pi
+}
+\description{
+Similar to discardSimilarModels, for Lasso-rank procedure (focus on columns)
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/generateIO.R
+\name{generateIO}
+\alias{generateIO}
+\title{Generate a sample of (X,Y) of size n}
+\usage{
+generateIO(covX, covY, pi, beta, n)
+}
+\arguments{
+\item{covX}{covariance for covariates}
+
+\item{covY}{covariance for the response vector}
+
+\item{pi}{proportion for each cluster}
+
+\item{beta}{regression matrix}
+
+\item{n}{sample size}
+}
+\value{
+list with X and Y
+}
+\description{
+Generate a sample of (X,Y) of size n
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/generateIOdefault.R
+\name{generateIOdefault}
+\alias{generateIOdefault}
+\title{Generate a sample of (X,Y) of size n with default values}
+\usage{
+generateIOdefault(n, p, m, k)
+}
+\arguments{
+\item{n}{sample size}
+
+\item{p}{number of covariates}
+
+\item{m}{size of the response}
+
+\item{k}{number of clusters}
+}
+\value{
+list with X and Y
+}
+\description{
+Generate a sample of (X,Y) of size n with default values
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/gridLambda.R
+\name{gridLambda}
+\alias{gridLambda}
+\title{Construct the data-driven grid for the regularization parameters used for the Lasso estimator}
+\usage{
+gridLambda(phiInit, rhoInit, piInit, gamInit, X, Y, gamma, mini, maxi, tau)
+}
+\arguments{
+\item{phiInit}{value for phi}
+
+\item{piInit}{value for pi}
+
+\item{gamInit}{value for gamma}
+
+\item{mini}{minimum number of iterations in EM algorithm}
+
+\item{maxi}{maximum number of iterations in EM algorithm}
+
+\item{tau}{threshold to stop EM algorithm}
+
+\item{rhoInt}{value for rho}
+}
+\value{
+the grid of regularization parameters
+}
+\description{
+Construct the data-driven grid for the regularization parameters used for the Lasso estimator
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/indicesSelection.R
+\name{indicesSelection}
+\alias{indicesSelection}
+\title{Construct the set of relevant indices}
+\usage{
+indicesSelection(phi, thresh = 1e-06)
+}
+\arguments{
+\item{phi}{regression matrix, of size p*m}
+
+\item{thresh}{threshold to say a cofficient is equal to zero}
+}
+\value{
+a list with A, a matrix with relevant indices (size = p*m) and B, a
+ matrix with irrelevant indices (size = p*m)
+}
+\description{
+Construct the set of relevant indices
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/initSmallEM.R
+\name{initSmallEM}
+\alias{initSmallEM}
+\title{initialization of the EM algorithm}
+\usage{
+initSmallEM(k, X, Y, tau)
+}
+\arguments{
+\item{k}{number of components}
+
+\item{X}{matrix of covariates (of size n*p)}
+
+\item{Y}{matrix of responses (of size n*m)}
+
+\item{tau}{threshold to stop EM algorithm}
+}
+\value{
+a list with phiInit, rhoInit, piInit, gamInit
+}
+\description{
+initialization of the EM algorithm
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/modelSelection.R
+\name{modelSelection}
+\alias{modelSelection}
+\title{Among a collection of models, this function constructs a subcollection of models with
+models having strictly different dimensions, keeping the model which minimizes
+the likelihood if there were several with the same dimension}
+\usage{
+modelSelection(LLF)
+}
+\arguments{
+\item{LLF}{a matrix, the first column corresponds to likelihoods for several models
+the second column corresponds to the dimensions of the corresponding models.}
+}
+\value{
+a list with indices, a vector of indices selected models,
+ and D1, a vector of corresponding dimensions
+}
+\description{
+Among a collection of models, this function constructs a subcollection of models with
+models having strictly different dimensions, keeping the model which minimizes
+the likelihood if there were several with the same dimension
+}
+
--- /dev/null
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/vec_bin.R
+\name{vec_bin}
+\alias{vec_bin}
+\title{A function needed in initSmallEM}
+\usage{
+vec_bin(X, r)
+}
+\arguments{
+\item{X}{vector with integer values}
+
+\item{r}{integer}
+}
+\value{
+a list with Z (a binary vector of size the size of X) and indices where Z is equal to 1
+}
+\description{
+A function needed in initSmallEM
+}
+