Announcement

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

  • generating a composite variable with a continous and a categorical variable

    Dear Statalist,

    To measure my dependent variable, I would like to generate a composite variable comprising of two variables - a continous and an ordinal categorical variable. The ordinal categorical variable ranges from 0 to 1. Please what is the right way of doing this?

    Thank you.

    Ikenna

  • #2
    Originally posted by Ikenna Egwu View Post
    what is the right way of doing this?
    Unless you know that the distance (however defined) between ordered categories is constant, then I suspect that there isn't one.

    You might be better off handling them in a model that keeps them as-is, for example using gsem.
    Code:
    version 16.1
    
    clear *
    
    set seed `=strreverse("1539915")'
    
    sysuse auto
    summarize rep78, meanonly
    quietly replace rep78 = runiformint(r(min), r(max)) if missing(rep78)
    
    // Something along these lines
    gsem (rep78 <- c.length, oprobit) (weight <- c.length), nocnsreport nodvheader nolog
    
    exit

    Comment


    • #3
      Alright, thanks

      Comment

      Working...
      X