[Sciviews-commits] r458 - in pkg: SciViews SciViews/R SciViews/inst/doc SciViews/vignettes svSocket svSocket/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 29 10:26:48 CEST 2012


Author: phgrosjean
Date: 2012-03-29 10:26:48 +0200 (Thu, 29 Mar 2012)
New Revision: 458

Added:
   pkg/SciViews/vignettes/
   pkg/SciViews/vignettes/correlation.Rnw
   pkg/SciViews/vignettes/correlation.lyx
   pkg/SciViews/vignettes/correlation.pdf
   pkg/SciViews/vignettes/introduction.Rnw
   pkg/SciViews/vignettes/introduction.lyx
   pkg/SciViews/vignettes/introduction.pdf
   pkg/SciViews/vignettes/pca.Rnw
   pkg/SciViews/vignettes/pca.lyx
   pkg/SciViews/vignettes/pca.pdf
Removed:
   pkg/SciViews/inst/doc/correlation.lyx
   pkg/SciViews/inst/doc/introduction.lyx
   pkg/SciViews/inst/doc/pca.lyx
Modified:
   pkg/SciViews/NAMESPACE
   pkg/SciViews/R/ln.R
   pkg/SciViews/R/misc.R
   pkg/svSocket/DESCRIPTION
   pkg/svSocket/NEWS
   pkg/svSocket/R/evalServer.R
Log:
Bug correction in evalServer() in svSocket and vignettes of SciViews package in /vignettes subdirectory

Modified: pkg/SciViews/NAMESPACE
===================================================================
--- pkg/SciViews/NAMESPACE	2012-03-24 07:35:42 UTC (rev 457)
+++ pkg/SciViews/NAMESPACE	2012-03-29 08:26:48 UTC (rev 458)
@@ -82,6 +82,8 @@
 	   l,
 	   nc,
 	   nr,
+	   Rows,
+	   Cols,
 	   "@",
 	   "@<-",
 	   "@:=",
@@ -97,7 +99,8 @@
 	   cwm.colors,
 	   rwb.colors,
 	   ryg.colors,
-	   e,
+	   Pi,
+	   E,
 	   lb,
 	   ln,
 	   ln1p,

Modified: pkg/SciViews/R/ln.R
===================================================================
--- pkg/SciViews/R/ln.R	2012-03-24 07:35:42 UTC (rev 457)
+++ pkg/SciViews/R/ln.R	2012-03-29 08:26:48 UTC (rev 458)
@@ -12,6 +12,7 @@
 
 lg1p <- function (x) log1p(x) / log(10)
 
-e <- exp(1)
+## Use of uppercase E, because all constants start with an uppercase
+E <- exp(1)
 
 lb <- function (x) log2(x)

Modified: pkg/SciViews/R/misc.R
===================================================================
--- pkg/SciViews/R/misc.R	2012-03-24 07:35:42 UTC (rev 457)
+++ pkg/SciViews/R/misc.R	2012-03-29 08:26:48 UTC (rev 458)
@@ -72,6 +72,14 @@
 nc <- NCOL
 nr <- NROW
 
+## Constants (must start with an uppercase letter)
+## => redefine Pi instead of pi
+Pi <- pi
+## Useful for apply() familly:
+Rows <- 1
+Cols <- 2
+## Instead of apply(x, 2, sum), it gives apply(x, Cols, sum)
+
 ## Problem of functional language like R: too much copy!
 ## For instance, change a simple attribute using attr(x) <- value
 ## leads to a copy of the object.... If the object is large, time

