Specifying interaction terms for ordered response model
Posted: Fri Sep 18, 2015 5:11 am
Hi
I am trying to specify an interaction term for a logistic ordered response model in R2mlwin. My response has three categories. I am trying to interact one continues variable and one factor level variable.
However, there is a strange behaviour when and where I add the extra term [1:2] to specify a common term.
1) When I only have the interaction term, with no main terms, the term is doing what it is supposed to:
(full.model.2_MCMC =runMLwiN(logit(AFgpWHO, cons, 3) ~ 1 + Price[1:2]:Mother_educ[1:2] + (1[1:2] | Region) ,
D='Ordered Multinomial', estoptions=list(mcmcMeth = list(iterations = 100000, burnin=5000), resi.store =T, EstM=0),data = df.sm))
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: 2.32) multilevel model (Multinomial)
N min mean max
Region 48 NA NA NA
Estimation algorithm: IGLS MQL1 Elapsed time : 0.81s
Number of obs: 10000 (from total 10000) The model converged after 5 iterations.
Log likelihood: NA
Deviance statistic: NA
---------------------------------------------------------------------------------------------------
The model formula:
logit(AFgpWHO, cons, 3) ~ 1 + Price[1:2]:Mother_educ[1:2] + (1[1:2] |
Region)
Level 2: Region Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval]
Intercept_A_multipleAF -1.06191 0.08840 -12.01 3.066e-33 *** -1.23517 -0.88864
Intercept_B_singel_AF 0.17232 0.08763 1.97 0.04926 * 0.00056 0.34407
Price:Mother_educPrimary_12 -0.07493 0.01378 -5.44 5.437e-08 *** -0.10194 -0.04791
Price:Mother_educSecondary_12 -0.13823 0.01375 -10.05 8.913e-24 *** -0.16518 -0.11128
Price:Mother_educHigher_12 -0.28135 0.02586 -10.88 1.424e-27 *** -0.33203 -0.23067
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
---------------------------------------------------------------------------------------------------
The random part estimates at the Region level:
Coef. Std. Err.
var_Intercept_12 0.24306 0.06032
---------------------------------------------------------------------------------------------------
The random part estimates at the l1id level:
Coef. Std. Err.
bcons_1 1.00000 0.00000
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
But when I add all the terms as one should. he r2mlwin function adds an extra price term (Price_1 or Price_12) where there should not be one: and the interactions disappear. Additionally, NAs: are introduced.
(runMLwiN(logit(AFgpWHO, cons, 3) ~ 1 + Mother_educ[1:2] + Price[1:2] + Price:Mother_educ[1:2] + (1[1:2] | Region) ,
D='Ordered Multinomial', estoptions=list(mcmcMeth = list(iterations = 100000, burnin=5000), resi.store =T, EstM=0),data = df.sm))
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: 2.32) multilevel model (Multinomial)
N min mean max
Region 48 NA NA NA
Estimation algorithm: IGLS MQL1 Elapsed time : 0.91s
Number of obs: 10000 (from total 10000) The model converged after 5 iterations.
Log likelihood: NA
Deviance statistic: NA
---------------------------------------------------------------------------------------------------
The model formula:
logit(AFgpWHO, cons, 3) ~ 1 + Mother_educ[1:2] + Price[1:2] +
Price:Mother_educ[1:2] + (1[1:2] | Region)
Level 2: Region Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval]
Intercept_A_multipleAF -1.12338 0.11775 -9.54 1.423e-21 *** -1.35417 -0.89260
Intercept_B_singel_AF 0.44594 0.10806 4.13 3.678e-05 *** 0.23415 0.65772
Price_12 -0.05842 0.01831 -3.19 0.001418 ** -0.09431 -0.02254
Price_1 0.08855 0.01969 4.50 6.889e-06 *** 0.04996 0.12715
Mother_educPrimary_12 -0.34320 0.05415 -6.34 2.33e-10 *** -0.44933 -0.23707
Mother_educSecondary_12 -0.62165 0.05651 -11.00 3.821e-28 *** -0.73242 -0.51089
Mother_educHigher_12 -1.18916 0.10245 -11.61 3.762e-31 *** -1.38995 -0.98837
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
---------------------------------------------------------------------------------------------------
The random part estimates at the Region level:
Coef. Std. Err.
var_Intercept_12 0.22293 0.05543
---------------------------------------------------------------------------------------------------
The random part estimates at the l1id level:
Coef. Std. Err.
bcons_1 1.00000 0.00000
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Warning message:
NAs introduced by coercion
Any ideas what is going on?
Thanks
I am trying to specify an interaction term for a logistic ordered response model in R2mlwin. My response has three categories. I am trying to interact one continues variable and one factor level variable.
However, there is a strange behaviour when and where I add the extra term [1:2] to specify a common term.
1) When I only have the interaction term, with no main terms, the term is doing what it is supposed to:
(full.model.2_MCMC =runMLwiN(logit(AFgpWHO, cons, 3) ~ 1 + Price[1:2]:Mother_educ[1:2] + (1[1:2] | Region) ,
D='Ordered Multinomial', estoptions=list(mcmcMeth = list(iterations = 100000, burnin=5000), resi.store =T, EstM=0),data = df.sm))
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: 2.32) multilevel model (Multinomial)
N min mean max
Region 48 NA NA NA
Estimation algorithm: IGLS MQL1 Elapsed time : 0.81s
Number of obs: 10000 (from total 10000) The model converged after 5 iterations.
Log likelihood: NA
Deviance statistic: NA
---------------------------------------------------------------------------------------------------
The model formula:
logit(AFgpWHO, cons, 3) ~ 1 + Price[1:2]:Mother_educ[1:2] + (1[1:2] |
Region)
Level 2: Region Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval]
Intercept_A_multipleAF -1.06191 0.08840 -12.01 3.066e-33 *** -1.23517 -0.88864
Intercept_B_singel_AF 0.17232 0.08763 1.97 0.04926 * 0.00056 0.34407
Price:Mother_educPrimary_12 -0.07493 0.01378 -5.44 5.437e-08 *** -0.10194 -0.04791
Price:Mother_educSecondary_12 -0.13823 0.01375 -10.05 8.913e-24 *** -0.16518 -0.11128
Price:Mother_educHigher_12 -0.28135 0.02586 -10.88 1.424e-27 *** -0.33203 -0.23067
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
---------------------------------------------------------------------------------------------------
The random part estimates at the Region level:
Coef. Std. Err.
var_Intercept_12 0.24306 0.06032
---------------------------------------------------------------------------------------------------
The random part estimates at the l1id level:
Coef. Std. Err.
bcons_1 1.00000 0.00000
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
But when I add all the terms as one should. he r2mlwin function adds an extra price term (Price_1 or Price_12) where there should not be one: and the interactions disappear. Additionally, NAs: are introduced.
(runMLwiN(logit(AFgpWHO, cons, 3) ~ 1 + Mother_educ[1:2] + Price[1:2] + Price:Mother_educ[1:2] + (1[1:2] | Region) ,
D='Ordered Multinomial', estoptions=list(mcmcMeth = list(iterations = 100000, burnin=5000), resi.store =T, EstM=0),data = df.sm))
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: 2.32) multilevel model (Multinomial)
N min mean max
Region 48 NA NA NA
Estimation algorithm: IGLS MQL1 Elapsed time : 0.91s
Number of obs: 10000 (from total 10000) The model converged after 5 iterations.
Log likelihood: NA
Deviance statistic: NA
---------------------------------------------------------------------------------------------------
The model formula:
logit(AFgpWHO, cons, 3) ~ 1 + Mother_educ[1:2] + Price[1:2] +
Price:Mother_educ[1:2] + (1[1:2] | Region)
Level 2: Region Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval]
Intercept_A_multipleAF -1.12338 0.11775 -9.54 1.423e-21 *** -1.35417 -0.89260
Intercept_B_singel_AF 0.44594 0.10806 4.13 3.678e-05 *** 0.23415 0.65772
Price_12 -0.05842 0.01831 -3.19 0.001418 ** -0.09431 -0.02254
Price_1 0.08855 0.01969 4.50 6.889e-06 *** 0.04996 0.12715
Mother_educPrimary_12 -0.34320 0.05415 -6.34 2.33e-10 *** -0.44933 -0.23707
Mother_educSecondary_12 -0.62165 0.05651 -11.00 3.821e-28 *** -0.73242 -0.51089
Mother_educHigher_12 -1.18916 0.10245 -11.61 3.762e-31 *** -1.38995 -0.98837
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
---------------------------------------------------------------------------------------------------
The random part estimates at the Region level:
Coef. Std. Err.
var_Intercept_12 0.22293 0.05543
---------------------------------------------------------------------------------------------------
The random part estimates at the l1id level:
Coef. Std. Err.
bcons_1 1.00000 0.00000
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Warning message:
NAs introduced by coercion
Any ideas what is going on?
Thanks