Announcement

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

  • How to create restricted cubic splines in an imputed dataset

    I have a dataset with a variable v1 with some missing data. I would like to impute 10 datasets and then generate restricted cubic splines variables for v1 to then use them in a model on the imputed datasets. Example code below. Many thanks in advance.

    Code:
    set seed 123    
    mi set wide
    mi register imputed v1 v2
    
    local var_list outcome v3 v4 v5
    
    mi impute chained (regress) v1 (ologit) v2 = `var_list', add(5)
    
    *I would like to generate the splines here, using rcsgen, but don't seem to be able to generate them in a way that stata recognises them in the next line
    
    mi estimate, or: logistic outcome v1_rcs v2 v3 v4 v5
Working...
X