Deleted: pkg/SciViews/inst/doc/correlation.lyx
===================================================================
--- pkg/SciViews/inst/doc/correlation.lyx	2012-03-24 07:35:42 UTC (rev 457)
+++ pkg/SciViews/inst/doc/correlation.lyx	2012-03-29 08:26:48 UTC (rev 458)
@@ -1,401 +0,0 @@
-#LyX 2.0 created this file. For more info see http://www.lyx.org/
-\lyxformat 413
-\begin_document
-\begin_header
-\textclass article
-\begin_preamble
-% \VignetteIndexEntry{Correlation}
-%\VignettePackage{SciViews}
-
-% provides caption formatting
-\usepackage[labelfont=bf, tableposition=top]{caption}
-\pdfimageresolution 96
-\end_preamble
-\use_default_options false
-\begin_modules
-svSweave
-\end_modules
-\maintain_unincluded_children false
-\language english
-\language_package default
-\inputencoding utf8x
-\fontencoding global
-\font_roman palatino
-\font_sans berasans
-\font_typewriter beramono
-\font_default_family default
-\use_non_tex_fonts false
-\font_sc true
-\font_osf false
-\font_sf_scale 100
-\font_tt_scale 100
-
-\graphics default
-\default_output_format default
-\output_sync 0
-\bibtex_command default
-\index_command default
-\float_placement tbh
-\paperfontsize default
-\spacing single
-\use_hyperref true
-\pdf_title "SciViews - Correlation"
-\pdf_author "Philippe Grosjean"
-\pdf_subject "Tutorial for correlation"
-\pdf_keywords "correlation, Pearson's product-moment, Spearmann's rank correlation, Kendall's tau, partial correlation"
-\pdf_bookmarks true
-\pdf_bookmarksnumbered false
-\pdf_bookmarksopen false
-\pdf_bookmarksopenlevel 1
-\pdf_breaklinks true
-\pdf_pdfborder false
-\pdf_colorlinks true
-\pdf_backref false
-\pdf_pdfusetitle true
-\pdf_quoted_options "linkcolor=blue, urlcolor=blue, citecolor=blue, pagecolor=blue"
-\papersize a4paper
-\use_geometry false
-\use_amsmath 0
-\use_esint 0
-\use_mhchem 1
-\use_mathdots 1
-\cite_engine natbib_authoryear
-\use_bibtopic false
-\use_indices false
-\paperorientation portrait
-\suppress_date false
-\use_refstyle 0
-\index Index
-\shortcut idx
-\color #008000
-\end_index
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\paragraph_indentation default
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\bullet 0 0 17 -1
-\bullet 1 0 15 -1
-\bullet 2 0 8 -1
-\bullet 3 0 9 -1
-\tracking_changes false
-\output_changes false
-\html_math_output 0
-\html_css_as_file 0
-\html_be_strict false
-\end_header
-
-\begin_body
-
-\begin_layout Title
-Correlation
-\end_layout
-
-\begin_layout Author
-Ph.
- Grosjean <phgrosjean at sciviews.org>
-\end_layout
-
-\begin_layout Part
-Introduction
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Plain Layout
-
-
-\backslash
-setkeys{Gin}{width=1.00
-\backslash
-textwidth}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout R-Opts
-keep.source = TRUE, pdf = TRUE, eps = FALSE
-\end_layout
-
-\begin_layout Standard
-Correlation is a form of 
-\series bold
-association
-\series default
- between two random variables or samples of these in statistics.
- Dependence is a synonym of correlation (???) Aspects to develop:
-\end_layout
-
-\begin_layout Itemize
-Three degrees of association: correlation, relationship and causality.
-\end_layout
-
-\begin_layout Itemize
-Correlation does not mean causality.
-\end_layout
-
-\begin_layout Itemize
-There are several kinds of correlation coefficients, with basic hypotheses
- one should know.
-\end_layout
-
-\begin_layout Itemize
-It is relatively easy to measure independence, but not dependence, because
- correlation coefficient measure only one given type of dependence (linear
- for Pearson's product-moment).
- Should derive something from the picture in Wikipedia that illustrates
- several cases).
-\end_layout
-
-\begin_layout Itemize
-Correlation coefficient is invariant for the slope of relationship,
-\end_layout
-
-\begin_layout Itemize
-Pearson's is not always defined (when there is no variation in 
-\emph on
-X
-\emph default
- or in 
-\emph on
-Y
-\emph default
-), same for Spearmann's and Kendall's (???) => but not useful in this case
- (!?).
-\end_layout
-
-\begin_layout Itemize
-In 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cor.test()
-\end_layout
-
-\end_inset
-
-, the confidence interval on the correlation coefficient is only calculated
- for Pearson's and when there are at least 4 complete cases.
- Also look at resampling estimation and test???
-\end_layout
-
-\begin_layout Itemize
-More robust correlation coefficients and less sensitive to nonlinear relationshi
-p.
-\end_layout
-
-\begin_layout Itemize
-Pearson's is not restricted to bivariate Normal distribution (!), but correlatio
-n hypothesis test is (=> use rank correlation to create test and confidence
- interval in case you suspect a different distribution)!
-\end_layout
-
-\begin_layout Itemize
-Show also problem with multimodal (multipopulation) data + solution = coef
- calculated per group.
-\end_layout
-
-\begin_layout Itemize
-A diagram indicating independence versus dependence + various types of dependenc
-ies (any kind, monotonous, linear) and the corresponding correlation coefficient
- that applies.
-\end_layout
-
-\begin_layout Itemize
-Useful simple examples to compare Pearson's and rank correlation in Wikipedia.
-\end_layout
-
-\begin_layout Itemize
-Correlation coefficients should be independent from translations and scaling,
- i.e., 
-\emph on
-X'
-\emph default
- = 
-\emph on
-aX
-\emph default
- + 
-\emph on
-b
-\emph default
-, and 
-\emph on
-Y'
-\emph default
- = 
-\emph on
-cY
-\emph default
- + 
-\emph on
-d
-\emph default
-.
- Rank coefficients are insensitive to monotone transformation too.
-\end_layout
-
-\begin_layout Itemize
-Unbiased? Asymptotically consistent?
-\end_layout
-
-\begin_layout Itemize
-Problem of restricted range for one or both variables: example in Wikipedia
- + the case of a sinusoidal signal!
-\end_layout
-
-\begin_layout Itemize
-Correlation matrices + properties + they are var/covar matrices of standardized
- (scaled) variables => demonstrate!
-\end_layout
-
-\begin_layout Itemize
-Manual calculation + tricks to speed up calc.
-\end_layout
-
-\begin_layout Itemize
-Nice example of correlation versus linearity in Anscombe's quartet (see
- Wikipedia).
-\end_layout
-
-\begin_layout Itemize
-Introduce and illustrate partial correlation.
-\end_layout
-
-\begin_layout Itemize
-See also 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-corpcor
-\end_layout
-
-\end_inset
-
-, 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-mvoutlier
-\end_layout
-
-\end_inset
-
-, 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-corrperm
-\end_layout
-
-\end_inset
-
- (for permutation tests of correlation with repeated measurements using
- 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cp.test()
-\end_layout
-
-\end_inset
-
-) packages.
- Also, 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-pcalg
-\end_layout
-
-\end_inset
-
- for robust estimation and causal inference.
-\end_layout
-
-\begin_layout Section
-Correlation in R
-\end_layout
-
-\begin_layout Standard
-Correlation in R is 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cor()
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cor.test()
-\end_layout
-
-\end_inset
-
- + 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cov.wt(cor = TRUE)$cor
-\end_layout
-
-\end_inset
-
- for weighted correlation matrix and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cov2cor()
-\end_layout
-
-\end_inset
-
- to convert efficiently a covariance matrix into a correlation matrix.
- 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-cor.test()
-\end_layout
-
-\end_inset
-
- is a generic function that provides both a default and a formula interface
- in the 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-stats
-\end_layout
-
-\end_inset
-
- package.
-\end_layout
-
-\end_body
-\end_document

