I am currently having problems with how to efficiently store test results that I obtain from running several -signtest- in Stata. I have experience with Stata, but I have never had the need for exporting test results. The version of Stata that I am currently using is "Stata/IC 16.0".
My data set consists of the following:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str19 Release byte EventNUMB str8 Signofrelease double(CAR_pre CAR_5 CAR_10 CAR_15 CAR_20 CAR_30 CAR_40 CAR_50) "CapacityUtilization" 1 "NEGATIVE" 8.88178419700125e-16 25.7801627102792 26.2141819549185 28.2039555278995 28.6372483220213 18.5953726142309 29.5859370519189 37.4585052988942 "CapacityUtilization" 2 "NEGATIVE" -2.22044604925031e-15 -1.04079925220558 -4.28132813232914 -3.63638515716993 -2.6038095558448 -8.30703645418472 -6.24381568811616 -23.9891305449132 "CapacityUtilization" 3 "NEGATIVE" 6.66133814775094e-16 -2.65366528265895 -4.36566142151558 -7.23331867708183 -4.70864235230455 -12.755427685556 -3.85555153196826 -14.9811533082037 "CapacityUtilization" 4 "NEGATIVE" -1.99840144432528e-15 7.41804157605855 14.0264516199066 14.1076304153014 13.463567176098 19.4264414460729 15.2380828220211 8.86889395437376 "CapacityUtilization" 5 "NEGATIVE" 0 -1.82435791811824 1.06106245029394 3.40005812231985 4.28393211741757 1.32367748840627 8.09105756268053 10.2210730518155 "CapacityUtilization" 6 "NEGATIVE" 3.88578058618805e-16 -1.01090049230272 .949255476101659 .571375763893903 -2.27221019352017 -4.38876256991584 -6.08029497472296 -12.8349905969356 "CapacityUtilization" 1 "POSITIVE" -6.66133814775094e-16 4.20465796985533 5.19381440844124 9.15066015174141 6.43006732682823 7.66626517582839 1.47767582462599 2.71321220290296 "CapacityUtilization" 2 "POSITIVE" -4.9960036108132e-16 .0755753462087596 1.8158500117077 .832117653148575 -.151661080167916 -6.88839989057037 -5.44977693347715 12.3232966116314 "CapacityUtilization" 3 "POSITIVE" 3.19189119579733e-16 9.19461483570324 9.27191221032908 13.5187718413314 12.90126289294 11.6661001526367 11.1257437219292 .154546349323177 "CapacityUtilization" 4 "POSITIVE" 2.22044604925031e-16 8.36087996481432 11.8923040180076 10.0124034977571 3.55530337991695 15.6529621053953 23.8574305975403 21.7761323154019 "CapacityUtilization" 5 "POSITIVE" -5.55111512312578e-16 4.36955464024505 4.81479980564072 5.17198560150401 7.02597134257209 12.6252238865701 9.7310503857545 17.0008424971063 end
My current approach have been to use the -postfile- function, running the following command:
Code:
tempname memhold tempfile results postfile `memhold' str10 name No N_neg N_pos pval_two pval_one_neg pval_one_pos using `results' foreach var of varlist CAR_5 CAR_10 CAR_15 CAR_20 CAR_30 CAR_40 CAR_50 { signtest CAR_pre = `var' post `memhold' ("`var'") (r(N tie)) (r(N neg)) (r(N pos)) (r(p 2)) (r(p neg)) (r(p pos)) } postclose `memhold' use `results', clear
Code:
signtest CAR_pre=CAR_5
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10 name float(No N_neg N_pos pval_two pval_one_neg pval_one_pos) "CAR_5" . . . . . . "CAR_10" . . . . . . "CAR_15" . . . . . . "CAR_20" . . . . . . "CAR_30" . . . . . . "CAR_40" . . . . . . "CAR_50" . . . . . . end
As far as I am concerned, the -signtest- should provide the following scalars: r(N tie) (r(N neg) (r(N pos) (r(p 2) (r(p neg) (r(p pos).
Ideally, I would want a loop where I could do the
Code:
by Signofrelease, sort : signtest CAR_pre = var'
Code:
signtest CAR_pre = `var'
Thank you in advance,
Kind regards
C
0 Response to Generate table or data set containing test results from -signtest-
Post a Comment