【问题标题】:How to Obtain Constant Term in Linear Discriminant Analysis如何在线性判别分析中获得常数项
【发布时间】:2019-01-06 21:43:26
【问题描述】:

考虑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 linear-discriminant


    【解决方案1】:

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

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

    其中modellda 判别式:

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

    【讨论】:

      猜你喜欢
      • 2013-06-19
      • 1970-01-01
      • 2013-12-10
      • 2018-07-08
      • 2022-06-22
      • 1970-01-01
      • 2020-02-03
      • 2016-07-06
      • 1970-01-01
      相关资源
      最近更新 更多