[R] lda output missing

Sarah Goslee sarah.goslee at gmail.com
Thu Dec 8 18:12:43 CET 2011


That's odd. You don't provide a reproducible example, but using
a built-in dataset (from the help for lda) I get the Proportion of Trace
given by the print.lda method.

library(MASS)
Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), Sp =
rep(c("s","c","v"), rep(50,3)))
train <- sample(1:150, 75)
z <- lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)
print(z)
Call:
lda(Sp ~ ., data = Iris, prior = c(1, 1, 1)/3, subset = train)

Prior probabilities of groups:
        c         s         v
0.3333333 0.3333333 0.3333333

Group means:
  Sepal.L. Sepal.W. Petal.L.  Petal.W.
c 5.947826 2.786957 4.326087 1.3652174
s 5.050000 3.380769 1.465385 0.2346154
v 6.811538 3.023077 5.700000 2.0653846

Coefficients of linear discriminants:
                LD1       LD2
Sepal.L. -1.6665885  1.104460
Sepal.W. -0.8681909  1.872188
Petal.L.  2.4670375 -1.499070
Petal.W.  4.2156275  2.948759

Proportion of trace:
   LD1    LD2
0.9916 0.0084

Here's my sessionInfo(). Are you certain everything is up-to-date?
What OS are you running? Do you have other packages loaded that could
be interfering? What happens when you run the example I used?


> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] MASS_7.3-16

loaded via a namespace (and not attached):
[1] tools_2.14.0


On Thu, Dec 8, 2011 at 10:29 AM, David Lutz <lutzda at wfu.edu> wrote:
> Hello everyone,
>
> I am working on a linear discriminant analysis and am having issues finding
> the full output of my lda. Specifically, there is no reporting of the
> Proportion of Trace that is a normal output of the procedure. I'm using a
> csv file and everything is reading in correctly. I've looked and looked and
> can't figure out why my output is not complete. Is it something simple that
> I am overlooking?
>
> I am working in R 2.14.0 with an updated MASS package. Here is my syntax:
>
> lda(CC ~ sumstem + maxdbh + maxh + cdlai + sumlai + sumbas +
>    totalbio + ratio, data = practice)
>
> and the output is:
>
> Prior probabilities of groups:
> normal   warm
>   0.5    0.5
>
> Group means:
>        sumstem   maxdbh     maxh       cdlai   sumlai   sumbas totalbio
> normal 901.3722 16.66994 15.70927 0.010393258 1.672247 5.471812 27.67875
> warm   972.4916 22.27247 19.64740 0.002429775 3.181994 9.892683 47.68511
>            ratio
> normal 0.01162921
> warm   0.85721910
>
> Coefficients of linear discriminants:
>                  LD1
> sumstem   0.001111176
> maxdbh    0.034299258
> maxh     -0.287343783
> cdlai    -2.021350057
> sumlai    1.407215702
> sumbas   -0.419422181
> totalbio  0.110403369
> ratio     0.001657649
>
>
>
-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list