[程式] SAS與R R^2不同請教~
[軟體程式類別]:
請填入軟體程式類別,例如:SAS、SPSS、R、EVIEWS...等
SAS、R
[程式問題]:
資料處理、迴歸、敘述統計、logistic、probit...等
迴歸
[軟體熟悉度]:
請把以下不需要的部份刪除
中(3個月到1年)
[問題敘述]:
請問兩個軟體,同樣的估計方法,為什麼R^2差異這麼大~~
[程式範例]:
雖然張貼程式很可怕,但基本上有些程式還是要張貼才能解決
[SAS CODE]
-----------------
DATA A;
INPUT firm year p c @@;
DATALINES;
1 1955 5.36598 1.14867 1 1960 6.03787 1.45185
1 1965 6.37673 1.52257 1 1970 6.93245 1.76627
2 1955 6.54535 1.35041 2 1960 6.69827 1.71109
2 1965 7.40245 2.09519 2 1970 7.82644 2.39480
;
RUN;
PROC SORT DATA=A;
BY firm year;
RUN;
PROC PANEL DATA=A PRINTFIXED;
MODEL p = c/ FIXTWO ;
ID firm year;
RUN;
[OUTPUT]
------------
SSE = 0.0724 DFE = 2
MSE = 0.0362 根 MSE = 0.1903
R 平方 = 0.9825
[R CODE]
-----------
library(plm)
data = read.csv('C:/data.csv',header=TRUE)
pdata = plm.data(data,index=c('firm','year'))
pm1 = plm(p~c, model='within', data=pdata, effect='twoways')
summary(pm1)
[OUTPUT]
-----------
Total Sum of Squares: 0.072469
Residual Sum of Squares: 0.072418
R-Squared : 0.00071469
Adj. R-Squared : 0.00017867
F-statistic: 0.00143041 on 1 and 2 DF, p-value: 0.97327
-----------------------------------------------------------------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.115.198.160
※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1432568958.A.F89.html
※ 編輯: boshings (59.115.198.160), 05/25/2015 23:50:13
→
05/26 00:10, , 1F
05/26 00:10, 1F
→
05/26 00:10, , 2F
05/26 00:10, 2F
不是很了解你的意思,可能儲存的位數有差,但是應該不會嚴重影響估計結果
※ 編輯: boshings (59.115.198.160), 05/26/2015 00:28:42
推
05/26 16:22, , 3F
05/26 16:22, 3F
→
05/26 16:23, , 4F
05/26 16:23, 4F
兩者估計係數相同,SSE也相同 應該是同一個模型
SAS:
變數 自由度 估計值 標準誤差 t 值 Pr > |t|
c 1 -0.02718 0.7188 -0.04 0.9733
R:
Estimate Std. Error t-value Pr(>|t|)
c -0.027184 0.718755 -0.0378 0.9733
※ 編輯: boshings (59.115.156.102), 05/26/2015 18:51:09
推
05/27 15:25, , 5F
05/27 15:25, 5F
→
05/27 15:37, , 6F
05/27 15:37, 6F