Stata Technical Bulletin
11
Examples
The first example is from the originators of this statistic (Berry and Mielke 1994):
. ioV Iikert
Variable IOV IOC p-value
---------+------------------------------------
Iikert I 0.6976 0.3024 0.0440
Next we use the same data, except that we have duplicated the above variable and then set all cases with a value of 5 to missing:
. replace lik2 = . if lik2==5
(4 real changes made, 4 to missing)
. iov lik*, actual
Variable |
IOV |
IOC |
p-value |
rows |
— Iikert |
I 0.6976 |
0.3024 |
0.0440 |
— ε |
lik2 |
I 0.8116 |
0.1884 |
0.0000 |
4 |
Next is a made-up example. There are two variables and 40 observations in the dataset. Variable x consists of just the
numbers 1-40, while variable y has 10 each of the values 1, 2, 3, and 4. I start with a brief description of the two variables:
. SU X y
Variable |
I Obs |
Mean |
Std. Dev. |
Min |
Max |
— x У |
I 40 I 40 |
20.ε 2.ε |
11.69046 1.132277 |
1 1 |
— 40 4 |
. iov x, |
rows(40) | ||||
Variable |
IOV |
IOC |
p-value | ||
— x |
I 0.6833 |
0.3167 |
0.9364 | ||
• Iov y, |
rows(4) | ||||
Variable |
IOV |
IOC |
p-value | ||
— У |
I 0.8333 |
0.1667 |
0.0000 |
Note the odd result for these two variables when the rows option is not used; the р-value is not affected, but the values of the
statistics are
. iov x y
Variable |
IOV |
IOC |
p-value |
— x |
I 0.0260 |
0.9750 |
0.9364 |
У |
I 0.6260 |
0.3750 |
0.0000 |
The Neyman-Barton smooth goodness-of-fit test
The syntax of nbgof is
nbgof varname [if exp] [in range]
This program performs a Neyman-Barton smooth goodness-of-fit test of order 2. The test result is asymptotically distributed as
chi-squared with 2 df. This is used for testing of uniformity (i.e., a uniform distribution). The test is valid for (7(0,1), so if the
data are outside this range they are transformed to inside the range using a standard transformation (Stephens 1986).
The output consists of four pieces of information for each variable: (1) the value of the test statistic; (2) its p-value; (3) the
value of U, one of the two components of the test statistic and also a test statistic; (4) the value of S2, the other component
of the test statistic, and also a test statistic. р-values are not given for U and S2 as I have been unable to find a reasonable
approximation to the tables given in Stephens. (Each of these is asymptotically standard normal.) The Neyman-Barton test is
equal to the sum of the squared values of the component tests.
The data are expected to be in unweighted form. If they are frequency weighted, use Stata’s expand command.
No options are allowed.