0
$\begingroup$

I'm trying to find the best model from a dataset which mainly has ordinal variables (in likert scale). So, I don't know since I had to put in GLM as.factor do I have to put them in the GAM model as well? I'm asking this because in the GAM model I have the Odd ratios.

My code for this:

model3345=glm(y2 ~ a + f + g + i + j + l + s + u + offset(d64e),data=DATOS2)
summary(model3345)

            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -2.35397    0.14584 -16.141  < 2e-16 ***
a.L         -0.45498    0.10611  -4.288 2.61e-05 ***
a.Q         -0.22995    0.11812  -1.947 0.052721 .  
a.C         -0.02395    0.13271  -0.180 0.856912    
f.L         -0.20788    0.11061  -1.879 0.061393 .  
f.Q         -0.02724    0.11677  -0.233 0.815744    
f.C         -0.17884    0.11611  -1.540 0.124801    
g.L         -0.42140    0.12226  -3.447 0.000669 ***
g.Q          0.05257    0.11975   0.439 0.661024    
g.C          0.08407    0.12344   0.681 0.496465    
i.L         -0.93163    0.26927  -3.460 0.000638 ***
i.Q         -0.19056    0.20170  -0.945 0.345701    
i.C         -0.29493    0.26515  -1.112 0.267092    
i^4          0.18939    0.30482   0.621 0.534978    
i^5          0.79976    0.25511   3.135 0.001930 ** 
i^6          0.53483    0.20046   2.668 0.008145 ** 
j.L         -0.20958    0.13041  -1.607 0.109345    
j.Q         -0.09290    0.14340  -0.648 0.517680    
j.C         -0.32168    0.15081  -2.133 0.033922 *  
l.L          0.06244    0.12576   0.497 0.619975    
l.Q         -0.20616    0.11895  -1.733 0.084330 .  
l.C          0.10295    0.13395   0.769 0.442904    
s.L          0.18890    0.15172   1.245 0.214314    
s.Q         -0.20883    0.13210  -1.581 0.115209    
s.C         -0.22411    0.10830  -2.069 0.039575 *  
u.L         -0.18335    0.30659  -0.598 0.550373    
u.Q          0.05221    0.26377   0.198 0.843259    
u.C          0.34604    0.24965   1.386 0.166983    
u^4         -0.38964    0.21277  -1.831 0.068283 .  
u^5          0.05174    0.13307   0.389 0.697738  

where all the variables except $y2 \in (0,1)$ have been ordered like this:

a=factor(d64a,ordered = TRUE)
Levels: 1 < 2 < 3 < 4

but for the GAM model:

b<-gam(y2~s(d64a,k=4)+offset(d64e)+s(d64g,k=4)+s(d64h,k=4)+s(d64j,k=7)
       +s(d64l,k=4)+s(m11_bp28,k=6)
       ,data=DATOS2,method="REML",model=binomial(logit))
summary(b)
Approximate significance of smooth terms:
              edf Ref.df      F  p-value    
s(d64a)     1.844  2.194 10.046 3.87e-05 ***
s(d64g)     1.000  1.000  4.344  0.03807 *  
s(d64h)     1.000  1.000 18.508 2.35e-05 ***
s(d64j)     1.000  1.000  8.839  0.00321 ** 
s(d64l)     1.000  1.000  3.121  0.07839 .  
s(m11_bp28) 1.000  1.000  3.412  0.06580 .  

So, first: How can I interpret the coefficients from the first model? second: the GAM model is well written without using the ordered factors? and finally: can I do a GLM vs GAM?

$\endgroup$
  • $\begingroup$ You can't estimate smooths of semi-quantitative variables (unless you convert them to numeric and assume that the intervals on the ordinal scale are equal). So in the GAM, if those variables were not factors (they can't have been, otherwise gam() would have thrown an error) then the model just treated the numeric ordinal scale as being a fully continuous numeric variable, which probably isn't what you wanted. $\endgroup$ – Reinstate Monica - G. Simpson Nov 18 '19 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.