跳转到内容

The Wikibooks community is developing a policy on the use of generative AI. Please review the draft policy and provide feedback on its talk page.

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 -
检索自 "https://wikibooks.cn/w/index.php?title=R_Programming/Index&oldid=2962783"
华夏公益教科书