Solved – Is it possible to test for a linear trend when running a logistic regression

I have a dichotomous DV and a single factor with three levels. Is it possible to test for a linear trend in the log-odds for each level of my factor?

In R, you could specify that the factor is an ordered factor (ordered), which will parameterize a three-level factor in terms of constant, linear, and quadratic terms … the f.L parameter below essentially measures the linear trend.

set.seed(101) d <- data.frame(y=rbinom(60,prob=0.5,size=1),                 f=ordered(rep(1:3,each=20))) summary(glm(y~f,data=d)) ## ... ## Coefficients: ##             Estimate Std. Error t value Pr(>|t|)     ## (Intercept)  0.51667    0.06612   7.815  1.4e-10 *** ## f.L         -0.03536    0.11452  -0.309    0.759     ## f.Q          0.02041    0.11452   0.178    0.859     

The contr.sdif (successive differences) contrast from the MASS package might also be of interest.

Similar Posts:

Rate this post

Leave a Comment

Solved – Is it possible to test for a linear trend when running a logistic regression

I have a dichotomous DV and a single factor with three levels. Is it possible to test for a linear trend in the log-odds for each level of my factor?

Best Answer

In R, you could specify that the factor is an ordered factor (ordered), which will parameterize a three-level factor in terms of constant, linear, and quadratic terms … the f.L parameter below essentially measures the linear trend.

set.seed(101) d <- data.frame(y=rbinom(60,prob=0.5,size=1),                 f=ordered(rep(1:3,each=20))) summary(glm(y~f,data=d)) ## ... ## Coefficients: ##             Estimate Std. Error t value Pr(>|t|)     ## (Intercept)  0.51667    0.06612   7.815  1.4e-10 *** ## f.L         -0.03536    0.11452  -0.309    0.759     ## f.Q          0.02041    0.11452   0.178    0.859     

The contr.sdif (successive differences) contrast from the MASS package might also be of interest.

Similar Posts:

Rate this post

Leave a Comment