Announcement

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

  • collect layout

    Hi
    I'm trying to create a table of p values from multiple different tests (linear regression and Fisher's exact tests).

    I can easily get the p values from the linear regression which are stored and found easily. I do not know how to get the p values from the Fisher's exact tests to put into my table.

    Here is my code

    collect create Table1_pvals, replace
    foreach var of varlist age BMI dia_av sys_av {
    collect: regress `var' sex
    }
    foreach var of varlist diabetes smoking hypertension high_cholesterol {
    collect: tabulate `var' sex, exact
    }
    collect: regress lnlestot sex tiv
    collect label levels coleq age "age" BMI "BMI" dia_av "DBP" sys_av "SBP" diabetes "Diabetes" smoking "Smoking" hypertension "Hypertension" high_cholesterol "High cholesterol" lnlestot "logWMH", modify
    collect layout (colname [sex]#result[_r_p] [sex]#result[_r_p_exact]) (coleq), name(Table1_pvals)


    This is the error I get for the p values for the Fisher's exact tests:
    "(level _r_p_exact of dimension result not found)"

    How to I retrieve the p values for Fisher's exact test and put them in my table?

    Many thanks!

    Jo


  • #2
    r class results are overwritten by other estimation commands such as regress which also store results in r(). Perhaps you need

    Code:
    collect get r(p_exact), tags(dim1[result])

    Comment

    Working...
    X