Hello R list,
I'm looking to do some stepwise discriminant function analysis (DFA) based
on the minimization of Wilks' lambda in R to end up with a composite
signature (of metals
"Al","Sb","Bi","Cr","Ba")
capable of discriminating
100% of the source factors (LANDUSE: "A","B","C").
The Wilks' lambda portion seems straightforward. I am using the following:
gw_obj <- greedy.wilks(LANDUSE ~ ., data = QRBdfa, niveau = 0.1)
gw_obj
Thus determining the stepwise order of metals.But I can't seem to figure out
how to coerce the DFA to give me an output with the % of factors which each
successive metal (variable) correctly classifies (discriminates). e.g.
Step Metal %correctly classified
1 Al 25
2 Sb 75
3 Bi 89
4 Cr 100
I've worked up a trivial example below. Can anyone offer any suggestions on
how I might go about doing this in R?
I am working in a MAC OS environment with a current version of R.
Many thanks in advance!
Tyler
#Example
library(scatterplot3d)
library(klaR)
Al <-runif(27, 0, 125)
QRBdfa <- as.data.frame(Al)
QRBdfa$LANDUSE <-
factor(c("A","A","A","B","B","B","C","C","C"))
QRBdfa$Sb <- runif(27, 0, 1)
QRBdfa$Ba <- runif(27, 0, 235)
QRBdfa$Bi <- runif(27, 0, 0.11)
QRBdfa$Cr <- runif(27, 0, 65)
gw_obj <- greedy.wilks(LANDUSE ~ ., data = QRBdfa, niveau = 0.1)
gw_obj
fit <- lda(LANDUSE ~ Al + Sb + Bi + Cr + Ba, data = QRBdfa)
[[alternative HTML version deleted]]
Hello R list,
I'm looking to do some stepwise discriminant function analysis (DFA) based
on the minimization of Wilks' lambda in R to end up with a composite
signature (of metals
"Al","Sb","Bi","Cr","Ba")
capable of discriminating
100% of the source factors (LANDUSE: "A","B","C").
The Wilks' lambda portion seems straightforward. I am using the following:
gw_obj <- greedy.wilks(LANDUSE ~ ., data = QRBdfa, niveau = 0.1)
gw_obj
Thus determining the stepwise order of metals.But I can't seem to figure out
how to coerce the DFA to give me an output with the % of factors which each
successive metal (variable) correctly classifies (discriminates). e.g.
Step Metal %correctly classified
1 Al 25
2 Sb 75
3 Bi 89
4 Cr 100
I've worked up a trivial example below. Can anyone offer any suggestions on
how I might go about doing this in R?
I am working in a MAC OS environment with a current version of R.
Many thanks in advance!
Tyler
#Example
library(scatterplot3d)
library(klaR)
Al <-runif(27, 0, 125)
QRBdfa <- as.data.frame(Al)
QRBdfa$LANDUSE <-
factor(c("A","A","A","B","B","B","C","C","C"))
QRBdfa$Sb <- runif(27, 0, 1)
QRBdfa$Ba <- runif(27, 0, 235)
QRBdfa$Bi <- runif(27, 0, 0.11)
QRBdfa$Cr <- runif(27, 0, 65)
gw_obj <- greedy.wilks(LANDUSE ~ ., data = QRBdfa, niveau = 0.1)
gw_obj
fit <- lda(LANDUSE ~ Al + Sb + Bi + Cr + Ba, data = QRBdfa)
[[alternative HTML version deleted]]