Dear,
Hello, I have a problem with the output of a binary model in R2MLwiN. I have recoded an ordered level1 variable (1<2<3<4) and input it for a three level binary model using MCMC. In the output, it only shows the coefficient of its reference level but not of other three levels as for unordered categorical variables. Just wander why this happened and how to explain it if it is right. I have listed the results for your reference. Many thanks.
> r_temp.df$coef
est se stat p lwr upr ess
FP_Intercept 1.2461333 2.677351e01 4.6543512 3.250025e06 1.762658028 0.7756006 73.06440
FP_Age_1524 0.1464940 3.333534e01 0.4394556 6.603315e01 0.829658486 0.4840200 511.57278
RP3_var_Intercept 0.2920189 5.101553e01 0.5724117 5.670431e01 0.001720491 1.7420080 45.11112
RP2_var_Intercept 3.9726860 9.247642e01 4.2958908 1.739932e05 2.442040654 6.0415510 368.77411
RP1_var_bcons_1 0.9999998 1.414214e05 70710.6639765 0.000000e+00 1.000000000 1.0000000 5000.00000
> result_b2.df[[1]]$contrasts
$Age.f
.L .Q .C
1 0.6708204 0.5 0.2236068
2 0.2236068 0.5 0.6708204
3 0.2236068 0.5 0.6708204
4 0.6708204 0.5 0.2236068
Regards.
Diva
Question about the recoded level1 variables

 Posts: 1094
 Joined: Mon Oct 19, 2009 10:34 am
Re: Question about the recoded level1 variables
Is this variable defined as a factor within R? If not then it will be treated as continuous. For an example of this kind of model see http://www.bristol.ac.uk/cmm/media/r2ml ... CGuide10.R (the lc variable has four categories with the values 0: no children, 1: one child, 2: two children, 3: three or more children).
Re: Question about the recoded level1 variables
Thanks, Chris.
The "Age" here is an ordered factor, and I have recorded it using Polynomial Coding, and there is also this function in MLwiN. And once I tick this choice when I add the individual variable, the result shows that it only estimates the coefficient of reference level (e.g. Here I defined "Age_1524" as the reference level of "Age", then it only shows the coefficient of Age_1524. Does that mean I can not record categorical variable like this? Because I have a set of categorical individual variables, I recorded them just for the grand mean and wave their possible influences on the estimations of other variables.
> r_temp.df$coef
est se stat p lwr upr ess
FP_Intercept 1.2461333 2.677351e01 4.6543512 3.250025e06 1.762658028 0.7756006 73.06440
FP_Age_1524 0.1464940 3.333534e01 0.4394556 6.603315e01 0.829658486 0.4840200 511.57278
RP3_var_Intercept 0.2920189 5.101553e01 0.5724117 5.670431e01 0.001720491 1.7420080 45.11112
RP2_var_Intercept 3.9726860 9.247642e01 4.2958908 1.739932e05 2.442040654 6.0415510 368.77411
RP1_var_bcons_1 0.9999998 1.414214e05 70710.6639765 0.000000e+00 1.000000000 1.0000000 5000.00000
And as I build up a threelevel model (individual, subdistrict, district), when I try to explore the random effects of individual variables at level2, the results only tells me the random effect is 0.000000000. Does that mean there is no random effect of this variable or maybe it was not estimated in the model? Many thanks.
RP3_var_Intercept RP2_var_Intercept RP2_cov_Intercept_ICAge4 RP2_var_ICAge4 RP1_var_bcons_1
RP3_var_Intercept 0.09577996 0.05865885 0 0 0
RP2_var_Intercept 0.05865885 0.49250499 0 0 0
RP2_cov_Intercept_Age_1524 0.00000000 0.00000000 0 0 0
RP2_var_Age_1524 0.00000000 0.00000000 0 0 0
RP1_var_bcons_1 0.00000000 0.00000000 0 0 0
Best.
Diva
The "Age" here is an ordered factor, and I have recorded it using Polynomial Coding, and there is also this function in MLwiN. And once I tick this choice when I add the individual variable, the result shows that it only estimates the coefficient of reference level (e.g. Here I defined "Age_1524" as the reference level of "Age", then it only shows the coefficient of Age_1524. Does that mean I can not record categorical variable like this? Because I have a set of categorical individual variables, I recorded them just for the grand mean and wave their possible influences on the estimations of other variables.
> r_temp.df$coef
est se stat p lwr upr ess
FP_Intercept 1.2461333 2.677351e01 4.6543512 3.250025e06 1.762658028 0.7756006 73.06440
FP_Age_1524 0.1464940 3.333534e01 0.4394556 6.603315e01 0.829658486 0.4840200 511.57278
RP3_var_Intercept 0.2920189 5.101553e01 0.5724117 5.670431e01 0.001720491 1.7420080 45.11112
RP2_var_Intercept 3.9726860 9.247642e01 4.2958908 1.739932e05 2.442040654 6.0415510 368.77411
RP1_var_bcons_1 0.9999998 1.414214e05 70710.6639765 0.000000e+00 1.000000000 1.0000000 5000.00000
And as I build up a threelevel model (individual, subdistrict, district), when I try to explore the random effects of individual variables at level2, the results only tells me the random effect is 0.000000000. Does that mean there is no random effect of this variable or maybe it was not estimated in the model? Many thanks.
RP3_var_Intercept RP2_var_Intercept RP2_cov_Intercept_ICAge4 RP2_var_ICAge4 RP1_var_bcons_1
RP3_var_Intercept 0.09577996 0.05865885 0 0 0
RP2_var_Intercept 0.05865885 0.49250499 0 0 0
RP2_cov_Intercept_Age_1524 0.00000000 0.00000000 0 0 0
RP2_var_Age_1524 0.00000000 0.00000000 0 0 0
RP1_var_bcons_1 0.00000000 0.00000000 0 0 0
Best.
Diva

 Posts: 1094
 Joined: Mon Oct 19, 2009 10:34 am
Re: Question about the recoded level1 variables
Would it be possible to provide some example syntax so that I can attempt to replicate what you are seeing?
Re: Question about the recoded level1 variables
Dear Chris,
Thanks. I have read the manual you mentioned, and I think maybe R2MLwiN would treat ordered factors as unordered categorical factors. In my case, as the predictor is not a strict ordered factor (e.g. one level of "Age" is 55+), thus I could just treat it as unordered categorical factors. Many thanks.
Regards.
Diva
Thanks. I have read the manual you mentioned, and I think maybe R2MLwiN would treat ordered factors as unordered categorical factors. In my case, as the predictor is not a strict ordered factor (e.g. one level of "Age" is 55+), thus I could just treat it as unordered categorical factors. Many thanks.
Regards.
Diva