作者evilove (愿意感动就是一种享受)
看板Statistics
标题Re: [程式] Save p values in Stata
时间Thu Jul 30 13:23:59 2020
我觉得我满接近了,但不晓得为什麽只有存到第一轮的loop
* generate country N
egen country_id = group(CountryofLiving)
qui summarize country_id
* display number of countries
display `r(max)'
* create empty matrix with 55 * 8 rows, 1 column
set matsize 450
matrix storeMyP = J(`r(max)' * 8, 1, .)
* count the iterations
local n = 1
* anlysis by countries
foreach var of varlist fob_* sob_* {
bysort CountryofLiving: anova `var' age3
matrix storeMyP[`n', 1] = Ftail(e(df_m), e(df_r), e(F))
local ++n
}
* display storeMyP
matrix list storeMyP
storeMyP[440,1]
c1
r1 .27275597
r2 .0909248
r3 .24468857
r4 .00023781
r5 .87538963
r6 .07680316
r7 .34257757
r8 .00722484
r9 .
r10 .
r11 .
r12 .
r13 .
※ 引述《evilove (愿意感动就是一种享受)》之铭言:
: [软体程式类别]: Stata
: [程式问题]: ANOVA
: [软体熟悉度]:
: 熟悉
: [问题叙述]:
: 需要跑上百个ANOVA 想知道怎麽另外把 P values 储存起来
: [程式范例]:
: foreach var of varlist fob_* sob_* {
: bysort CountryofLiving: oneway `var' age3, tabulate
: }
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 69.140.102.182 (美国)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Statistics/M.1596086641.A.201.html