Chapter 19, Section 19.5

 

Study of Log Progesterone Concentration during Menstrual Cycle

Mixed Model Representation of Semiparametric Regression Model for Log Progesterone Concentration

 

 

 

use "progesterone.dta"

 

local i 1

 

forvalues k=1(1)22  {

  2. gen bf_`i'=cond(time + 8 - `k' > 0, time + 8 - `k', 0)

  3. local ++i

  4. }

 

 

xtmixed logp group time c.group#c.time c.group#c.bf_15 || _all: bf_*, /// 

     noconstant covariance(identity) || id: time, covariance(unstr) reml 

 

Performing EM optimization: 

 

Performing gradient-based optimization: 

 

Iteration 0:   log restricted-likelihood = -1060.4749  

Iteration 1:   log restricted-likelihood = -1060.4749  

 

Computing standard errors:

 

Mixed-effects REML regression                   Number of obs      =      1130

 

-----------------------------------------------------------

                |   No. of       Observations per Group

 Group Variable |   Groups    Minimum    Average    Maximum

----------------+------------------------------------------

           _all |        1       1130     1130.0       1130

             id |       51          9       22.2         24

-----------------------------------------------------------

 

                                                Wald chi2(4)       =    169.65

Log restricted-likelihood = -1060.4749          Prob > chi2        =    0.0000

 

------------------------------------------------------------------------------

        logp |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

       group |   .1625838   .2322847     0.70   0.484    -.2926859    .6178535

        time |   .0165396   .0752332     0.22   0.826    -.1309147    .1639939

             |

     c.group#|

      c.time |  -.0478925   .0119262    -4.02   0.000    -.0712673   -.0245176

             |

     c.group#|

     c.bf_15 |   .2961574    .023245    12.74   0.000     .2505981    .3417168

             |

       _cons |   -.810215    .571292    -1.42   0.156    -1.929927    .3094968

------------------------------------------------------------------------------

 

------------------------------------------------------------------------------

  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]

-----------------------------+------------------------------------------------

_all: Identity               |

          sd(bf_1..bf_22)(1) |   .1272941   .0283529      .0822651    .1969704

-----------------------------+------------------------------------------------

id: Unstructured             |

                    sd(time) |   .0322555   .0042943      .0248474    .0418723

                   sd(_cons) |   .8109165   .0839387      .6620145    .9933098

            corr(time,_cons) |    .146714    .162931     -.1767088    .4415417

-----------------------------+------------------------------------------------

                sd(Residual) |   .5348411   .0118756      .5120645    .5586307

------------------------------------------------------------------------------

LR test vs. linear regression:       chi2(4) =  1313.88   Prob > chi2 = 0.0000

(1) bf_1 bf_2 bf_3 bf_4 bf_5 bf_6 bf_7 bf_8 bf_9 bf_10 bf_11 bf_12 bf_13 bf_14 bf_15 bf_16 bf_17 bf_18 bf_19 bf_20 bf_21 bf_22

 

 

predict b*, reffects level(_all)

 

predict b_slope b_interceptreffects level(id)

 

describe b1-b22 b_slope b_intercept 

 

              storage  display     value

variable name   type   format      label      variable label

-----------------------------------------------------------------------------

b1              float  %9.0g                  BLUP r.e. for _all: bf_1

b2              float  %9.0g                  BLUP r.e. for _all: bf_2

b3              float  %9.0g                  BLUP r.e. for _all: bf_3

b4              float  %9.0g                  BLUP r.e. for _all: bf_4

b5              float  %9.0g                  BLUP r.e. for _all: bf_5

b6              float  %9.0g                  BLUP r.e. for _all: bf_6

b7              float  %9.0g                  BLUP r.e. for _all: bf_7

b8              float  %9.0g                  BLUP r.e. for _all: bf_8

b9              float  %9.0g                  BLUP r.e. for _all: bf_9

b10             float  %9.0g                  BLUP r.e. for _all: bf_10

b11             float  %9.0g                  BLUP r.e. for _all: bf_11

b12             float  %9.0g                  BLUP r.e. for _all: bf_12

b13             float  %9.0g                  BLUP r.e. for _all: bf_13

b14             float  %9.0g                  BLUP r.e. for _all: bf_14

b15             float  %9.0g                  BLUP r.e. for _all: bf_15

b16             float  %9.0g                  BLUP r.e. for _all: bf_16

