我一直在 SPSS 工作,需要知道如何在 R 中运行判别分析。我想象我的语法在 SPSS 中看起来像这样
> GET DATA /TYPE=XLSX
>/FILE='C:\Users\Downloads\Initial Diabetics Data 10000.xlsx'
>/SHEET=name 'Initial Diabetics Data 10000.xl'
>/CELLRANGE=full /READNAMES=on
>/ASSUMEDSTRWIDTH=32767.
>EXECUTE.
>DATASET NAME DataSet1 WINDOW=FRONT.
>
>
>
> DELETE VARIABLES weight.
>
>
> DISCRIMINANT
>/GROUPS=readmitted(0 1)
>/VARIABLES=age
> admission_type_id discharge_disposition_id admission_source_id
> lengthofstay num_lab_procedures num_procedures num_medications number_outpatient
> number_emergency number_inpatient number_diagnoses
>/ANALYSIS ALL
>/SAVE=CLASS
>/METHOD=WILKS
>/FIN=3.84
>/FOUT=2.71
>/PRIORS EQUAL
>/HISTORY
>/STATISTICS=CORR TABLE
/PLOT=CASES
/CLASSIFY=NONMISSING POOLED.
在 R 中应该如下所示?在 R 中使用 wilks lambda 进行基本判别分析并保存预测组的语法是什么?
> library(readxl)
> Initial_Diabetics_Data_10000 <- read_excel("C:/Users/Downloads/Initial Diabetics Data 10000.xlsx")
> View(Initial_Diabetics_Data_10000)
>df <-df Initial_Diabetics_Data_10000 select(-weight)
>DISCRIMINANT
?