# Latency Test

Fortunately that was fixable, see http: Some programs do the Cochran—Mantel—Haenszel test without the continuity correction, so be sure to specify whether you used it when reporting your results. Linuxcnc and Hal should not be running, stop with halrun -U. This test is the first test that should be performed on a PC to see if it is able to drive a CNC machine. So, what do the results mean?

## John H. McDonald

The important numbers are the max jitter. In the example above, that is nanoseconds, or 9. Record this number, and enter it in Stepconf when it is requested.

In the example above, latency-test only ran for a few seconds. For instance, one Intel motherboard worked pretty well most of the time, but every 64 seconds it had a very bad us latency.

Fortunately that was fixable, see http: So, what do the results mean? If your Max Jitter number is less than about microseconds nanoseconds , the computer should give very nice results with software stepping. If the max latency is more like microseconds, you can still get good results, but your maximum step rate might be a little disappointing, especially if you use microstepping or have very fine pitch leadscrews. If the numbers are us or more , nanoseconds , then the PC is not a good candidate for software stepping.

Numbers over 1 millisecond 1,, nanoseconds mean the PC is not a good candidate for LinuxCNC, regardless of whether you use software stepping or not. Note that if you get high numbers, there may be ways to improve them. Another PC had very bad latency several milliseconds when using the onboard video.

For more information on stepper tuning see the Stepper Tuning Chapter. It may be useful to see spikes in latency when other applications are started or used. However, software step pulses also have some disadvantages: Additional command line tools are availalbe for examining latency when LinuxCNC is not running. Then in the summer you repeat the experiment again, with 28 new volunteers. You could just add all the data together and do Fisher's exact test on the total people, but it would be better to keep each of the three experiments separate.

Maybe legwarmers work in the winter but not in the summer, or maybe your first set of volunteers had worse arthritis than your second and third sets. In addition, pooling different studies together can show a "significant" difference in proportions when there isn't one, or even show the opposite of a true difference. This is known as Simpson's paradox. For these reasons, it's better to analyze repeated tests of independence using the Cochran-Mantel-Haenszel test. For our imaginary legwarmers experiment, the null hypothesis would be that the proportion of people feeling pain was the same for legwarmer-wearers and non-legwarmer wearers, after controlling for the time of year.

The alternative hypothesis is that the proportion of people feeling pain was different for legwarmer and non-legwarmer wearers. Technically, the null hypothesis of the Cochran—Mantel—Haenszel test is that the odds ratios within each repetition are equal to 1. The odds ratio is equal to 1 when the proportions are the same, and the odds ratio is different from 1 when the proportions are different from each other.

I think proportions are easier to understand than odds ratios, so I'll put everything in terms of proportions. But if you're in a field such as epidemiology where this kind of analysis is common, you're probably going to have to think in terms of odds ratios. You subtract the 0. The denominator contains an estimate of the variance of the squared differences.

It is chi-square distributed with one degree of freedom. Different sources present the formula for the Cochran—Mantel—Haenszel test in different forms, but they are all algebraically equivalent. The formula I've shown here includes the continuity correction subtracting 0. Some programs do the Cochran—Mantel—Haenszel test without the continuity correction, so be sure to specify whether you used it when reporting your results.

In addition to testing the null hypothesis, the Cochran-Mantel-Haenszel test also produces an estimate of the common odds ratio, a way of summarizing how big the effect is when pooled across the different repeats of the experiment. This require assuming that the odds ratio is the same in the different repeats.

You can test this assumption using the Breslow-Day test, which I'm not going to explain in detail; its null hypothesis is that the odds ratios are equal across the different repeats. If some repeats have a big difference in proportion in one direction, and other repeats have a big difference in proportions but in the opposite direction, the Cochran-Mantel-Haenszel test may give a non-significant result.

In our legwarmer example, if the proportion of people with ankle pain was much smaller for legwarmer-wearers in the winter, but much higher in the summer, and the Cochran-Mantel-Haenszel test gave a non-significant result, it would be erroneous to conclude that legwarmers had no effect.

Instead, you could conclude that legwarmers had an effect, it just was different in the different seasons. When you look at the back of someone's head, the hair either whorls clockwise or counterclockwise. Lauterbach and Knight compared the proportion of clockwise whorls in right-handed and left-handed children.

With just this one set of people, you'd have two nominal variables right-handed vs. However, several other groups have done similar studies of hair whorl and handedness McDonald You could just add all the data together and do a test of independence on the total people, but it would be better to keep each of the 8 experiments separate. Some of the studies were done on children, while others were on adults; some were just men, while others were male and female; and the studies were done on people of different ethnic backgrounds.

Pooling all these studies together might obscure important differences between them. Overall, left-handed people have a significantly higher proportion of counterclockwise whorls than right-handed people. McDonald and Siebenaller surveyed allele frequencies at the Lap locus in the mussel Mytilus trossulus on the Oregon coast.

At four estuaries, we collected mussels from inside the estuary and from a marine habitat outside the estuary. There were three common alleles and a couple of rare alleles; based on previous results, the biologically interesting question was whether the Lap 94 allele was less common inside estuaries, so we pooled all the other alleles into a "non- 94 " class. The null hypothesis is that at each area, there is no difference in the proportion of Lap 94 alleles between the marine and estuarine habitats.

This table shows the number of 94 and non- 94 alleles at each location. There is a smaller proportion of 94 alleles in the estuarine location of each estuary when compared with the marine location; we wanted to know whether this difference is significant. We can reject the null hypothesis that the proportion of Lap 94 alleles is the same in the marine and estuarine locations.

They found 5 studies that met their criteria and looked for coronary artery revascularization in patients given either niacin or placebo:. The null hypothesis is that the rate of revascularization is the same in patients given niacin or placebo.

Significantly fewer patients on niacin developed coronary artery revascularization. To graph the results of a Cochran—Mantel—Haenszel test, pick one of the two values of the nominal variable that you're observing and plot its proportions on a bar graph, using bars of two different patterns. Mantel and Haenszel came up with a fairly minor modification of the basic idea of Cochran , so it seems appropriate and somewhat less confusing to give Cochran credit in the name of this test.

The Cochran—Mantel—Haenszel test for nominal variables is analogous to a two-way anova or paired t —test for a measurement variable, or a Wilcoxon signed-rank test for rank data. I've written a spreadsheet to perform the Cochran—Mantel—Haenszel test.

It gives you the choice of using or not using the continuity correction; the results are probably a little more accurate with the continuity correction. It does not do the Breslow-Day test. It uses the mussel data from above. For repeated 2x2 tables, the three statistics are identical; they are the Cochran—Mantel—Haenszel chi-square statistic, without the continuity correction.

For repeated tables with more than two rows or columns, the "general association" statistic is used when the values of the different nominal variables do not have an order you cannot arrange them from smallest to largest ; you should use it unless you have a good reason to use one of the other statistics.