Announcement

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

  • ttest with only one var and conditions

    Dear all.

    I cannot give you the data but my problem should be quite simple to understand.
    I'm working with medical data and I have a variable for the diagnostics (categorical variable). I also have a variable for a reimbursement procedure (also a categorical variable).
    Additionally, I have a value for total costs (let’s say in USD).
    Each of my IDs have these three values.

    I'm trying to see if the mean of my total costs for the diagnostics is equal to the mean of total costs for the corresponding reimbursement procedure.

    In other terms I want the null hypothesis:
    H0: mean(total costs for reimbursement code 1) = mean(total costs for diagnostic code 5).

    Of course a command like that doesn't work on STATA, but it's to illustrate better:

    ttest (total_costs if reim_code==1) == (total_costs if diag_code==5)

    I tried many things but can't find anything that worked.

    Thank you very much for your help.

    Alejandro

  • #2
    Dear all,

    I think I found the solution. I needed an option unpaired and that worked.
    To clarify for people that might have this issue one day.

    gen total_costs_diag5 = total_costs if diag_code==5
    gen total_costs_reim1 = total_costs if reim_code==1

    ttest total_costs_diag5 == total_costs_reim1, unpaired

    Comment


    • #3
      Alejandro:
      I would have added the -unequal- option to your code, unless you assume the equality of the variances of the two variables under comparison:
      Code:
      ttest total_costs_diag5 == total_costs_reim1, unpaired unequal
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        Originally posted by Carlo Lazzaro View Post
        Alejandro:
        I would have added the -unequal- option to your code, unless you assume the equality of the variances of the two variables under comparison:
        Code:
        ttest total_costs_diag5 == total_costs_reim1, unpaired unequal
        Thank you very much ! I didn't think about it but you are right!
        Have a good week-end. Good luck with the current situation in our respective countries.

        Comment


        • #5
          Alejandro:
          yes, we all do need a big dose of (very) good luck.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment

          Working...
          X