- Thread starter Disvengeance
- Start date

I know you can plot these as well as splines but don't know what they use for the test. A work around I have used is pairwise comparisons or a trend test in an effect statement for a categorical variable, but neither are what they are likely doing.

"The problem with leaving it as categorical is that you'll get a test with 4df that will have less power. In epidemiology it's common to perform a 'test for trend' by treating an ordinal covariate as continuous, but then to report the estimates and CIs for the model with it categorical. – onestop Jan 16 '11 at 14:07

"

Located halfway down the page at: http://stats.stackexchange.com/questions/6294/interaction-between-ordinal-and-categorical-factor

Not completely sure what procedures they are referencing in particular.

Apparently the equivalent Chi-squared trend test he refers to is on page 166:

\(

\chi_{trend}^2 = \frac{n^3}{n_D n_{\bar{D}}} \times \frac{{[\Sigma_{k=1}^K x_k (a_k - \frac{n_D m_k}{n})]^2}}{[n \Sigma_{k=1}^K x_k^2m_k - (\Sigma_{k=1}^K x_k m_k)^2]}

\)

where \(x_K\) is the number of observations at exposure level \(E=x_k\), \(a_k\) is the number of diseased at the \(k^{th}\) level of exposure, \(n_{\bar{D}}\) is the number of non-diseased, \(n_D\) the number of diseased, \(m_k\) the row total at the \(k^{th}\) level of exposure, and \(n\) the sample size

\(

\chi_{trend}^2 = \frac{n^3}{n_D n_{\bar{D}}} \times \frac{{[\Sigma_{k=1}^K x_k (a_k - \frac{n_D m_k}{n})]^2}}{[n \Sigma_{k=1}^K x_k^2m_k - (\Sigma_{k=1}^K x_k m_k)^2]}

\)

where \(x_K\) is the number of observations at exposure level \(E=x_k\), \(a_k\) is the number of diseased at the \(k^{th}\) level of exposure, \(n_{\bar{D}}\) is the number of non-diseased, \(n_D\) the number of diseased, \(m_k\) the row total at the \(k^{th}\) level of exposure, and \(n\) the sample size

Last edited:

If a model has, for example an income variable in 5 levels, then a constrained model could be:

log(p/(1-p) = b0 + b1*income

that is, include income as a "regression variable". The logit would then be constrained to be linear in income. An alternative model, and un-constrained model would be

lot(p/(1-p)) = bo + b1*D1 + b2*D2 + b3*D3 + b4*D4

where the D:s are dummys for the income category. In this model the different b:s would allow for that the effect to not be on the line. So a likelihood ratio test could be:

-2*[logL(constrained) - logL(unconstrained) ] is chi-squared with degrees of freedom as the difference of the number of estimated parameters and where logL means the log-likelihood for respective model.

I think that it is reasonable to check if there is a linear relation in the restricted model and not just assume that. But it seems like, from the links hlsmith provided that it can cause some irritation.

Maybe the formula Disvengeance gave above is a special case of the likelihood ratio test. I can't see through that.

If the chi-sq is significant then adding the interaction term helped.

I have an idea how else to do this with coding, but need to look something up.