Announcement

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

  • Generating MAR and MNAR datasets

    Hi,
    I would like to generate from a full dataset with an outcome variable y and a single predictor x with 2 levels (0/1) other datasets with different proportions and patterns of missing data.
    My aim is to compare the y between the 2 levels of x under different proportions and types of missingness and plot how the results vary.
    I would need 2x5 datasets that contain missing values that are MAR and MNAR respectively with proportion of missing at 10%, 20%,30%,40% and 50%.
    Any help to set up the code would be greatly appreciated.
    Thank you,
    Nikos
    Last edited by Nikolaos Pandis; 03 Nov 2019, 05:17.

  • #2
    Nikolaos:
    https://www.guilford.com/books/Missi.../9781593853938, Chapter 3 offers a worked out example of what you're after.
    That said, something along the following lines might be what you want to create with Stata:
    Code:
    use "C:\Program Files (x86)\Stata15\ado\base\a\auto.dta"
    . g mpg_MAR=mpg
    
    . replace mpg_MAR=. if price>=12000
    (5 real changes made, 5 to missing)
    
    . g mpg_MNAR=mpg
    
    . replace mpg_MNAR=. if mpg_MNAR>=35
    (3 real changes made, 3 to missing)
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,
      Thank you for your message and the link.
      Best wishes,
      Nikos

      Comment

      Working...
      X