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
Confusion between out of sample predict and forecastI have read the forecast manual, but I can't understand why using forecast produces different result…
Loop regexm to search for multiple strings stored as observationsDear Statalists,
I have sucessfully used regexm to search for one string (a diagnose code, for exam…
Analysing duplicatesHi guys,
I need to analyse duplicates. I've got different newpaper articles. They all have a story_…
Speed of StataDear All,
I am using stata 15.1. I noticed something that I cannot explain. I am using the command …
Panel Data model: DIagnostic testingHi stata community. I really need help. I have a long panel T=17 and N=8(countries). These are the s…
Subscribe to:
Post Comments (Atom)
0 Response to Multiple immediate test across rows
Post a Comment