jacobadenbaum / TexTables.jl

Publication quality regression and statistical tables
Other
38 stars 7 forks source link

Is it possible to include confidence intervals? #39

Open jsimons8 opened 4 months ago

jsimons8 commented 4 months ago

Some regression coefficients cannot have a standard error in the usual sense but should come with intervals instead. Is it possible to construct those in place of SEs with TexTables?

jacobadenbaum commented 4 months ago

I'm not going to have time to work on this in the near future (see the note on this package's maintenance status in the readme) but I think this seems quite sensible, and I'll be happy to review/merge a PR that implements this so long as its tested properly and doesn't break any existing tests.

If anyone is interested in making a PR for this, my guess is that there's a couple of things that need to be done

  1. You probably want to make a new type (or update the existing one) of FNumSE to accommodate a range for the CI, rather than be hardcoded as a single number for the SE, as it is done currently. My guess is that a new type would be the easiest approach, as then it can all just be done by multiple dispatch, and you define the custom printing for se(x::FNumCI) like you can see here
  2. Then, I think all you'll need to do is update the StatsModel interface here to take an additional option
    • this probably requires updating the setcoef! function here
    • which relies on the setindex! logic for tables, so you can either construct the CI as an FNumCI there, or add extra dispatch logic directly here
  3. Then you'll need to see if it works (I may have missed something here -- it's been a long time since I wrote this code), make sure you haven't broken the existing tests, and write some new tests for the existing functionality. A lot of the tests for a package like this are done using hardcoded table examples, which it needs to replicate exactly. I have some helper functions to manage these table examples in the test suite which you might helpful.
jsimons8 commented 4 months ago

Thank you for giving a leg up in how to implement this. I am in a similar position as you are but this is great.

Maybe some Good Samaritan can pick this up? Thank you again and TexTables is such a great package!

On 29 Apr 2024, at 21:52, Jacob Adenbaum @.***> wrote:

I'm not going to have time to work on this in the near future (see the note on this package's maintenance status in the readme) but I think this seems quite sensible, and I'll happy to review/merge a PR that implements this so long as its tested properly and doesn't break any existing tests.

If anyone is interested in making a PR for this, my guess is that there's a couple of things that need to be done

  1. You probably want to make a new type (or update the existing one) of FNumSEhttps://github.com/jacobadenbaum/TexTables.jl/blob/88aa2bf56c74b9abd51fd110f49b23f780e923c0/src/FormattedNumbers.jl#L85 to accommodate a range for the CI, rather than be hardcoded as a single number for the SE, as it is done currently. My guess is that a new type would be the easiest approach, as then it can all just be done by multiple dispatch, and you define the custom printing for se(x::FNumCI) like you can see herehttps://github.com/jacobadenbaum/TexTables.jl/blob/88aa2bf56c74b9abd51fd110f49b23f780e923c0/src/FormattedNumbers.jl#L151C1-L152C1
  2. Then, I think all you'll need to do is update the StatsModel interface herehttps://github.com/jacobadenbaum/TexTables.jl/blob/88aa2bf56c74b9abd51fd110f49b23f780e923c0/src/StatsModelsInterface.jl#L96 to take an additional option
  3. Then you'll need to make sure you haven't broken the existing tests, and write some new tests for the existing functionality. A lot of the tests for a package like this are done using hardcoded table examples, which it needs to replicate exactly. I have some helper functionshttps://github.com/jacobadenbaum/TexTables.jl/blob/master/test/helper.jl to manage these table examples in the test suite which you might helpful.

— Reply to this email directly, view it on GitHubhttps://github.com/jacobadenbaum/TexTables.jl/issues/39#issuecomment-2083642096, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFRIOZSRWYNIGHZAFUMTQP3Y72XJ3AVCNFSM6AAAAABG6O6KE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGY2DEMBZGY. You are receiving this because you authored the thread.Message ID: @.***>