From 5859426b074bdb7084627f8eeba806f479f04f05 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Fri, 14 Dec 2018 12:41:40 +0100
Subject: [PATCH] Refresh package doc, some advances on vignette

---
 pkg/man/morpheus-package.Rd | 15 ++++++++-------
 vignettes/report.Rmd        | 38 ++++++++++++++++++++++++++++++++-----
 2 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/pkg/man/morpheus-package.Rd b/pkg/man/morpheus-package.Rd
index e8181aa..a66684f 100644
--- a/pkg/man/morpheus-package.Rd
+++ b/pkg/man/morpheus-package.Rd
@@ -14,22 +14,23 @@
 \details{
 	The package devtools should be useful in development stage, since we rely on testthat for
 	unit tests, and roxygen2 for documentation. knitr is used to generate the package vignette.
+	jointDiag allows to solve a joint diagonalization problem, providing a more robust
+	solution compared to a single diagonalization.
 	Concerning the other suggested packages:
 	\itemize{
 		\item{tensor is used for comparing to some reference functions initially coded in R;
 			it should not be required in further package versions;}
-		\item{jointDiag allows to solve a joint diagonalization problem, providing a more
-			robust solution compared to a single diagonalization;}
 		\item{parallel (generally) permits to run the bootstrap method faster.}
 	}
 
-	The three main functions are located in R/main.R:
+	The two main functions are located in R/computeMu.R and R/optimParams.R:
 	\itemize{
-		\item{getParamsDirs_ref: reference method to estimate parameters directions;}
-		\item{getParamsDirs: method of choice to estimate parameters directions, using a
-			spectral decomposition of inputs/outputs;}
-		\item{getBootstrapParams: run getParamsDirs on B bootstrap replicates.}
+		\item{computeMu(): estimation of parameters directions;}
+		\item{optimParams(): builds an object \code{o} to estimate all other parameters
+			when calling \code{o$run()}, starting from the directions obtained by previous function}
 	}
+	See also \code{multiRun()}, which is a flexible method to run Monte-Carlo or bootstrap
+	estimations using different models in various contexts.
 }
 
 \author{
diff --git a/vignettes/report.Rmd b/vignettes/report.Rmd
index ba1e5a8..4de2b4d 100644
--- a/vignettes/report.Rmd
+++ b/vignettes/report.Rmd
@@ -74,11 +74,39 @@ identity $d\times d$ matrix. All results may be easily extended to the situation
 where $X\sim \mathcal{N}(m,\Sigma)$, $m\in \R^{d}$, $\Sigma$ a positive and
 symetric $d\times d$ matrix. ***** TODO: take this into account? -->
 
-TODO
+The two main functions are:
+ * computeMu(), which estimates the parameters directions, and
+ * optimParams(), which builds an object \code{o} to estimate all other parameters
+   when calling \code{o$run()}, starting from the directions obtained by the
+   previous function.
+A third function is useful to run Monte-Carlo or bootstrap estimations using
+different models in various contexts: multiRun(). We'll show example for all of them.
 
-3) Experiments: show package usage
+### Estimation of directions
 
-\subsection{Experiments}
-In this section, we evaluate our algorithm in a first step using mean squared error (MSE). In a second step, we compare experimentally our moments method (morpheus package \cite{Loum_Auder}) and the likelihood method (with felxmix package \cite{bg-papers:Gruen+Leisch:2007a}). 
+In a real situation you would have (maybe after some pre-processing) the matrices
+X and Y which contain vector inputs and binary output.
+However, a function is provided in the package to generate such data following a
+pre-defined law:
 
-TODO.........
+io <- generateSampleIO(n=10000, p=1/2, beta=matrix(c(1,0,0,1),ncol=2), b=c(0,0), link="probit")
+
+n is the total number of samples (lines in X, number of elements in Y)
+p is a vector of proportions, of size d-1 (because the last proportion is deduced from
+  the others: p elements sums to 1) [TODO: omega or p?]
+beta is the matrix of linear coefficients, as written above in the model.
+b is the vector of intercepts (as in linear regression, and as in the model above)
+link can be either "logit" or "probit", as mentioned earlier.
+
+This function outputs a list containing in particular the matrices X and Y, allowing to
+use the other functions (which all require either these, or the moments).
+
+TODO: computeMu(), explain input/output
+
+### Estimation of other parameters
+
+TODO: just run optimParams$run(...)
+
+### Monte-Carlo and bootstrap
+
+TODO: show example comparison with flexmix, show plots.
-- 
2.44.0