I don't know how to calculate the degrees of freedom given the stata output to the command tabodds dead caccat, or. Any ideas? Thank you
6.3.1 Degrees of freedom
Because I assume that you have a statistics book explaining the necessary formulas, I have not gone into detail. Stata will compute the chi-squared, the number of degrees of freedom, and the probability of getting your observed result by chance. You can determine the number of degrees of freedom yourself. The degrees of freedom refers to how many pieces of independent information you have. In a 2×2 table, like the one we have been analyzing, the value of any given cell can be any number between 0 and the smaller of the number of observations in the row and the number of observations in the column. For example, the upper left cell (350) could be anything between 0 and 784. Let’s use the observed value of 350 for the upper left cell. Now how many other cells are free to vary?
By subtraction, you can determine that 434 people must be in the female/yes cell because 784 − 350 = 434. Similarly, 478 observations must be in the male/no cell (828 − 350 = 478), and 677 observations must be in the female/no cell (1111 − 434 = 677). Thus, with four cells, only one of these is free, and we can say that the table has 1 degree of freedom. We can generalize this to larger tables where degrees of freedom = (R − 1)(C − 1), where R is the number of rows and C is the number of columns. If we had a 3×3 table instead of a 2×2 table, we would have (3−1)(3−1) = 4 degrees of freedom.
Thanks Martin. the equation degrees of freedom = (R − 1)(C − 1) helps and I understand this part of the question better. I don't understand, however, how one tests the trend of increasing risk of death with a higher CAC score (what is a trend in biostatistics?). Any further help on this topic is much appreciated.
Giorgia
I don't understand, however, how one tests the trend of increasing risk of death with a higher CAC score (what is a trend in biostatistics?).
These two paragraphs can be found here and give a nice overview.
We can use the tabodds command to tabulate the odds of failure or odds ratios against a categorical exposure variable. The test for trend calculated by tabodds can serve as a test for dose–response if the exposure variable is at least ordinal. If the exposure variable has no natural ordering, the trend test is meaningless and should be ignored. See the technical note at the end of this section for more information regarding the test for trend.
Technical note
The score test for trend performs a test for linear trend of the log odds against the numerical code used for the exposure variable. The test depends not only on the relationship between dose level and the outcome but also on the numeric values assigned to each level or, to be more accurate, to the distance between the numeric values assigned. For example, the trend test on a dataset with four exposure levels coded 1, 2, 3, and 4 gives the same results as coding the levels 10, 20, 30, and 40 because the distance between the levels in each case is constant. In the first case, the distance is one unit, and in the second case, it is 10 units. However, if we code the exposure levels as 1, 10, 100, and 1,000, we would obtain different results because the distance between exposure levels is not constant. Thus be careful when assigning values to exposure levels. You must determine whether equally spaced numbers make sense for your data or if other more meaningful values should be used. Remember that we are testing whether a log-linear relationship exists between the odds and the exposure variable. For your particular problem, this relationship may not be correct or even make sense, so you must be careful in interpreting the output of this trend test.
Thanks for this comprehensive and clear response, Martin. The TAs (and Dr Pletcher!) have nothing to add.