RegressionTables.jl
RegressionTables.jl copied to clipboard
Document `make_estim_decorator()`
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 = falsebut 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.
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])
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.
@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!
@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.)
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.)
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.
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() )
Thanks. I think there is scope for documenting make_estim_decorator, so I'm going to leave this open.
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.
Agree - I saw these default settings it in the source code but it's definitely clearer/safer this way.