[R] Problems in Recommending R

Mark Difford mark_difford at yahoo.co.uk
Tue Feb 3 15:47:17 CET 2009


Hi All,

Before these things be set in stone, it should be noted that it would be a
real mistake to have a miscalculated statistical object on R's Homepage.
Imagine if SAS found out!

Fact is, the manner in which the percentage contribution of each PC to the
overall inertia is calculated in the code used to make the display graphic
is wrong. I have been meaning to point this out to Eric Lecoutre for some
time now, but just never got around to it. There simply wasn't an urgent
need to do so, given other things that had to be done first.

So, apologies to Eric for pointing it out here; what he presented was a very
nice piece of work and it justly deserved top honours.

## % contribution calculated as [line 31 in plotacpclust()]
pclperc=100*(pcr$sdev)/sum(pcr$sdev)        ## this is wrong

## should be calculated as
pclperc=100*(pcr$sdev^2)/sum(pcr$sdev^2)

## Proof
summary(pcr <- princomp(USArrests, cor = TRUE))
>> Importance of components:
>>                              Comp.1    Comp.2    Comp.3     Comp.4
>>Standard deviation     1.5748783 0.9948694 0.5971291 0.41644938
>>Proportion of Variance 0.6200604 0.2474413 0.0891408 0.04335752
>>Cumulative Proportion  0.6200604 0.8675017 0.9566425 1.00000000

100*(pcr$sdev)/sum(pcr$sdev)
>>  Comp.1   Comp.2   Comp.3   Comp.4 
>> 43.95018 27.76385 16.66410 11.62187

100*(pcr$sdev^2)/sum(pcr$sdev^2)
>>   Comp.1    Comp.2    Comp.3    Comp.4 
>> 62.006039 24.744129  8.914080  4.335752

100*(pcr$sdev^2)[1]/sum(pcr$sdev^2) + 100*(pcr$sdev^2)[2]/sum(pcr$sdev^2)
86.75017

## or using ade4
library(ade4)
pcr <- dudi.pca(USArrests, scannf=F, nf=4)
inertia.dudi(pcr)

Regards, Mark.


Warren Young wrote:
> 
> Stavros Macrakis wrote:
>> anti-alias the demonstration graphic.  The current graphic
>> makes R graphics seem (falsely!) to be very primitive. I'm afraid I
>> don't know how to do the anti-aliasing myself.
> 
> Simply re-plotting it in 2.8.1 built with Cairo support produces 
> something better:
> 
> 	http://etr-usa.com/tmp/swiss-cairo-281.png
> 
> The text is antialiased, as are some of the graph lines.  The dots in 
> the largest plot aren't, though.
> 
> Outputting to PDF and then scaling down does even better:
> 
> 	http://etr-usa.com/tmp/swiss-from-pdf.png
> 
> The command at the end to do this is:
> 
> 	pdf(file="swiss.pdf", width=12, height=8)
> 
> The R webmasters are welcome to use either of these in place of the 
> current graphic, but it might be good to change the script to fix up 
> some of the changes in the way the script is interpreted first.
> 
> Fair warning: I won't be hosting these pictures for very long.  Download 
> 'em if you want 'em now.
> 
>> Replacing the fixed-width, typewriter-style font with something a bit
>> more elegant might also be good....
> 
> The choice of fonts on the web is pretty limited, unless you want to get 
> clever.  I prefer to work with the few standard web fonts, building up 
> improved styles relative to the defaults with CSS.  It might be 
> interesting to keep the current font, but experiment with letter 
> spacing, for instance.
> 
> Far more serious problems:
> 
> - Use of frames.  The usability problems of frames are well known, and 
> are justified only in a few special cases.  A content-heavy site like 
> r-project.org is not one of them, if only because of the bookmarking
> issue.
> 
> - Use of Times as the standard font.  Times was commissioned by a 
> newspaper, with a primary goal of reducing paper costs.  Its creators 
> succeeded by creating something compact and spindly, and thus uncommonly 
> ugly and hard to read considering its popularity.  It is marginally 
> justifiable on paper, its design target.  It should never be used on 
> computer screens; at least, not until they get to 300 dpi or so.  In 
> general, use sans serif fonts on computer screens.  There are rare 
> exceptions, like Georgia (designed for PC screens from the start) and 
> Courier (heavy slab serifs that come out okay on low-res screens).  Look 
> at the default fonts used on every OS, and every device with an LCD 
> screen you own: they're all sans serif, aren't they?  There's a reason 
> for that...
> 
> - HTML tables using the default "3D" chiseled look.  Nothing says "1995" 
> better, except maybe blink tags, rainbow colored separator bars, and 
> "under construction" graphics.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-in-Recommending-R-tp21783299p21811357.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list