Re: [問題] logistic regression model

看板Statistics作者 (焦了六年變脆了)時間16年前 (2009/05/28 22:22), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《forever0322 (水藍色)》之銘言: 想請問SAS logistic regression model 跑出來的beta0和beaa1值和我用minitab和SPSS差正負號 檢查蠻久也是找不出來 PROC IMPORT OUT= book1 /*this is the name of the data set*/ DATAFILE= "I:\123\book1.xls" /*this is where you saved your excel data file*/ DBMS=EXCEL REPLACE; SHEET="sheet1"; /*sheet1 is the excel files sheet name*/ GETNAMES=yes; /*yes means the first row of the data is the variables names*/ RUN; proc LOGISTIC ; MODEL Y = X ; run; 這是SAS的程式碼 我這樣KEY有錯嘛? 麻煩是否可以給我指正 拜託大家了 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.135.139.143

05/28 21:47,
descending 的問題??
05/28 21:47

05/28 21:48,
應該是minitab和SAS fit 的model不一樣,一個是fit
05/28 21:48

05/28 21:48,
P(Y=0|X),一個是fit P(Y=1|X),這樣會剛好差一個負號
05/28 21:48

05/28 21:52,
可是SPSS跑出來的也跟MINITAB一樣
05/28 21:52

05/28 21:55,
因為SPSS和minitab fit一樣的model阿,你外部檔book1.xls
05/28 21:55

05/28 21:56,
的第一筆資料Y是多少?
05/28 21:56

05/28 21:56,
我剛剛改一下將01顛倒在MINITAB跑的確是差正負號
05/28 21:56

05/28 21:57,
第一筆是0
05/28 21:57

05/28 21:59,
把第一筆跟後面換掉讓第一筆是1的話SAS就會跑出SPSS的那
05/28 21:59

05/28 21:59,
組參數了
05/28 21:59

05/28 22:06,
這樣是fit P(Y=1|X)嗎
05/28 22:06

05/28 22:07,
恩 SAS中的預設值是去fit讀進來的第一個
05/28 22:07

05/28 22:08,
要改順序的話可以下order=來改,可以參考help
05/28 22:08

05/28 22:10,
可是我剛剛把後面一筆Y=1調到第一筆跑出來還是一樣
05/28 22:10

05/28 22:16,
@@
05/28 22:16
用回的好了 你用同樣的資料跑兩種code 1. proc logistic; order=internal; model Y=X; run; 2. proc logistic; order=internal desc; model Y=X; run; 這兩個應該會跑出剛好相反的beta值 第一個是fit P(Y=0|X) 第二個是fit P(Y=1|X) 看看那個是你要的吧 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.230.72.191
文章代碼(AID): #1A7fuGRD (Statistics)
文章代碼(AID): #1A7fuGRD (Statistics)