我试图tabout在Stata中使用该命令生成一个表格,显示年龄变量的摘要统计信息.我想要的是类似于summarize age, detail输出但产生类似于MS Word格式的输出.
tabout年龄使用table111.txt,c(偏斜年龄峰度年龄平均年龄中位年龄sd年龄)f(0c)总和h3(nil)npos(两者)
不会产生我想要的结果.
有关如何调整代码的任何建议?如果我想在表中包含第二个变量以及相同的汇总统计信息,该怎么办?
我需要从 Stata 到 R 运行相同的练习(蒙特卡罗模拟)。
我在 Stata 中使用的代码是下面的代码。我如何使用 R 做到这一点?(我已经搜索了很多教程,但我仍然没有设法在 R 中做到这一点)。
* Simulations (10, 100 and 1000 sample replications/iterations)
clear
drop _all
set obs 100
set seed 54231
gen x = ((rnormal()))*10 + 40
* Generating true_y, considering Beta = 0,035
gen true_y = 5+0.03500*x
save truth, replace
twoway scatter true_y x
program hetero1
version 13
args c
use truth, clear
gen y = true_y + rnormal()
regress y x
end
foreach i in 10 100 1000 {
simulate …Run Code Online (Sandbox Code Playgroud) 有没有办法在 Stata 上导出的 esttab 结果上添加小数点逗号 (1000 --> 1,000)?
我有一个大的Stata数据集.在某些变量中,数据使用" "(空格)而不是缺失值进行编码.
有没有办法循环遍历数据集的每个元素并用正确的值替换它?
我需要类似的东西
for variable in all_variables:
for sample in all_samples_of_variable:
if sample == ' ' :
replace sample with missing value
Run Code Online (Sandbox Code Playgroud)