[R] candisc plotting
friendly at yorku.ca
Fri Dec 12 00:36:57 CET 2008
You haven't told us what your data is, and we can only surmise -- not
very helpful for you and annoying for those who try to help.
Pete Shepard wrote:
> I have a file with two dependent variables (three and five) and one
> independent variable. I do i.mod <- lm(cbind(three, five) ~ species,
> data=i.txt) and get the following output:
> three five
> (Intercept) 9.949 9.586
> species -1.166 -1.156
From this, it seems that species is numeric variable, not a factor.
If so, canonical discriminant analysis in not appropriate, so
all following bets are off.
That's likely why you end up with only one canonical dimension.
> I do a" i.can<-candisc(i.mod,data=i):
Is data=i the same as data=i.txt?
> and get the following output:
> Canonical Discriminant Analysis for species:
> CanRsq Eigenvalue Difference Percent Cumulative
> 1 0.096506 0.10681 100 100
> Test of H0: The canonical correlations in the
> current row and all that follow are zero
> LR test stat approx F num Df den Df Pr(> F)
> 1 0.903 63.875 1 598 6.859e-15 ***
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> this is different than the output I get with SAS:
What was your SAS code? Was the data the same?
> Eigenvalue Difference Proportion Cumulative Ratio F Value
> Num DF Den DF Pr > F
> 1 0.1068 1.0000 1.0000 0.90349416
> 31.88 2 597 <.0001
> I am also wondering how to plot the can1*can1 like it is done in SAS.
> proc plot;
> plot can1*can1=species;
> format species spechar.;
> title2 'Plot of Constits_vs_cassettes';
If you want to compare plots for canonical analysis in SAS and R,
see my macros, canplot and hecan at
But in general, if all you have is 1 canonical dimension, a dotplot or
boxplot of the canonical scores would be more useful than a scatterplot
plot of can1 * can1.
The plot method for candisc objects in the candisc package has some
code to handle the 1 can-D case.
hope this helps
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
More information about the R-help