Hi Matt,
Yes for the starting values. The two if lines give optimize() a positive starting point because the next line takes logs. In this example MIVQUE gives ā0.133333 for the random-intercept variance and 0.400000 for the residual variance. The optimizer therefore starts at (2/7, 0.4), with a positive random-intercept variance.
It is the exp(b[1]) in your evaluator that keeps the fitted random-intercept variance positive as the optimizer approaches zero. Your first screenshot prints it to six decimal places. You can see more of the result by changing the display format:
The separate call reml_ll(0, se2_null, y, X, Z) just asks what likelihood we get at zero. It does not pass zero to the optimizer. For these nine observations, all three groups have the same response pattern. The boundary fit gives su2 = 0, se2 = 2/7, and a restricted log likelihood of ā7.542391366. Your optimizer gets ā7.542391506, and mixed reports a random-intercept variance of 2.44eā9. So the agreement comes from both fits approaching the same boundary in this particular dataset.
Best wishes,
Yes for the starting values. The two if lines give optimize() a positive starting point because the next line takes logs. In this example MIVQUE gives ā0.133333 for the random-intercept variance and 0.400000 for the residual variance. The optimizer therefore starts at (2/7, 0.4), with a positive random-intercept variance.
It is the exp(b[1]) in your evaluator that keeps the fitted random-intercept variance positive as the optimizer approaches zero. Your first screenshot prints it to six decimal places. You can see more of the result by changing the display format:
Code:
printf("su2 = %21.14e\n", su2)
Best wishes,

Comment