Announcement

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

  • Multiple groups

    Dear all,
    I'd like to compare multiple groups, hovewer I'm not able to find the exact syntasis. In particular, I'd like to conditionate the animal with diet 1 in experiment 1 and animal 1 in experiment 1 with diet 2. It sound like the following:


    ranksum area if animale==1|diet==1|exp==1 & if animale==1|diet==2|exp==2, by(exp)

    can you help me in find the exact syntasis

    regards

  • #2
    or maybe


    ranksum area if animale==1 in exp==1 in diet==1 & if animale==1 in diet==2 in
    exp==2, by(exp)

    Comment


    • #3
      If your two groups are say

      animals with diet 1 in experiment 1

      animals with diet 2 in experiment 2

      then you need to define groups

      Code:
       
      gen group = cond(diet==1 & experiment == 1, 1, cond(diet == 2 & experiment == 2, .)) 
      
      * or do it this way 
      gen group = . 
      replace group = 1 if diet == 1 & experiment == 1 
      replace group = 2 if diet == 2 & experiment == 2 
      
      ranksum area, by(group)
      If animale is a further categorical variable, then the syntax will change.

      The rules have to be that ranksum must be presented with a group variable defining just two distinct (non-missing) values.

      In general, you are going too fast. In order not to get into horrible messes, become clear that

      * if and in are quite different constructs. You can't mush the syntaxes together.

      * if is specified at most once in commands like these.

      * You are getting ands and ors the wrong way round.

      Code:
       
      animale==1 | diet==1 | exp==1
      should be (from the rest of your post)

      Code:
       
      animale==1 &  diet==1 & exp==1

      Comment


      • #4
        Dear Nick,
        thank you for your suggestion. I'll try..

        all the best
        Giovanni

        Comment

        Working...
        X