# How can you conduct a test for linear trend of log odds?

#### slucky

##### New Member
Hello,

I'm trying to figure out to test for a linear trend from the logistic regression. My outcome variable is age, and now it has been ordered. I've been recommended to a chi square- goodness of fit- I'm not sure if that makes sense.

Thanks!

#### hlsmith

##### Not a robit
What do you mean by "now it has been ordered"? Do you not have age in the model as a continuous variable?

#### slucky

##### New Member
No- I Have the continuous variables but was told to make them categorical for the model.

#### GretaGarbo

##### Human
No- I Have the continuous variables but was told to make them categorical for the model.
That is really bad. Look at Frank Harrel's blog. He has repeatedly been angry about that. Show the boss Harrel's blog.

#### GretaGarbo

##### Human
I thought that the question from the boss was about using the the likelihood as an overall estimate of the fit of the model.

Here is an example of estimates:

Code:
Call:  glm(formula = y ~ x, family = binomial(link = "logit"))

Coefficients:
(Intercept)            x
-9.083        3.187

Degrees of Freedom: 40 Total (i.e. Null);  39 Residual
Null Deviance:        56.62
Residual Deviance: 20.47     AIC: 24.47
>
And here is a link to explanations.

#### hlsmith

##### Not a robit
OP doesn't say "boss", I was thinking at first of a non-savvy peer-reviewer. If the coefficient is significant in the model then you likely have a positive trend. Though you could always fit a general additive model (GAM), to explicitly look at the relationship to ensure it is not non-linear. Or another option is to add a quadratic term to the model and see if it is significant or do the box test? of y = x + log(x*x) [I believe, that is right but it has been awhile]. You could do the categorical approach, but if it seems apparent that there is a linear relationship, I would revert back to using the model with it as continuous variable. I am not sure what they are desiring with the chi-square, perhaps the -2loglikelihood test, but that seems inappropriate or not well define in the use case.