SCM

SCM Repository

[matrix] Diff of /www/slides/2010-07-21-Gaithersburg/sparse-model-matrices.Rnw
ViewVC logotype

Diff of /www/slides/2010-07-21-Gaithersburg/sparse-model-matrices.Rnw

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2574, Wed Jul 21 09:01:42 2010 UTC revision 2575, Wed Jul 21 09:18:06 2010 UTC
# Line 35  Line 35 
35  \end{frame}  \end{frame}
36    
37  \begin{frame}[fragile]\frametitle{Sparse \alert{Model} Matrices in 'Matrix'}  \begin{frame}[fragile]\frametitle{Sparse \alert{Model} Matrices in 'Matrix'}
38    These matrices can become very large (not only many rows, large $n$), but    \begin{itemize}
39    also many columns, large $p$).    \item
40      These matrices can become very large: Both many rows (large $n$), \emph{and}
41      many columns, large $p$.
42    
43    
44    \item
45    Eg., in Linear Mixed Effects Models,    Eg., in Linear Mixed Effects Models,
46    \begin{equation*}    \begin{equation*}
47      \Ew{\bc Y|\bc B=\bm b} = \gX \bm\beta+\rZ\bm b,      \Ew{\bc Y|\bc B=\bm b} = \gX \bm\beta+\rZ\bm b,
48    \end{equation*}    \end{equation*}
49      \begin{itemize}
50      \item
51    the $\rZ$ matrix is often large and very sparse, and in \pkg{lme4} has    the $\rZ$ matrix is often large and very sparse, and in \pkg{lme4} has
52    always been stored as \code{"sparseMatrix"} (notably, \code{"dgCMatrix"}).      always been stored as \code{"sparseMatrix"} (\code{"dgCMatrix"}, specifically).
53    
54      \item
55    Sometimes, $\gX$, (fixed effect matrix) is large, too.    Sometimes, $\gX$, (fixed effect matrix) is large, too.
56    \nlQ $\to$ optionally also \code{"sparseMatrix"} in    \nlQ $\to$ optionally also \code{"sparseMatrix"} in
57    \pkg{lme4}\footnote{the development version of \pkg{lme4}, currently called \pkg{lme4a}.}.    \pkg{lme4}\footnote{the development version of \pkg{lme4}, currently called \pkg{lme4a}.}.
58      \end{itemize}
59    
60    \medskip  \item
   
61    We've extended \Rfun{model.\Ul{m}atrix} to  \Rfun{model.\Ul{M}atrix} in    We've extended \Rfun{model.\Ul{m}atrix} to  \Rfun{model.\Ul{M}atrix} in
62    package \pkg{Matrix} with optional argument \code{sparse = TRUE}.    package \pkg{Matrix} with optional argument \code{sparse = TRUE}.
63    \end{itemize}
64  \end{frame}  \end{frame}
65    
66  \begin{frame}[fragile]  \begin{frame}[fragile]
# Line 78  Line 86 
86  \end{Sinput}  \end{Sinput}
87  \end{Schunk}  \end{Schunk}
88  \end{footnotesize}  \end{footnotesize}
89  ---\\  \medskip
90  (adding \code{"ddenseMatrix"} above does \emph{not} influence slots, but yields  
91  consistent superclass ordering.)  % (adding \code{"ddenseMatrix"} above does \emph{not} influence slots, but yields
92    % consistent superclass ordering.)
93    (\code{"ddenseMatrix"}: \emph{not} for slots, but
94    consistent superclass ordering)
95  \end{frame}  \end{frame}
96    
97  \begin{frame}[fragile]\frametitle{model.\alert{M}atrix(*, sparse=TRUE)}  \begin{frame}[fragile]\frametitle{model.\alert{M}atrix(*, sparse=TRUE)}
# Line 150  Line 161 
161    
162  \begin{frame}[fragile]\frametitle{(2) Prediction Module}  \begin{frame}[fragile]\frametitle{(2) Prediction Module}
163  %\item  %\item
164  \code{"predModule"}: Linear predictor modules, which consist of the model  \code{"predModule"}: Linear predictor module consists of
165  matrix, the coefficient vector and a triangular factor of the weighted  \begin{itemize}
166  model matrix, currently in \textcolor{Orange}{dense} and  \item the model matrix \code{X},
167    \item the coefficient vector \code{coef},
168    \item a triangular factor of the weighted model matrix \code{fac},
169    \item (\code{Vtr} $= \bm {V\trans r}$, where $\bm r =$ residuals (typically)
170    \end{itemize}
171    currently in \textcolor{Orange}{dense} and
172  \textcolor{Mulberry}{sparse} flavor:  \textcolor{Mulberry}{sparse} flavor:
173    
174    \medskip
175    
176  \begin{footnotesize}\begin{Schunk}  \begin{footnotesize}\begin{Schunk}
177  \begin{Sinput}  \begin{Sinput}
178  setClass("predModule",  setClass("predModule",
# Line 172  Line 191 
191    
192  \begin{frame}  \begin{frame}
193    \frametitle{Fitting all ``glpModel''s with One IRLS algorithm}    \frametitle{Fitting all ``glpModel''s with One IRLS algorithm}
194    Fitting:   The prediction and response module parts each update    Fitting via IRLS (Iteratively Reweighted Least Squares), where
195      the prediction and response module parts each update
196    ``themselves''.    ``themselves''.
197    
198      \bigskip
199    
200      These 3 Steps are iterated till convergence:\\
201    \begin{enumerate}    \begin{enumerate}
202    \item prediction module only passes $\bm \mu$ to response module    \item prediction module (\textsc{pm}) only passes \code{X \%*\% coef}$ = \bm X \beta$
203        to the response module (\textsc{rm})
204      \item from that, the \textsc{rm}
205        \begin{itemize}
206        \item updates its $\bm \mu$,
207        \item then its weighted residuals and ``X weights''
208        \end{itemize}
209      \item these two are in turn passed to \textsc{pm} which
210        \begin{itemize}
211        \item reweights itself and
212        \item \code{solve()}s for
213          $\Delta\bm\beta$, the \emph{increment} of $\bm\beta$.
214        \end{itemize}
215    \end{enumerate}    \end{enumerate}
216      Convergence only if Bates-Watts orthgonality criterion is fulfilled.
217  \end{frame}  \end{frame}
218    
219    
220  %%% Local Variables:  %%% Local Variables:
221  %%% TeX-command-default: "LaTeX PDF"  %%% TeX-command-default: "LaTeX PDF"
222  %%% TeX-master: "MaechlerBates.tex"  %%% TeX-master: "MaechlerBates.tex"

Legend:
Removed from v.2574  
changed lines
  Added in v.2575

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge