[R] Linear Discriminant Analysis and Wilks Lambda
Julius Tesoro
jutesoro at yahoo.com
Wed Nov 18 23:57:45 CET 2009
Dear all,
I am trying to recreate a discriminant analysis in R based on the article from "Dong,J.-J.,etal.,Discriminant analysis of the geomorphic characteristics and stability of landslide dams, Geomorphology (2009)".
I used lda (MASS) to determine the discriminant functions but I noticed that it is not the same as in the paper.
I have three questions (1) Why does results from lda() does not show a constant? Isnt the discriminant function supposed to be D = a + b1*x1 + b2*x2 + ... + bm*xm? If there is one, where can I find it? (2) Why are the linear discriminant coefficients different from the paper? The discriminant function in the paper is:
D = − 2.62*log10(Peak.flow) − 4.67*log10(Dam.height) + 4.57*log10(Dam.width) +2.67*log10(Dam.Length) +8.26 (He used SPSS for the analysis)
(3) I used manova to perform the Wilks test. However, I am missing the significant values for the Wilks test. How come?
I know these are newbie questions but I hope someone out there may have the answer. Thanks all
Here is the code I used for the Linear Discriminant Analysis:
>criteria<-c("Catchment.area", "Stream.order", "Mean.flow", "Peak.flow","UCG", "DCG","Landslide.volume","Landslide.area","HTD",
"Slope.height","Dam.height", "Dam.width", "Dam.length", "Lake.depth", "Lake.area", "Dam.volume","SClass")
>tabcrit<-subset(tabata, rowSums(is.na(tabata[criteria]))==0)
>tabcrit<-tabcrit[criteria]
>stabledams<-subset(tabcrit, SClass=="Stable")
>unstabledams<-subset(tabcrit, SClass=="Unstable")
>st<-sample(nrow(stabledams))
>ust<-sample(nrow(unstabledams))
>training <- rbind(stabledams[st[1:5], ], unstabledams[ust[1:17],])
>tr.lda<-lda(SClass~log10(Catchment.area)+log10(Dam.height)+log10(Dam.width)+log10(Dam.length),
data=training)
>tr.lda
Coefficients of linear discriminants:
LD1
log10(Catchment.area) 1.0967609
log10(Dam.height) 0.9818473
log10(Dam.width) -1.9813511
log10(Dam.length) -0.7131808
For the Wilks test:
>tr.matrix<-as.matrix(training[-17])
>tr.manova<-manova(tr.matrix~training$SClass)
>tr.wilks<-summary(tr.manova, test="Wilks")
> tr.wilks
Df Wilks approx F num Df den Df Pr(>F)
training$SClass 1 0.29328 0.75303 16 5 0.6979
Residuals 20
Cheers,
Julius Tesoro
More information about the R-help
mailing list