. webuse orange . twoway scatter circumf age, connect(L) ylabel(#6)
. menl circumf = {phi1}/(1+exp(-(age-{phi2})/{phi3})), stddeviations Obtaining starting values: NLS algorithm: Iteration 0: residual SS = 17480.234 Iteration 1: residual SS = 17480.234 Computing standard errors: Mixed-effects ML nonlinear regression Number of obs = 35 Log Likelihood = -158.39871 ------------------------------------------------------------------------------ circumf | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- /phi1 | 192.6876 20.24411 9.52 0.000 153.0099 232.3653 /phi2 | 728.7564 107.2984 6.79 0.000 518.4555 939.0573 /phi3 | 353.5337 81.47184 4.34 0.000 193.8518 513.2156 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ sd(Residual) | 22.34805 2.671102 17.68079 28.24734 ------------------------------------------------------------------------------
. menl circumf = {phi1}/(1+exp(-(age-{phi2})/{phi3}))+{U[tree]}, stddev Obtaining starting values by EM: Alternating PNLS/LME algorithm: Iteration 1: linearization log likelihood = -147.631786 Iteration 2: linearization log likelihood = -147.631786 Computing standard errors: Mixed-effects ML nonlinear regression Number of obs = 35 Group variable: tree Number of groups = 5 Obs per group: min = 7 avg = 7.0 max = 7 Linearization log likelihood = -147.63179 ------------------------------------------------------------------------------ circumf | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- /phi1 | 192.2526 17.06127 11.27 0.000 158.8131 225.6921 /phi2 | 729.3642 68.05493 10.72 0.000 595.979 862.7494 /phi3 | 352.405 58.25042 6.05 0.000 238.2363 466.5738 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ tree: Identity | sd(U) | 17.65093 6.065958 8.999985 34.61732 -----------------------------+------------------------------------------------ sd(Residual) | 13.7099 1.76994 10.64497 17.65728 ------------------------------------------------------------------------------
. menl circumf = {phi1}/(1+exp(-(age-{phi2})/{phi3})), rescovariance(exchangeable, group(tree)) stddev Obtaining starting values: Alternating GNLS/ML algorithm: Iteration 1: log likelihood = -147.632441 Iteration 2: log likelihood = -147.631786 Iteration 3: log likelihood = -147.631786 Iteration 4: log likelihood = -147.631786 Computing standard errors: Mixed-effects ML nonlinear regression Number of obs = 35 Group variable: tree Number of groups = 5 Obs per group: min = 7 avg = 7.0 max = 7 Log Likelihood = -147.63179 ------------------------------------------------------------------------------ circumf | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- /phi1 | 192.2526 17.06127 11.27 0.000 158.8131 225.6921 /phi2 | 729.3642 68.05493 10.72 0.000 595.979 862.7494 /phi3 | 352.405 58.25042 6.05 0.000 238.2363 466.5738 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ Residual: Exchangeable | sd | 22.34987 4.87771 14.57155 34.28026 corr | .6237137 .1741451 .1707327 .8590478 ------------------------------------------------------------------------------
. menl circumf = ({b1}+{U1[tree]})/(1+exp(-(age-{phi2})/{phi3})) Obtaining starting values by EM: Alternating PNLS/LME algorithm: Iteration 1: linearization log likelihood = -131.584579 Computing standard errors: Mixed-effects ML nonlinear regression Number of obs = 35 Group variable: tree Number of groups = 5 Obs per group: min = 7 avg = 7.0 max = 7 Linearization log likelihood = -131.58458 ------------------------------------------------------------------------------ circumf | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- /b1 | 191.049 16.15403 11.83 0.000 159.3877 222.7103 /phi2 | 722.556 35.15082 20.56 0.000 653.6616 791.4503 /phi3 | 344.1624 27.14739 12.68 0.000 290.9545 397.3703 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ tree: Identity | var(U1) | 991.1514 639.4636 279.8776 3510.038 -----------------------------+------------------------------------------------ var(Residual) | 61.56371 15.89568 37.11466 102.1184 ------------------------------------------------------------------------------
. menl circumf = ({b1}+{U1[tree]})/(1+exp(-(age-{phi2})/{phi3})), rescovariance(exchangeable) Obtaining starting values by EM: Alternating PNLS/LME algorithm: Iteration 1: linearization log likelihood = -131.468559 Iteration 2: linearization log likelihood = -131.470388 Iteration 3: linearization log likelihood = -131.470791 Iteration 4: linearization log likelihood = -131.470813 Iteration 5: linearization log likelihood = -131.470813 Computing standard errors: Mixed-effects ML nonlinear regression Number of obs = 35 Group variable: tree Number of groups = 5 Obs per group: min = 7 avg = 7.0 max = 7 Linearization log likelihood = -131.47081 ------------------------------------------------------------------------------ circumf | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- /b1 | 191.2005 15.59015 12.26 0.000 160.6444 221.7566 /phi2 | 721.5232 35.66132 20.23 0.000 651.6283 791.4182 /phi3 | 344.3675 27.20839 12.66 0.000 291.0401 397.695 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ tree: Identity | var(U1) | 921.3895 582.735 266.7465 3182.641 -----------------------------+------------------------------------------------ Residual: Exchangeable | var | 54.85736 14.16704 33.06817 91.00381 cov | -9.142893 2.378124 -13.80393 -4.481856 ------------------------------------------------------------------------------
. menl circumf = {phi1:}/(1+exp(-(age-{phi2:})/{phi3:})), define(phi1:{b1}+{U1[tree]}) define(phi2:{b2}+{U2[tree]}) define(phi3:{b3}+{U3[tree]}) (output omitted)
. predict (phi1 = {phi1:}) (output omitted)
. menl circumf = {phi1:}/(1+exp(-(age-{phi2:})/{phi3:})), define(phi1:{b1}+{U1[tree]}) define(phi2:{b2}+{U2[tree]}) define(phi3:{b3}+{U3[tree]}) covariance(U1 U2 U3, unstructured) (output omitted)
- Draper, N., and H. Smith. 1998. Applied Regression Analysis. 3rd ed. New York: Wiley.
- Pinheiro, J. C., and D. M. Bates. 2000. Mixed-Effects Models in S and S-PLUS. New York: Springer.