b17             float  %9.0g                  BLUP r.e. for _all: bf_17

b18             float  %9.0g                  BLUP r.e. for _all: bf_18

b19             float  %9.0g                  BLUP r.e. for _all: bf_19

b20             float  %9.0g                  BLUP r.e. for _all: bf_20

b21             float  %9.0g                  BLUP r.e. for _all: bf_21

b22             float  %9.0g                  BLUP r.e. for _all: bf_22

b_slope         float  %9.0g                  BLUP r.e. for id: time

b_intercept     float  %9.0g                  BLUP r.e. for id: _cons

 

 

list b1-b22 in 1                                    

 

     +--------------------------------------------------------------------------------------------------------+

  1. |        b1 |       b2 |       b3 |       b4  |       b5  |       b6  |      b7  |       b8  |       b9  |

     | -.0188028 | -.041519 | .0152155 | .0209336  | .1021353  | .0111908  | .073038  | .1204596  | .1345333  |

     |----------------------+---------------------------------------------------------------------------------|

     |      b10 |       b11 |       b12 |       b13 |       b14 |       b15 |       b16 |      b17 |      b18 |

     | .0857372 | -.1222687 | -.0596927 | -.1860888 | -.1398948 | -.1364576 | -.0712703 | .0815137 | .0401205 |

     |--------------------------------------------------------------------------------------------------------|

     |              b19        |              b20        |             b21         |              b22         |

     |        -.0421866        |        -.0159566        |        -.059587         |        -.0945905         |

     +--------------------------------------------------------------------------------------------------------+

 

 

list id b_intercept b_slope if (time == 0) 

 

      +----------------------------+

      | id   b_inter~t     b_slope |

      |----------------------------|

   9. |  1    1.042622    .0480065 |

  33. |  2    .0632171    .0039163 |

  55. |  3    .4821929    -.002078 |

  96. |  5    .3447452    .0072103 |

 113. |  6   -.1755748   -.0011255 |

      |----------------------------|

 135. |  7    -.773533   -.0172502 |

 155. |  8   -1.546915    .0181355 |

 178. |  9    .3440427   -.0033976 |

 200. | 10   -.5586036   -.0518299 |

 239. | 12   -.0961074   -.0061136 |

      |----------------------------|

 261. | 13    1.590588    .0276235 |

 281. | 14    1.256927    .0462825 |

 304. | 15   -.8486717     -.04028 |

 313. | 16    .4617817   -.0251528 |

 336. | 17    1.265509   -.0205968 |

      |----------------------------|

 359. | 18   -.0611754    .0272686 |

 380. | 19    -.489815    .0068096 |

 398. | 20    .2480679   -.0169893 |

 418. | 21   -1.659388   -.0081858 |

 440. | 22   -.4382117    .0123051 |

      |----------------------------|

 461. | 23    -1.40461   -.0430066 |

 484. | 24    .9932583   -.0116396 |

 508. | 25    .2524926   -.0016533 |

 532. | 26    -.868067   -.0249842 |

 556. | 27   -.3389031    .0188855 |

      |----------------------------|

 579. | 28   -.3572452    .0161927 |

 603. | 29    .4262464   -.0129535 |

 625. | 30   -.0119385    .0198855 |

 649. | 31    .3262692    .0049711 |

 673. | 32    .2951903    .0005212 |

      |----------------------------|

 697. | 33   -.0786787    .0157303 |

 720. | 34   -.0141162    .0158396 |

 744. | 35    .5447627    .0214898 |

 767. | 36    .2349261   -.0259866 |

 791. | 37   -1.106814   -.0165725 |

      |----------------------------|

 815. | 38    1.112673    .0112458 |

 839. | 39    .3800662   -.0408465 |

 863. | 40    .1573762    .0051524 |

 880. | 41    .0826845    .0213903 |

 904. | 42   -1.421825    .0630073 |

      |----------------------------|

 925. | 43   -.7307276   -.0148385 |

 949. | 44   -.4392257    .0056186 |

 973. | 45   -.9719065     .004091 |

 997. | 46    2.067266   -.0169515 |

1020. | 47   -.0666351     .012473 |

      |----------------------------|

1044. | 48   -.6482108    -.106966 |

1068. | 49    .4693395    .0030355 |

1092. | 50    .0196799    .0269524 |

1115. | 51   -.2001556   -.0092421 |

      +----------------------------+