Announcement

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

  • Ratios with p-values - how do i get them?

    I want to calculate the ratios between the different diets based on the margins, which is no problem. I want a p-value, which I cannot get. Can you help me?

    Click image for larger version

Name:	1.png
Views:	1
Size:	11.4 KB
ID:	1763629


    Option 1 – gives me ratios but no p-values.
    // Fit the model
    regress Ferritin_log i.Food_last_year BMI
    // Calculate marginal means and store them in the coefficient table (so nlcom can access them)
    margins i.Food_last_year, expression(exp(predict(xb))) post
    // Ratio of No_red_meat to Omnivore
    nlcom (ratio_no_red_meat_to_omnivore: M[1,2] / M[1,1])
    // Ratio of Pescetarian to Omnivore
    nlcom (ratio_pescetarian_to_omnivore: M[1,3] / M[1,1])
    // Ratio of Vegan/Vegetarian to Omnivore
    nlcom (ratio_vegan_veg_to_omnivore: M[1,4] / M[1,1])

    Option 2 – gives me an error message.
    // Fit the model
    regress Ferritin_log i.Food_last_year BMI
    // Calculate marginal means and store them in the coefficient table (so nlcom can access them)
    margins i.Food_last_year, expression(exp(predict(xb))) post
    // Ratio of No_red_meat to Omnivore
    nlcom (ratio_no_red_meat_to_omnivore: _b[2] / _b[1])
    // Ratio of Pescetarian to Omnivore
    nlcom (ratio_pescetarian_to_omnivore: _b[3] / _b[1])
    // Ratio of Vegan/Vegetarian to Omnivore
    nlcom (ratio_vegan_veg_to_omnivore: _b[4] / _b[1])

    Output:

    Click image for larger version

Name:	2.png
Views:	1
Size:	4.6 KB
ID:	1763630

  • #2
    Solved!!

    Comment


    • #3
      Congratulations! Please post your solution so others can benefit. Remember to use the the code fences (the # button)
      Code:
      put code here

      Comment

      Working...
      X