I believe Stata 15 provided a rather handy panoply of commands to perform Bayesian analysis under the - bayes: - prefix.
With regards to inferential models, it became much easier to select several types of regression, including hierarchical models,
That said, I wonder whether there is some sort of "equivalent" chi-squared test, at least some kind of simulation which would produce the couterpart of the traditional calculation proposed by Pearson.
Below, for example, we see repair records were unexpectedly higher for foreign cars. To underline this aspect, we have the expected values, the Pearson chi2 contribution, p-values (Pearson's as well as Fisher's) and the Cramer's V.
Code:
. sysuse auto (1978 Automobile Data) . tabulate rep78 foreign, cchi2 chi2 column exact expected V +--------------------+ | Key | |--------------------| | frequency | | expected frequency | | chi2 contribution | | column percentage | +--------------------+ Enumerating sample-space combinations: stage 5: enumerations = 1 stage 4: enumerations = 3 stage 3: enumerations = 24 stage 2: enumerations = 203 stage 1: enumerations = 0 Repair | Record | Car type 1978 | Domestic Foreign | Total -----------+----------------------+---------- 1 | 2 0 | 2 | 1.4 0.6 | 2.0 | 0.3 0.6 | 0.9 | 4.17 0.00 | 2.90 -----------+----------------------+---------- 2 | 8 0 | 8 | 5.6 2.4 | 8.0 | 1.1 2.4 | 3.5 | 16.67 0.00 | 11.59 -----------+----------------------+---------- 3 | 27 3 | 30 | 20.9 9.1 | 30.0 | 1.8 4.1 | 5.9 | 56.25 14.29 | 43.48 -----------+----------------------+---------- 4 | 9 9 | 18 | 12.5 5.5 | 18.0 | 1.0 2.3 | 3.3 | 18.75 42.86 | 26.09 -----------+----------------------+---------- 5 | 2 9 | 11 | 7.7 3.3 | 11.0 | 4.2 9.5 | 13.7 | 4.17 42.86 | 15.94 -----------+----------------------+---------- Total | 48 21 | 69 | 48.0 21.0 | 69.0 | 8.3 19.0 | 27.3 | 100.00 100.00 | 100.00 Pearson chi2(4) = 27.2640 Pr = 0.000 Cramér's V = 0.6286 Fisher's exact = 0.000 .
We see the association between foreign vehicles and repair records is "statistically significant" (sorry for the un-Bayesian sentence). What is more, the effect size is considerably strong.
Now, my question: how could we elaborate a Bayesian couterpart in Stata?
Indeed, the command - tabulate - is not supported by the bayes prefix.
As far as I tried, I didn't find any reference to this subject.
Thank you in forward for any help!
0 Response to Bayesian analysis: how to mirror a chi-squared test under the "bayes:" prefix
Post a Comment