Deleted: pkg/SciViews/inst/doc/introduction.lyx
===================================================================
--- pkg/SciViews/inst/doc/introduction.lyx	2012-03-24 07:35:42 UTC (rev 457)
+++ pkg/SciViews/inst/doc/introduction.lyx	2012-03-29 08:26:48 UTC (rev 458)
@@ -1,289 +0,0 @@
-#LyX 2.0 created this file. For more info see http://www.lyx.org/
-\lyxformat 413
-\begin_document
-\begin_header
-\textclass article
-\begin_preamble
-% \VignetteIndexEntry{Introduction to SciViews}
-%\VignettePackage{SciViews}
-
-% provides caption formatting
-\usepackage[labelfont=bf, tableposition=top]{caption}
-\pdfimageresolution 96
-\end_preamble
-\use_default_options false
-\begin_modules
-svSweave
-\end_modules
-\maintain_unincluded_children false
-\language english
-\language_package default
-\inputencoding utf8x
-\fontencoding global
-\font_roman palatino
-\font_sans berasans
-\font_typewriter beramono
-\font_default_family default
-\use_non_tex_fonts false
-\font_sc true
-\font_osf false
-\font_sf_scale 100
-\font_tt_scale 100
-
-\graphics default
-\default_output_format default
-\output_sync 0
-\bibtex_command default
-\index_command default
-\float_placement tbh
-\paperfontsize default
-\spacing single
-\use_hyperref true
-\pdf_title "SciViews - Why SciViews?"
-\pdf_author "Philippe Grosjean"
-\pdf_subject "Rationates for the SciViews scientific suite"
-\pdf_keywords "Data analysis, Statistics, Reporting, Word processing, Slideshow"
-\pdf_bookmarks true
-\pdf_bookmarksnumbered false
-\pdf_bookmarksopen false
-\pdf_bookmarksopenlevel 1
-\pdf_breaklinks true
-\pdf_pdfborder false
-\pdf_colorlinks true
-\pdf_backref false
-\pdf_pdfusetitle true
-\pdf_quoted_options "linkcolor=blue, urlcolor=blue, citecolor=blue, pagecolor=blue"
-\papersize a4paper
-\use_geometry false
-\use_amsmath 0
-\use_esint 0
-\use_mhchem 1
-\use_mathdots 1
-\cite_engine natbib_authoryear
-\use_bibtopic false
-\use_indices false
-\paperorientation portrait
-\suppress_date false
-\use_refstyle 0
-\index Index
-\shortcut idx
-\color #008000
-\end_index
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\paragraph_indentation default
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\bullet 0 0 17 -1
-\bullet 1 0 15 -1
-\bullet 2 0 8 -1
-\bullet 3 0 9 -1
-\tracking_changes false
-\output_changes false
-\html_math_output 0
-\html_css_as_file 0
-\html_be_strict false
-\end_header
-
-\begin_body
-
-\begin_layout Title
-Why SciViews?
-\end_layout
-
-\begin_layout Author
-Ph.
- Grosjean <phgrosjean at sciviews.org>
-\end_layout
-
-\begin_layout Part
-Introduction
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Plain Layout
-
-
-\backslash
-setkeys{Gin}{width=1.00
-\backslash
-textwidth}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout R-Opts
-keep.source = TRUE, pdf = TRUE, eps = FALSE
-\end_layout
-
-\begin_layout Standard
-There are several office suites, including (at least) a word processor,
- a spreadsheet, a slideshow presentation program, and tools to draw pictures
- and write mathematic equations.
- Microsoft Office and OpenOffice seem to fulfill the needs of most users.
- Son why should a 
-\emph on
-scientific
-\emph default
- user need a different suite for his work? Well, we believe that those general
- purpose office suites are not well adapted for scientists.
- They need something radically different.
- The 
-\begin_inset Flex SciViews
-status collapsed
-
-\begin_layout Plain Layout
-
-\end_layout
-
-\end_inset
-
- Scientific Suite aims to provide those tools to them.
- In short:
-\end_layout
-
-\begin_layout Itemize
-The spreadsheet paradigm is very popular to do calculations and graphs on
- tabulated data.
- However, there are many reasons why this paradigm is not efficient, error-prone
- and barely fits the needs for more serious data analysis, as most scientists
- need.
- We believe that 
-\begin_inset Flex R
-status collapsed
-
-\begin_layout Plain Layout
-
-\end_layout
-
-\end_inset
-
-, together with a carefully ciseled GUI is a much more adequate general
- purpose calculation and plotting engine.
- That is why the 
-\begin_inset Flex SciViews
-status collapsed
-
-\begin_layout Plain Layout
-
-\end_layout
-
-\end_inset
-
- Scientific Suite is build around 
-\begin_inset Flex R
-status collapsed
-
-\begin_layout Plain Layout
-
-\end_layout
-
-\end_inset
-
-, and reserves so little space to a spreadsheet program.
-\end_layout
-
-\begin_layout Itemize
-The Word Processor and its WYSIWYG
-\begin_inset Foot
-status open
-
-\begin_layout Plain Layout
-WYSIWYG = What You See Is What You Get.
-\end_layout
-
-\end_inset
-
- paradigm makes a poor document preparation environment for scientific literatur
-e like papers and books.
- Scientific literature is highly structured text and it does not fit well
- with the loose presentation of text elements in a WYSIWYG program.
- Also, Word Processors tend to be relatively poor and inefficient in mathematic
- formula typesetting and in bibliographic references formatting.
- LaTeX text processing system is much, much more adequate, but it requires
- to 
-\begin_inset Quotes eld
-\end_inset
-
-program
-\begin_inset Quotes erd
-\end_inset
-
- your text, and not all scientists are ready to take that way.
- A good alternative is the WYSIWIM paradigm of LyX.
- WYSIWIM stands for 
-\begin_inset Quotes eld
-\end_inset
-
-What You See Is What You Mean
-\begin_inset Quotes erd
-\end_inset
-
-.
- Here, you don't see the code hidden in you rich text formatted document,
- but you don't see the final result either.
- You see, instead, a very suggestive representation of the 
-\emph on
-structure
-\emph default
- of your text (titles, paragraphs, equations, etc.).
- You can then concentrate on both the content and the structure, and delegate
- to the very capable LaTeX system that LyX uses to typeset its documents
- on the background to produce the final result.
- That WYSIWIM approach, together with the possibility to include results,
- tables and graphs from 
-\begin_inset Flex R
-status collapsed
-
-\begin_layout Plain Layout
-
-\end_layout
-
-\end_inset
-
- computations directly in the LyX document using the 
-\series bold
-Sweave
-\series default
- mechanism makes is a very suitable alternative to more traditional Word
- Processing programs for scientists.
-\end_layout
-
-\begin_layout Itemize
-The WYSIWYG slideshow programs, like PowerPoint, are not well suitable for
- scientists for the same reasons (mainly, a lack of correct formula typesetting
- and the inability to include code to produce calculation results, tables
- or graphs directly in the presentation).
- Here, we go back to LyX and Sweave again, but together with the excellent
- 
-\series bold
-Beamer
-\series default
- LaTeX package.
-\end_layout
-
-\begin_layout Standard
-...
-\end_layout
-
-\begin_layout Section
-Processing data, analyzing data
-\end_layout
-
-\begin_layout Standard
-Scientist study facts, and they mostly convert these facts into numbers
- by mean of measurements in a given context (observation or experiment).
- They, then, manipulate these numbers in different ways...
-\end_layout
-
-\end_body
-\end_document

