Announcement

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

  • Baseline table package showing p-value and statistics-value


    There has been some useful table1 package, such as table1 and table1_mc. However, they can not show the statistics value (Chi-square, t-value, and so on).

    Is there a package that covers this function like the below?

    Thank you!
    Click image for larger version

Name:	WeChat Screenshot_20220425094351.png
Views:	1
Size:	74.8 KB
ID:	1661316








  • #2
    Please give your example data using the dataex command. For us to provide meaningful feedback, you must provide your example data using the dataex command, the real data from an easily importable source (i.e., Github), or the equivalent of a toy example.
    Otherwise, anything we say is simply a waste of time. Note, that I'm not trying to be mean in saying this, I'm saying this because if we can't see your dataset as you do with a minimal worked example, anything we suggest is just guesswork. The reason that I'm emphasizing this is because questions like this one likely have a relatively simple fix, but even simple fixes can be wildly overcomplicated without a minimal worked example of a dataset and code that you've tried to accomplish your task.

    So please, provide us with your example data and code that encapsulates the problem.

    Comment


    • #3
      Originally posted by Jared Greathouse View Post
      Please give your example data using the dataex command. For us to provide meaningful feedback, you must provide your example data using the dataex command, the real data from an easily importable source (i.e., Github), or the equivalent of a toy example.
      Otherwise, anything we say is simply a waste of time. Note, that I'm not trying to be mean in saying this, I'm saying this because if we can't see your dataset as you do with a minimal worked example, anything we suggest is just guesswork. The reason that I'm emphasizing this is because questions like this one likely have a relatively simple fix, but even simple fixes can be wildly overcomplicated without a minimal worked example of a dataset and code that you've tried to accomplish your task.

      So please, provide us with your example data and code that encapsulates the problem.
      Thank you for your patience. The picture above is just from the website. I have provided another example below using the built-in dataset of auto. In this example, I want to describe price, weight and rep78 by foreign, and export the statistics and p-value. You can use the below code to import the dataset.
      Code:
      Code:
      sysuse auto
      Click image for larger version

Name:	WeChat Screenshot_20220425144337.png
Views:	1
Size:	21.1 KB
ID:	1661339


      Thank you!
      Last edited by Ya Chen; 25 Apr 2022, 01:51.

      Comment


      • #4
        Possibly the user community contributed package - table1_mc - is usefull, released by Mark Chatfield, a biostatistician at the University of Queensland:
        Code:
        ssc install table1_mc
        It was based on the original table1 program by Phil Clayton.

        I learned about it from this webpage of Timothy B. Plante.
        When pweights are involved he published code for that purpose on this web page.
        http://publicationslist.org/eric.melse

        Comment


        • #5
          Okay so we have our dataset, but now we gotta do the next thing I asked about, namely the code. We can't simply use the summarize command since this doesn't give p-values.

          So, once you have a Stata command that you want to use generate a certain set of statistics and table them, then we may proceed. I don't know if I follow the lower half of your table since I can't see how you made it, which is why I asked for both code and a dataset to work with.

          Comment


          • #6
            Originally posted by ericmelse View Post
            Possibly the user community contributed package - table1_mc - is usefull, released by Mark Chatfield, a biostatistician at the University of Queensland:
            Code:
            ssc install table1_mc
            It was based on the original table1 program by Phil Clayton.

            I learned about it from this webpage of Timothy B. Plante.
            When pweights are involved he published code for that purpose on this web page.
            Thank you. table1_mc is good at exporting the baseline table. However, it can not export statistics values (Chi-square, t-value, and so on) on the table.

            Comment


            • #7
              Originally posted by Jared Greathouse View Post
              Okay so we have our dataset, but now we gotta do the next thing I asked about, namely the code. We can't simply use the summarize command since this doesn't give p-values.

              So, once you have a Stata command that you want to use generate a certain set of statistics and table them, then we may proceed. I don't know if I follow the lower half of your table since I can't see how you made it, which is why I asked for both code and a dataset to work with.
              Sorry. The code is below. Thank you!

              Code:
              sysuse auto, clear
              table1_mc, by(foreign) vars(price conts \ weight contn \ rep78 cat) onecol format(%9.2f) nformat(%12.0f) percformat(%9.2f) sdleft(" ± ") sdright("") nospace

              Comment

              Working...
              X