To explain my problem , i have this simulated data using R.
require(splines)
x=rnorm(20 ,0,1)
y=rep(c(0,1),times=10)
First i fitted a regular (linear effects) logistic regression model.
fit1=glm(y~x ,family = "binomial")
Then to check the non linear effects, i fitted this natural spline model .
fit2=glm(y~ns(x,df=2) ,family = "binomial")
Based on my thinking models , i believe these 2 models are non nested models.
Next i wanted check whether the non linear model (fit2
) has any significant effects compared to the regular logistic model (fit1
).
Is there any way to compare this two models? I believe i cannot use the lrtest
function in lmtest
package, because these two models are not nested models.
Any suggestion will be highly appreciated
Thank you.