Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Impute missing data for -mixed- regression

    In a previous thread I outlined a study in which we measured the heart rate of embryos exposed to a drug at different graded pH levels. Heart rate and pH were measured before incubation, and after 1h incubation.

    In this part of the experiment, heart rate and pH were measured each hour over a 3h incubation period, that is at 0h, 1h, 2h, and 3h. Except pH was not measured at time=2h. This means that when I run -mixed- with measured pH as a covariate, the adjusted heart rate at 2h is not calculated.

    What is the best practice for filling in missing data like this?

    I have been looking at -hotdeck- as one possibility, but have read that
    There are more elaborate methods that ^only^ replace missing values, rather than the whole row, for imputed values.
    To give you an overview of the data, we essentially have three groups: those exposed to 0mM drug and 17.9mM NaHCO3 (neutral pH); those exposed to 6mM drug and 23.8mM NaHCO3 (neutral pH); and those exposed to 6mM drug and 16.1mM NaHCO3 (pH acidic by 0.2 units). Heart rate is given below:
    Click image for larger version

Name:	hr.png
Views:	1
Size:	38.5 KB
ID:	1403696


    And pH:
    Click image for larger version

Name:	ph.png
Views:	1
Size:	32.9 KB
ID:	1403697


    The value of pH at 2h could probably be estimated as the mean of 1h and 3h values, but am I introducing my own bias here? It could just as easily be the same as the value at 3h (i.e. linear reduc

    The data in wide and long format are given in the next posts.
    Stata 14.2MP
    OS X

  • #2
    long format:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int id byte time double sb byte conc int hr double ph float sb10
    9552 0 17.9 0 228 7.56 179
    9485 0 17.9 0 240 7.36 179
    9541 0 17.9 0 224 7.34 179
    9543 0 17.9 0 228 7.35 179
    9557 0 17.9 0 220 7.51 179
    9477 0 17.9 0 208  7.2 179
    9499 0 17.9 0 252 7.42 179
    9481 0 17.9 0 220 7.33 179
    9483 0 17.9 0 236 7.35 179
    9547 0 17.9 0 212  7.5 179
    9497 0 17.9 0 236 7.45 179
    9479 0 17.9 0 236 7.32 179
    9489 0 17.9 0 228 7.38 179
    9491 0 17.9 0 216 7.46 179
    9532 0 17.9 0 212 7.33 179
    9538 0 17.9 0 232 7.39 179
    9487 0 17.9 0 244 7.37 179
    9555 0 17.9 0 216 7.52 179
    9550 0 17.9 0 220 7.55 179
    9493 0 17.9 0 232 7.46 179
    9489 1 17.9 0 236 7.34 179
    9487 1 17.9 0 248 7.31 179
    9543 1 17.9 0 244 7.35 179
    9493 1 17.9 0 244 7.34 179
    9532 1 17.9 0 228  7.3 179
    9499 1 17.9 0 264 7.37 179
    9538 1 17.9 0 220 7.34 179
    9485 1 17.9 0 244  7.3 179
    9483 1 17.9 0 220 7.32 179
    9497 1 17.9 0 244 7.36 179
    9557 1 17.9 0 240 7.41 179
    9547 1 17.9 0 220 7.33 179
    9491 1 17.9 0 216  7.3 179
    9481 1 17.9 0 224 7.27 179
    9550 1 17.9 0 248 7.36 179
    9555 1 17.9 0 248  7.4 179
    9541 1 17.9 0 240 7.34 179
    9479 1 17.9 0 240 7.28 179
    9552 1 17.9 0 248 7.38 179
    9477 1 17.9 0 200 7.19 179
    9543 2 17.9 0 240    . 179
    9485 2 17.9 0 248    . 179
    9555 2 17.9 0 232    . 179
    9541 2 17.9 0 240    . 179
    9552 2 17.9 0 236    . 179
    9491 2 17.9 0 228    . 179
    9477 2 17.9 0 216    . 179
    9499 2 17.9 0 252    . 179
    9550 2 17.9 0 228    . 179
    9547 2 17.9 0 200    . 179
    9497 2 17.9 0 240    . 179
    9557 2 17.9 0 236    . 179
    9532 2 17.9 0 232    . 179
    9493 2 17.9 0 232    . 179
    9538 2 17.9 0 224    . 179
    9489 2 17.9 0 252    . 179
    9483 2 17.9 0 232    . 179
    9487 2 17.9 0 236    . 179
    9481 2 17.9 0 216    . 179
    9479 2 17.9 0 224    . 179
    9550 3 17.9 0 220 7.32 179
    9499 3 17.9 0 236 7.33 179
    9493 3 17.9 0 212 7.35 179
    9485 3 17.9 0 232 7.34 179
    9481 3 17.9 0 212 7.29 179
    9487 3 17.9 0 224 7.32 179
    9543 3 17.9 0 224 7.31 179
    9489 3 17.9 0 252 7.33 179
    9552 3 17.9 0 212 7.33 179
    9541 3 17.9 0 228 7.28 179
    9479 3 17.9 0 216 7.29 179
    9555 3 17.9 0 204 7.34 179
    9497 3 17.9 0 228 7.32 179
    9491 3 17.9 0 208 7.28 179
    9547 3 17.9 0 196  7.3 179
    9532 3 17.9 0 224 7.28 179
    9538 3 17.9 0 208 7.29 179
    9557 3 17.9 0 240 7.32 179
    9483 3 17.9 0 212 7.34 179
    9477 3 17.9 0 232 7.18 179
    9554 0 16.1 6 224 7.32 161
    9537 0 16.1 6 236 7.16 161
    9558 0 16.1 6 248 7.29 161
    9544 0 16.1 6 220 7.34 161
    9533 0 16.1 6 244 7.13 161
    9542 0 16.1 6 212 7.18 161
    9539 0 16.1 6 244 7.16 161
    9551 0 16.1 6 224 7.34 161
    9535 0 16.1 6 228 7.14 161
    9546 0 16.1 6 212 7.25 161
    9556 0 16.1 6 232 7.28 161
    9531 0 16.1 6 232 6.96 161
    9539 1 16.1 6 208 7.15 161
    9558 1 16.1 6 228 7.22 161
    9554 1 16.1 6 236 7.16 161
    9542 1 16.1 6 212 7.14 161
    9537 1 16.1 6 224 7.12 161
    9533 1 16.1 6 220 7.12 161
    9546 1 16.1 6 212 7.13 161
    9535 1 16.1 6 224 7.12 161
    9531 1 16.1 6 208 7.08 161
    9551 1 16.1 6 216 7.15 161
    9556 1 16.1 6 224 7.19 161
    9544 1 16.1 6 212 7.15 161
    9533 2 16.1 6 216    . 161
    9551 2 16.1 6 240    . 161
    9556 2 16.1 6 220    . 161
    9558 2 16.1 6 196    . 161
    9544 2 16.1 6 192    . 161
    9531 2 16.1 6 200    . 161
    9542 2 16.1 6 208    . 161
    9554 2 16.1 6 224    . 161
    9546 2 16.1 6 200    . 161
    9539 2 16.1 6 208    . 161
    9535 2 16.1 6 200    . 161
    9537 2 16.1 6 228    . 161
    9542 3 16.1 6 192  7.1 161
    9539 3 16.1 6 108 7.11 161
    9546 3 16.1 6 188 7.09 161
    9558 3 16.1 6 188 7.14 161
    9554 3 16.1 6 200 7.13 161
    9551 3 16.1 6 220 7.12 161
    9544 3 16.1 6 188 7.11 161
    9533 3 16.1 6 212 7.08 161
    9537 3 16.1 6 216  7.1 161
    9531 3 16.1 6 192 7.03 161
    9535 3 16.1 6 192 7.11 161
    9556 3 16.1 6 200 7.13 161
    9496 0 23.8 6 240 7.46 238
    9478 0 23.8 6 224 7.32 238
    9488 0 23.8 6 232 7.39 238
    9490 0 23.8 6 212 7.45 238
    9486 0 23.8 6 232 7.36 238
    9482 0 23.8 6 220 7.35 238
    9480 0 23.8 6 236 7.34 238
    9498 0 23.8 6 224 7.43 238
    9498 1 23.8 6 244 7.36 238
    9478 1 23.8 6 220 7.24 238
    9486 1 23.8 6 240 7.32 238
    9482 1 23.8 6 228 7.29 238
    9488 1 23.8 6 240 7.34 238
    9480 1 23.8 6 228 7.28 238
    9490 1 23.8 6 212  7.3 238
    9496 1 23.8 6 252 7.28 238
    9482 2 23.8 6 228    . 238
    9486 2 23.8 6 244    . 238
    9478 2 23.8 6 212    . 238
    9490 2 23.8 6 220    . 238
    9480 2 23.8 6 228    . 238
    9496 2 23.8 6 240    . 238
    9498 2 23.8 6 256    . 238
    9488 2 23.8 6 244    . 238
    9488 3 23.8 6 248 7.35 238
    9480 3 23.8 6 204 7.31 238
    9498 3 23.8 6 256 7.32 238
    9490 3 23.8 6 208 7.31 238
    9496 3 23.8 6 220 7.32 238
    9486 3 23.8 6 240  7.3 238
    9478 3 23.8 6 224 7.24 238
    9482 3 23.8 6 220 7.31 238
    end
    Last edited by Nigel Moore; 25 Jul 2017, 11:02.
    Stata 14.2MP
    OS X

    Comment


    • #3
      wide format:
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input int id double sb byte conc int(hr0 hr1 hr2 hr3) double(ph0 ph1) float ph2 double ph3
      9477 17.9 0 208 200 216 232  7.2 7.19 . 7.18
      9479 17.9 0 236 240 224 216 7.32 7.28 . 7.29
      9481 17.9 0 220 224 216 212 7.33 7.27 . 7.29
      9483 17.9 0 236 220 232 212 7.35 7.32 . 7.34
      9485 17.9 0 240 244 248 232 7.36  7.3 . 7.34
      9487 17.9 0 244 248 236 224 7.37 7.31 . 7.32
      9489 17.9 0 228 236 252 252 7.38 7.34 . 7.33
      9491 17.9 0 216 216 228 208 7.46  7.3 . 7.28
      9493 17.9 0 232 244 232 212 7.46 7.34 . 7.35
      9497 17.9 0 236 244 240 228 7.45 7.36 . 7.32
      9499 17.9 0 252 264 252 236 7.42 7.37 . 7.33
      9532 17.9 0 212 228 232 224 7.33  7.3 . 7.28
      9538 17.9 0 232 220 224 208 7.39 7.34 . 7.29
      9541 17.9 0 224 240 240 228 7.34 7.34 . 7.28
      9543 17.9 0 228 244 240 224 7.35 7.35 . 7.31
      9547 17.9 0 212 220 200 196  7.5 7.33 .  7.3
      9550 17.9 0 220 248 228 220 7.55 7.36 . 7.32
      9552 17.9 0 228 248 236 212 7.56 7.38 . 7.33
      9555 17.9 0 216 248 232 204 7.52  7.4 . 7.34
      9557 17.9 0 220 240 236 240 7.51 7.41 . 7.32
      9478 23.8 6 224 220 212 224 7.32 7.24 . 7.24
      9480 23.8 6 236 228 228 204 7.34 7.28 . 7.31
      9482 23.8 6 220 228 228 220 7.35 7.29 . 7.31
      9486 23.8 6 232 240 244 240 7.36 7.32 .  7.3
      9488 23.8 6 232 240 244 248 7.39 7.34 . 7.35
      9490 23.8 6 212 212 220 208 7.45  7.3 . 7.31
      9496 23.8 6 240 252 240 220 7.46 7.28 . 7.32
      9498 23.8 6 224 244 256 256 7.43 7.36 . 7.32
      9531 16.1 6 232 208 200 192 6.96 7.08 . 7.03
      9533 16.1 6 244 220 216 212 7.13 7.12 . 7.08
      9535 16.1 6 228 224 200 192 7.14 7.12 . 7.11
      9537 16.1 6 236 224 228 216 7.16 7.12 .  7.1
      9539 16.1 6 244 208 208 108 7.16 7.15 . 7.11
      9542 16.1 6 212 212 208 192 7.18 7.14 .  7.1
      9544 16.1 6 220 212 192 188 7.34 7.15 . 7.11
      9546 16.1 6 212 212 200 188 7.25 7.13 . 7.09
      9551 16.1 6 224 216 240 220 7.34 7.15 . 7.12
      9554 16.1 6 224 236 224 200 7.32 7.16 . 7.13
      9556 16.1 6 232 224 220 200 7.28 7.19 . 7.13
      9558 16.1 6 248 228 196 188 7.29 7.22 . 7.14
      end
      Stata 14.2MP
      OS X

      Comment


      • #4
        Originally posted by Nigel Moore View Post
        The value of pH at 2h could probably be estimated as the mean of 1h and 3h values, but am I introducing my own bias here? It could just as easily be the same as the value at 3h (i.e. linear reduc
        Hmm, my post seems to have been truncated at some point.

        The value of pH at 2h could probably be estimated as the mean of 1h and 3h values, but am I introducing my own bias here? It could just as easily be the same as the value at 3h (i.e. linear reduction to a plateau ca. 0.1 pH units lower than the value at t=0). I could also estimate the proper value through a best-fit curve. But is there a current best option from those with experience in this type of problem?

        Stata 14.2MP
        OS X

        Comment


        • #5
          From a purely statistical perspective, I don't think there is a best option here. I think you have to approach this from the perspective of the chemistry/biology of the problem. Why is the pH changing? What are the mechanisms that drive that, and how do they operate? What does that imply about the trajectory of pH between hours 1 and 3?

          Comment

          Working...
          X