[R] help with plotting results of lda

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Apr 26 16:47:01 CEST 2009


Works for me with

library(MASS)
plot(lda(Species~., data=iris))

hence you may want to profide the data to enable us to reproduce your 
problem...

Uwe Ligges



pgseye wrote:
> Hi,
> 
> I've performed an lda and obtained a classification table for some of my
> data:
> 
>> efa.dfa<-lda(groups~.,efa.scores.8,CV=T)
>> str(efa.dfa)
> List of 5
>  $ class    : Factor w/ 2 levels "1","2": 1 2 1 2 1 1 2 2 1 2 ...
>  $ posterior: num [1:160, 1:2] 0.99083 0.00852 0.93983 0.23186 0.85931 ...
>   ..- attr(*, "dimnames")=List of 2
>   .. ..$ : chr [1:160] "1" "2" "3" "4" ...
>   .. ..$ : chr [1:2] "1" "2"
>  $ terms    :Classes 'terms', 'formula' length 3 groups ~ Comp.1 + Comp.2 +
> Comp.3 + Comp.4 + Comp.5 + Comp.6 +      Comp.7 + Comp.8 + Comp.9 + Comp.10
> + Comp.11 + Comp.12 +  ...
>   .. ..- attr(*, "variables")= language list(groups, Comp.1, Comp.2, Comp.3,
> Comp.4, Comp.5, Comp.6,      Comp.7, Comp.8, Comp.9, Comp.10, Comp.11,
> Comp.12, Comp.13,  ...
>   .. ..- attr(*, "factors")= int [1:35, 1:34] 0 1 0 0 0 0 0 0 0 0 ...
>   .. .. ..- attr(*, "dimnames")=List of 2
>   .. .. .. ..$ : chr [1:35] "groups" "Comp.1" "Comp.2" "Comp.3" ...
>   .. .. .. ..$ : chr [1:34] "Comp.1" "Comp.2" "Comp.3" "Comp.4" ...
>   .. ..- attr(*, "term.labels")= chr [1:34] "Comp.1" "Comp.2" "Comp.3"
> "Comp.4" ...
>   .. ..- attr(*, "order")= int [1:34] 1 1 1 1 1 1 1 1 1 1 ...
>   .. ..- attr(*, "intercept")= int 1
>   .. ..- attr(*, "response")= int 1
>   .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> 
>   .. ..- attr(*, "predvars")= language list(groups, Comp.1, Comp.2, Comp.3,
> Comp.4, Comp.5, Comp.6,      Comp.7, Comp.8, Comp.9, Comp.10, Comp.11,
> Comp.12, Comp.13,  ...
>   .. ..- attr(*, "dataClasses")= Named chr [1:35] "numeric" "numeric"
> "numeric" "numeric" ...
>   .. .. ..- attr(*, "names")= chr [1:35] "groups" "Comp.1" "Comp.2" "Comp.3"
> ...
>  $ call     : language lda(formula = groups ~ ., data = efa.scores.8, CV =
> T)
>  $ xlevels  : list()
>> table(groups, Classified=efa.dfa$class)
>       Classified
> groups  1  2
>      1 59 21
>      2 10 70
> 
> but when I try to plot the results I get:
> 
>> plot(efa.dfa)
> Error in plot.window(...) : need finite 'xlim' values
> In addition: Warning messages:
> 1: In min(x) : no non-missing arguments to min; returning Inf
> 2: In max(x) : no non-missing arguments to max; returning -Inf
> 3: In min(x) : no non-missing arguments to min; returning Inf
> 4: In max(x) : no non-missing arguments to max; returning -Inf
> 
> anyone have any ideas?
> 
> Thanks a lot,
> 
> Paul




More information about the R-help mailing list