0

I have been working in SPSS and need to know how to run a discriminant analysis in R. I imagine my syntax which look like this in 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.

Should look something like below in R? What is the syntax for a basic discriminant analysis in R using wilks lambda and saving the predicted groups?

> 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
  ?
user438383
  • 5,716
  • 8
  • 28
  • 43
rawdata
  • 35
  • 8
  • See here for an example on how to run LDA in R: https://finnstats.com/index.php/2021/05/02/linear-discriminant-analysis/ – Phil Sep 16 '21 at 16:57
  • Refer https://stackoverflow.com/questions/7362062/discriminant-analysis-with-r?rq=1 https://stackoverflow.com/questions/17001375/plot-linear-discriminant-analysis-in-r – Nad Pat Sep 16 '21 at 16:59

0 Answers0