跳轉到內容

R 程式設計/索引

來自華夏公益教科書,開放的書籍,開放的世界

此頁面提供表格,方便您在 R、SAS 和 Stata 中查詢用於統計常用任務的函式。未來還可能包含其他軟體,例如 SPSS。

資料管理

[編輯 | 編輯原始碼]
函式 R Stata SAS
合併 merge() merge / mmerge -
重塑 reshape() reshape -
擴充套件資料集 expand() (epicalc) expand -

描述性統計

[編輯 | 編輯原始碼]
函式 R Stata SAS
平均值 mean() mean proc means
直方圖 hist() hist -
頻數表 table() ta proc freq

迴歸模型

[編輯 | 編輯原始碼]
函式 R Stata SAS
最小二乘法 lm() reg proc reg
廣義線性模型 (GLM) glm() glm proc glm
機率模型 glm(, family = binomial(link="probit")) probit -
Logit 模型 glm(, family = binomial(link="logit")) logit -
線性固定效應模型 plm( , model = "within") (plm) xtreg , fe -
線性隨機效應模型 plm( , model = "random") (plm) xtreg , re -
線性分位數迴歸 rq() (quantreg) qreg -
序數邏輯迴歸 polr() (MASS) ologit -
線性 IV (2sls) ivreg() (AER) ivreg proc syslin (2sls) -

程式設計

[編輯 | 編輯原始碼]
函式 R Stata SAS
檢查一些條件 stopifnot() assert -
華夏公益教科書