Deleted: pkg/SciViews/inst/doc/pca.lyx
===================================================================
--- pkg/SciViews/inst/doc/pca.lyx	2012-03-24 07:35:42 UTC (rev 457)
+++ pkg/SciViews/inst/doc/pca.lyx	2012-03-29 08:26:48 UTC (rev 458)
@@ -1,1393 +0,0 @@
-#LyX 2.0 created this file. For more info see http://www.lyx.org/
-\lyxformat 413
-\begin_document
-\begin_header
-\textclass article
-\begin_preamble
-% \VignetteIndexEntry{PCA - Principal Component Analysis tutorial}
-%\VignettePackage{SciViews}
-
-% provides caption formatting
-\usepackage[labelfont=bf, tableposition=top]{caption}
-\pdfimageresolution 96
-\end_preamble
-\use_default_options false
-\begin_modules
-svSweave
-\end_modules
-\maintain_unincluded_children false
-\language english
-\language_package default
-\inputencoding utf8x
-\fontencoding global
-\font_roman palatino
-\font_sans berasans
-\font_typewriter beramono
-\font_default_family default
-\use_non_tex_fonts false
-\font_sc true
-\font_osf false
-\font_sf_scale 100
-\font_tt_scale 100
-
-\graphics default
-\default_output_format default
-\output_sync 0
-\bibtex_command default
-\index_command default
-\float_placement tbh
-\paperfontsize default
-\spacing single
-\use_hyperref true
-\pdf_title "SciViews - Principal Component Analysis"
-\pdf_author "Philippe Grosjean"
-\pdf_subject "Tutorial for PCA"
-\pdf_keywords "PCA"
-\pdf_bookmarks true
-\pdf_bookmarksnumbered false
-\pdf_bookmarksopen false
-\pdf_bookmarksopenlevel 1
-\pdf_breaklinks true
-\pdf_pdfborder false
-\pdf_colorlinks true
-\pdf_backref false
-\pdf_pdfusetitle true
-\pdf_quoted_options "linkcolor=blue, urlcolor=blue, citecolor=blue, pagecolor=blue"
-\papersize a4paper
-\use_geometry false
-\use_amsmath 0
-\use_esint 0
-\use_mhchem 1
-\use_mathdots 1
-\cite_engine natbib_authoryear
-\use_bibtopic false
-\use_indices false
-\paperorientation portrait
-\suppress_date false
-\use_refstyle 0
-\index Index
-\shortcut idx
-\color #008000
-\end_index
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\paragraph_indentation default
-\quotes_language english
-\papercolumns 1
-\papersides 2
-\paperpagestyle default
-\bullet 0 0 17 -1
-\bullet 1 0 15 -1
-\bullet 2 0 8 -1
-\bullet 3 0 9 -1
-\tracking_changes false
-\output_changes false
-\html_math_output 0
-\html_css_as_file 0
-\html_be_strict false
-\end_header
-
-\begin_body
-
-\begin_layout Title
-Principal Component Analysis (PCA)
-\end_layout
-
-\begin_layout Author
-Ph.
- Grosjean <phgrosjean at sciviews.org>
-\end_layout
-
-\begin_layout Part
-Introduction
-\end_layout
-
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Plain Layout
-
-
-\backslash
-setkeys{Gin}{width=1.00
-\backslash
-textwidth}
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout R-Opts
-keep.source = TRUE, pdf = TRUE, eps = FALSE
-\end_layout
-
-\begin_layout Standard
-Principal Component Analysis, or PCA is a widely used method to explore
- linear associations among variables of large datasets.
- There is, unfortunately, no consistent implementation of this technique
- in R, which is even more a problem because the numerous additional R packages
- that provide enhanced versions of PCA, or additional tools, have no consistent
- template to start with.
- In the 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-stats
-\end_layout
-
-\end_inset
-
- package, there are two inconsistent implementations called 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-princomp()
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-prcomp()
-\end_layout
-
-\end_inset
-
- that both create S3 objects of the same name.
- There are a few methods available, like 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-print()
-\end_layout
-
-\end_inset
-
-, 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-summary()
-\end_layout
-
-\end_inset
-
-, 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-plot()
-\end_layout
-
-\end_inset
-
-, 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-predict()
-\end_layout
-
-\end_inset
-
- or 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-biplot()
-\end_layout
-
-\end_inset
-
-.
- The whole set is rather deceptive and produces less interesting plots than
- other (more specialized) software can do.
- For instance, there is nothing to plot the so-called 
-\begin_inset Quotes eld
-\end_inset
-
-graph of the variables
-\begin_inset Quotes erd
-\end_inset
-
- in the French terminology and you have to program it yourself.
-\end_layout
-
-\begin_layout Standard
-Of course, there are several specialized R packages available that provide
- more powerful and/or more extended implementations, among others: 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
-, 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-FactoMineR
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-vegan
-\end_layout
-
-\end_inset
-
-.
- Each of these packages has a totally different approach: 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
- creates a 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-c(
-\begin_inset Quotes eld
-\end_inset
-
-pca
-\begin_inset Quotes erd
-\end_inset
-
-, 
-\begin_inset Quotes eld
-\end_inset
-
-dudi
-\begin_inset Quotes erd
-\end_inset
-
-)
-\end_layout
-
-\end_inset
-
- S3 object and proposes nice graphs but has an interface that is completely
- inconsistent with usual R analyses (no optional formula interface, exotic
- names of arguments, non-standard handling of missing data, etc.).
- Object orientation and name of objects are obscure and do not facilitate
- first use of the PCA in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
-.
- A PCA is done, indeed, using the 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-dudi.pca()
-\end_layout
-
-\end_inset
-
- function (or possibly, 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-nipals()
-\end_layout
-
-\end_inset
-
-, but that creates a different 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-nipals
-\end_layout
-
-\end_inset
-
- object).
- The same remarks can be made about the interface of functions in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-FactoMineR
-\end_layout
-
-\end_inset
-
-: they use strange arguments and do not respect the general organization
- of analyses in R (an object constructs the analysis, possibly defined using
- a formula; methods summarize or plot the results piece by piece).
- At least, name of function and object related to PCA are clear in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-FactorMineR
-\end_layout
-
-\end_inset
-
-: 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-PCA()
-\end_layout
-
-\end_inset
-
-! There is also a non conventional handling of missing observations.
- But the function is powerful and loows for a lot of investigations around
- the PCA.
- In 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-vegan
-\end_layout
-
-\end_inset
-
-, there is no PCA function, but a redundancy analysis 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-rda()
-\end_layout
-
-\end_inset
-
-, which reduces to a classical PCA when arguments 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-X =
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-Y =
-\end_layout
-
-\end_inset
-
- are missing.
- It creates a 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-c(
-\begin_inset Quotes eld
-\end_inset
-
-cca
-\begin_inset Quotes erd
-\end_inset
-
-, 
-\begin_inset Quotes eld
-\end_inset
-
-rda
-\begin_inset Quotes erd
-\end_inset
-
-)
-\end_layout
-
-\end_inset
-
- S3 object which is not optimized at all for holding pure PCA data (many
- unnecessary items in it for a PCA).
- Finally, 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-labdsv
-\end_layout
-
-\end_inset
-
- uses the default 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-prcomp()
-\end_layout
-
-\end_inset
-
-, but it wraps it into a 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- S3 object, in order to define additional plotting methods that are consistent
- with the other analyses and objects in that package.
- Note that both 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- S3 objects in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-labdsv
-\end_layout
-
-\end_inset
-
- are completely inconsistent, and you are likely to get very bad results
- in case you load both packages and mix their respective methods!
-\end_layout
-
-\begin_layout Standard
-So, given that chaotic set of PCA functions in R, would it be possible to
- design an object with minimal code that reuses code in the 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-stats
-\end_layout
-
-\end_inset
-
- package (
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-princomp()
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-prcomp()
-\end_layout
-
-\end_inset
-
-), provides a couple of additional methods to make decent variables and
- individuals plots (possibly with ellipses or conver hulls for subgroups)
- in a way that a whole analysis would be easy to perform and to read in
- R code? We will try to do so in the present 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-SciViews
-\end_layout
-
-\end_inset
-
- package.
-\end_layout
-
-\begin_layout Standard
-First of all, we want to keep things simple.
- That is, we will design an S3 object, and not start from a complex S4 UML,
- as it is done for instance in the 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-rrcov
-\end_layout
-
-\end_inset
-
- package.
- It would be nice to name this object 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- and we should be able to make it compatible with both 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-princomp
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-labdsv
-\end_layout
-
-\end_inset
-
-'s 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- (but not with 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-prcomp()
-\end_layout
-
-\end_inset
-
- that names 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-loadings
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-scores
-\end_layout
-
-\end_inset
-
- components 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-rotation
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-x
-\end_layout
-
-\end_inset
-
-, respectively.
- Also, that 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- S3 object could 
-\series bold
-not
-\series default
- be compatible with 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
-'s 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- object.
- Moreover, neither 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
-, nor 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-labdsv
-\end_layout
-
-\end_inset
-
- use a namespace (as for versions available at 2010-02-06).
- Hopefully, 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
- does not define methods specific for its 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- object, except 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-score.pca()
-\end_layout
-
-\end_inset
-
- for the 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-score()
-\end_layout
-
-\end_inset
-
- generic function defined in the same package (and not elsewhere).
- Thus, we could define 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-scores()
-\end_layout
-
-\end_inset
-
-, with 's', as for the corresponding item in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-princomp
-\end_layout
-
-\end_inset
-
- object without clash.
- Note that, if we don't use a 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-nf
-\end_layout
-
-\end_inset
-
- item in our 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- object, the 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
-'s 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-score()
-\end_layout
-
-\end_inset
-
- function inadvertently applied to our object fails with the error message:
- 
-\begin_inset Quotes eld
-\end_inset
-
-
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-Error in x$nf : $ operator is invalid for atomic vectors
-\end_layout
-
-\end_inset
-
-
-\begin_inset Quotes erd
-\end_inset
-
-.
-\end_layout
-
-\begin_layout Section
-The SciViews' pcomp object
-\end_layout
-
-\begin_layout Standard
-We finally choose 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pcomp
-\end_layout
-
-\end_inset
-
- as name of our object, but it inherits from 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-princomp
-\end_layout
-
-\end_inset
-
-, because 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pca
-\end_layout
-
-\end_inset
-
- is already used in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-ade4
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-labdsv
-\end_layout
-
-\end_inset
-
- (with conflicting definitions), 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-PCA
-\end_layout
-
-\end_inset
-
- is used in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-FactoMineR
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-Pca
-\end_layout
-
-\end_inset
-
- defines S4 objects in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-rrcov
-\end_layout
-
-\end_inset
-
- (and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-pCa
-\end_layout
-
-\end_inset
-
- is something totally different in 
-\begin_inset Flex CharStyle:Pkg
-status collapsed
-
-\begin_layout Plain Layout
-seacarb
-\end_layout
-
-\end_inset
-
- package).
- Moreover, 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-pcomp()
-\end_layout
-
-\end_inset
-
- is closer to 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-prcomp()
-\end_layout
-
-\end_inset
-
- and 
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-princomp()
-\end_layout
-
-\end_inset
-
- as it is supposed to be a wrapper over these two (default) PCA functions
- in R.
-\end_layout
-
-\begin_layout Standard
-The 
-\begin_inset Flex CharStyle:Class
-status collapsed
-
-\begin_layout Plain Layout
-pcomp
-\end_layout
-
-\end_inset
-
- S3 object is a list with components:
-\end_layout
-
-\begin_layout Itemize
-\begin_inset Flex CharStyle:Code
-status collapsed
-
-\begin_layout Plain Layout
-loadings
-\end_layout
-
-\end_inset
-
-: (also required for 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/sciviews -r 458


More information about the Sciviews-commits mailing list