Announcement

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

  • Hotelling command

    Dear all,

    I would like to compare underweight to overweight (x variable, dichotomous) people with regard to their leisure activities/health behaviour y1-y4 (all dichotomous). My plan was to use hotelling t² test. now I want to do this in 10 different countries.

    What I did was to use

    hotelling sports smoking TV sleep, by(underweight)

    This is of course now across all nations. I tried to use the if-command but as far as I understood, the hotelling command must not be combined with the if command.
    I Would be very happy if someone can explain me how I can perform the analysis for each country separately.

    I am also using manova and logistic commands but the hotelling command will be helpful as I want to produce a radar chart (probably in Excel).

    Thank you very much
    Anne!

  • #2
    See https://www.stata.com/support/faqs/d...-with-foreach/ for the background to this suggestion. If your country variable isn't called country, or you have a nation variable, then modify accordingly.

    Code:
    egen nation = group(country) , label 
    su nation, meanonly 
    
    forval j = 1/`r(max)' { 
    
    di "{title:`: label (nation) `j''}"
    * the quotation marks in order are DQ LSQ  LSQ RSQ RSQ DQ 
    * where DQ double quotation mark "
    *            LSQ left single quotation mark `
    *            RSQ right single quotation mark ' 
    di 
    hotelling sports smoking TV sleep if nation == `j', by(underweight)
    di 
    
    } 
    * brace closes loop
    I don't know what a radar chart would look like here, let alone how well it would work. As I understand it there are 2^4 possible cross-combinations, so a bar chart with up to 16 bars for frequencies would carry all the information.

    Here is an example of what elsewhere has been called an upsetplot on a loosely similar dataset (for biological reasons the 0 0 0 0 case does not appear).

    The idea is that a marker symbol in the matrix legend indicates 1 on that variable and absence of a marker indicates 0. In this case the most common case is gene families appearing in all four genomes. (Excuse any biological clumsiness here.)

    The code for this is being developed by Tim Morris and myself and is not yet public.

    Click image for larger version

Name:	anotherUP1.png
Views:	1
Size:	18.7 KB
ID:	1692431



    Comment


    • #3
      Thats perfect, thank you so much!!

      Best, Anne

      Comment

      Working...
      X