Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document make_estim_decorator() #81

Open
jo-fleck opened this issue Nov 2, 2020 · 10 comments
Open

Document make_estim_decorator() #81

jo-fleck opened this issue Nov 2, 2020 · 10 comments

Comments

@jo-fleck
Copy link

jo-fleck commented Nov 2, 2020

Thanks a lot for this useful package!

I cannot figure out two (newbie) questions related to estim_decoration from the readme and closed issues:

  • How can I disable this function so that no stars are printed? I tried estim_decoration = false but this didn't work for me.

  • How can I adjust the significance rules (so that e.g. * p<0.1)? I checked the source code and I am wondering if there is a direct way to pass the adjusted rules.

Many thanks for helping with this.

@greimel
Copy link
Collaborator

greimel commented Nov 2, 2020

Can you try

estim_decoration = RegressionTables.make_estim_decorator(breaks=[], sym="")

and report back?

EDIT: If that throws an error, you might need to add some non-empty breaks (breaks = [0.0])

@jmboehm
Copy link
Owner

jmboehm commented Nov 2, 2020

As the readme says, estim_decoration is a function that takes the value and the p-statistic as argument, and produces the formatted string.

regtable(rr1,rr2,rr3,rr4; renderSettings = asciiOutput(), estim_decoration= (v,p) -> "$v")

therefore produces no formatting. The function that @greimel suggests above is a helper to produce such functions.

Generally, it's better to ask questions on how to use packages on Discourse and leave Github issues for bug reports and improvement suggestions.

@jo-fleck
Copy link
Author

jo-fleck commented Nov 2, 2020

@greimel

It seems both throw the same error. (Am I including the command as you expect?)

regtable(table2_C_tot; renderSettings = latexOutput(), estim_decoration = RegressionTables.make_estim_decorator(breaks=[], sym=""))
ERROR: MethodError: no method matching make_estim_decorator(::Array{Float64,1}, ::Char; breaks=Any[], sym="")

regtable(table2_C_tot; renderSettings = latexOutput(), estim_decoration = RegressionTables.make_estim_decorator(breaks=[0.0], sym=""))
ERROR: MethodError: no method matching make_estim_decorator(::Array{Float64,1}, ::Char; breaks=[0.0], sym="")

Thanks a lot!

@jo-fleck
Copy link
Author

jo-fleck commented Nov 2, 2020

@jmboehm

Thanks for the explanation and the Discourse link!

It might be useful to clarify and illustrate the (non-default) use of estim_decoration in the readme. (Maybe it's just helpful for me but since the use of 'significance stars' varies a lot, customization could be useful for a wider audience.)

@jo-fleck
Copy link
Author

jo-fleck commented Nov 3, 2020

Quick follow up:

This does what I was after:
regtable(table2_C_tot; renderSettings = latexOutput(), estim_decoration = make_estim_decorator() )

Thanks to both of you!

(@jmboehm If you think it's useful, I'll be happy to help updating the readme.)

@greimel
Copy link
Collaborator

greimel commented Nov 3, 2020

I am surprised that your solution works.

using RegressionTables, DataFrames, FixedEffectModels, RDatasets

df = dataset("datasets", "iris")
df[!,:SpeciesDummy] = categorical(df[!,:Species])

rr1 = reg(df, @formula(SepalLength ~ SepalWidth + fe(SpeciesDummy)))

regtable(rr1, renderSettings = latexOutput(), estim_decoration = make_estim_decorator())

produces stars for me (at least in the source code, probably they are omitted in the compiled document because stars cannot be displayed in text-mode). These two, however, don't:

regtable(rr1, renderSettings = latexOutput(), estim_decoration = make_estim_decorator([], "")
regtable(rr1, renderSettings = latexOutput(), estim_decoration = (v,p) -> "$v") # as suggested by @jmboehm 

I would follow @jmboehm's suggestion because make_estim_decorator is undocumented and thus subject to change.

@jo-fleck
Copy link
Author

jo-fleck commented Nov 3, 2020

Sorry for the confusion. To clarify and relate back to my questions:

How can I disable this function so that no stars are printed?

  • regtable(rr1, renderSettings = latexOutput(), estim_decoration = (v,p) -> "$v") # as suggested by @jmboehm

How can I adjust the significance rules (so that e.g. * p<0.1)?

  • regtable(rr1; renderSettings = latexOutput(), estim_decoration = make_estim_decorator() )

@jmboehm
Copy link
Owner

jmboehm commented Nov 3, 2020

Thanks. I think there is scope for documenting make_estim_decorator, so I'm going to leave this open.

@jmboehm jmboehm changed the title Customizing estim_decoration Document make_estim_decorator() Nov 3, 2020
@greimel
Copy link
Collaborator

greimel commented Nov 3, 2020

Ah, I see.

In that case better use

regtable(rr1, renderSettings = latexOutput(), estim_decoration = make_estim_decorator([0.01, 0.05, 0.1])

before make_estim_decorator is documented. Your version relies on the default value for the first argument which might change in the process of documenting the function.

@jo-fleck
Copy link
Author

jo-fleck commented Nov 3, 2020

Agree - I saw these default settings it in the source code but it's definitely clearer/safer this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants