繁体   English   中英

线性判别分析中如何获得常数项

[英]How to Obtain Constant Term in Linear Discriminant Analysis

考虑dput

structure(list(REAÇÃO = structure(c(0, 1, 0, 0, 1, 0, 1, 1, 
0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 
1, 0, 1, 1, 0, 1, 1), format.spss = "F11.0"), IDADE = structure(c(22, 
38, 36, 58, 37, 31, 32, 54, 60, 34, 45, 27, 30, 20, 30, 30, 22, 
26, 19, 18, 22, 23, 24, 50, 20, 47, 34, 31, 43, 35, 23, 34, 51, 
63, 22, 29), format.spss = "F11.0"), ESCOLARIDADE = structure(c(6, 
12, 12, 8, 12, 12, 10, 12, 8, 12, 12, 12, 8, 4, 8, 8, 12, 8, 
9, 4, 12, 6, 12, 12, 12, 12, 12, 12, 12, 8, 8, 12, 16, 12, 12, 
12), format.spss = "F11.0"), SEXO = structure(c(1, 1, 0, 0, 1, 
0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 
0, 1, 0, 1, 0, 0, 0, 1, 1, 1), format.spss = "F11.0")), .Names = c("REAÇÃO", 
"IDADE", "ESCOLARIDADE", "SEXO"), row.names = c(NA, -36L), class = "data.frame")

其中: REAÇÃO是模型中的因变量。

常数: -4.438

如何使用R中的简单函数获取此值?

要在R的判别分析中获得常数项(使用库MASS):

groupmean<-(model$prior%*%model$means)
constant<-(groupmean%*%model$scaling)
constant

其中modellda判别式:

model<-lda(y~x1+x2+xn,data=mydata)
model

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM