Membuat Model Diskriminan

ompel<-read.delim(‘clipboard’)

View(ompel)

summary(ompel)

attach(ompel)

library(MVN)

datacek<-ompel

hasildata<-mvn(datacek[,1:4], multivariateOutlierMethod = “adj”, showNewData = TRUE)

databaru<-hasildata$newData

uji_bart <- function(x)

{

method <- “Bartlett’s test of sphericity”

data.name <- deparse(substitute(x))

x <- subset(x, complete.cases(x))

n <- nrow(x)

p <- ncol(x)

chisq <- (1-n+(2*p+5)/6)*log(det(cor(x)))

df <- p*(p-1)/2

p.value <- pchisq(chisq, df, lower.tail=FALSE)

names(chisq) <- “Khi-squared”

names(df) <- “df”

return(structure(list(statistic=chisq, parameter=df, p.value=p.value,

method=method, data.name=data.name), class=”htest”))

}

bartlett.test(dataakhir)

uji_bart(dataakhir)

library(candisc)

x<-as.matrix(dataakhir[1:4])

x.manova<-manova(x~Pekerjaan)

x.wilks<-summary(x.manova, test=”Wilks”)

cc<-candisc(x.manova)

library(MASS)

library(caret)

modellda<-lda(Pekerjaan~., data = dataakhir)

modellda

pred_LDA1<- predict(modellda, dataakhir)

confmatLDA1<-confusionMatrix(pred_LDA1$class,as.factor(Pekerjaan),positive = “0”)

model deskriminan

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store