Dear all,
I conduct t-tests between survey data and census data (I assume the latter to be error-free). The t-tests are run on a number of dummy-coded sociodemographic categorical variables, such as dummies for different age categories, gender and citizenship. (I am aware of the statistical limitations of computing t-tests between categorical variables).
I am using -estadd- in order to add the p-value of the t-test to the list of scalars in order to use it for further operations. However, I encounter two problems with the output that I cannot solve even after looking up for help provided in the internet.
Here is the code with the example of gender and nationality:
I encounter two problems with the output.
(1) In case the p-value is 0.000, the format of the scalar is e.g. e(p_male) = 4.126e-07.
How can I change the format? I know that I can work with display, such as
However, I would like to change the format in the output of "ereturn list". Is that possible?
(2) I compute about 20 t-tests in a row. After each command, stata confirms that the scalar is added. However, when I type "ereturn list", only the last scalar added is returned.
Following the example from above this would be:
Output:
scalars:
e(p_foreigner) = .0005030865374663
e(rank) = 1
e(k_eq) = 1
e(stages) = 1
e(N) = 4200
.........
These are probably very basic problems. However, I could not find proper advice, so I am thankful for any suggestion!
Susanne
I conduct t-tests between survey data and census data (I assume the latter to be error-free). The t-tests are run on a number of dummy-coded sociodemographic categorical variables, such as dummies for different age categories, gender and citizenship. (I am aware of the statistical limitations of computing t-tests between categorical variables).
I am using -estadd- in order to add the p-value of the t-test to the list of scalars in order to use it for further operations. However, I encounter two problems with the output that I cannot solve even after looking up for help provided in the internet.
Here is the code with the example of gender and nationality:
Code:
svy: mean d_male lincom d_male -($c_male/100) local t = r(estimate) / r(se) estadd scalar p_male = 2*ttail(e(df_r),abs(`t')), replace svy: mean d_female lincom d_female - ($c_female/100) local t = r(estimate) / r(se) estadd scalar p_female = 2*ttail(e(df_r),abs(`t')), replace svy: mean d_national lincom d_national - ($c_national/100) local t = r(estimate) / r(se) estadd scalar p_national = 2*ttail(e(df_r),abs(`t')), replace svy: mean d_foreigner lincom d_foreigner - ($c_foreigner/100) local t = r(estimate) / r(se) estadd scalar p_foreigner = 2*ttail(e(df_r),abs(`t')), replace
(1) In case the p-value is 0.000, the format of the scalar is e.g. e(p_male) = 4.126e-07.
How can I change the format? I know that I can work with display, such as
Code:
display %8.3f e(p_male)
(2) I compute about 20 t-tests in a row. After each command, stata confirms that the scalar is added. However, when I type "ereturn list", only the last scalar added is returned.
Following the example from above this would be:
Code:
ereturn list
scalars:
e(p_foreigner) = .0005030865374663
e(rank) = 1
e(k_eq) = 1
e(stages) = 1
e(N) = 4200
.........
These are probably very basic problems. However, I could not find proper advice, so I am thankful for any suggestion!
Susanne
Comment