作者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/m.aspx?n=bbs/Statistics/M.1596086641.A.201.html