Dear all,
Can someone help me loop across different rows performing multiple immediate statistical tests, i.e. "csi a b c d, exact" tests across rows and save the respective p value in a different column?
I was able to do it for just one row, since it is iterating on the same row and delivering the first row outcome several times, as much as the number of iterations needed.
Here is the code i am using:
[CODE][ gen id=_n
gen p_val=.
forvalues i = 1/`=_N' {
csi `=a' `=b' `=c' `=d', exact
replace in `i' p_val=r(p)
}/CODE]
Here is de data:
a b c d
1 28 11 20
5 24 6 25
3 26 4 27
5 24 11 20
2 27 4 27
1 28 13 18
1 28 12 19
4 25 7 24
2 27 13 18
0 29 2 29
2 27 2 29
2 27 5 26
3 26 0 31
2 27 1 30
9 20 14 17
3 26 6 25
0 29 4 27
0 29 0 31
16 13 5 26
6 23 3 28
Thank you in advance.
Gonçalo Cotovio
Related Posts with Multiple immediate test across rows
Missing values generated after trying to generate ln function Before trying to generate my variable I had this variable. Code: * Example generated by -datae…
Command -ritest- for randomization inference in Stata now available from SSC.Thanks to Kit Baum, -ritest- is now available for download from SSC. -ritest- is a module to conduct…
Panel Data CEO-firm fixed effectsDear Statalists, I am new to Stata. I have one inquiry on performing the CEO-firm fixed effects for…
Cleaning dataHi, first post on stata forum here: Hello. I have a survey dataset with lots of -5, -4, -3, -2, -1 f…
Query regarding the Hansen statistic obtained after xtabond2Hello, I have a question regarding running the xtabond2 command, with alternating years of data. I …
Subscribe to:
Post Comments (Atom)
0 Response to Multiple immediate test across rows
Post a Comment