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

Markdown show methods for our types #474

Merged
merged 24 commits into from
Feb 26, 2021
Merged

Markdown show methods for our types #474

merged 24 commits into from
Feb 26, 2021

Conversation

palday
Copy link
Member

@palday palday commented Feb 25, 2021

Closes #273.

Needs tests.

I've marked this for v3.2 in the NEWS file and will do the necessary backport as soon as this is merged.

There's no method for CoefTable because that would be type piracy. I'll make an upstream PR.

The Markdown tables for the models are compact. This is intentional -- I think this is journal/publication friendlier and also makes them true Markdown tables. If we decide to add in LaTeX methods, this will also be convenient. The measures of fit (log likelihood, deviance, AIC, BIC) can be extracted separately and if someone really wants to fight with a journal, then they can assemble the pieces from the VarCorr and CoefTable methods.

OptSummary was low-hanging fruit, so I've included it. PCA seems fiddly won't be a single table anyway, so I've omitted it. (I also don't expect most people to include that in published work, so it really didn't seem like the effort.)

BlockDescription

rows subj fixed
36 BlkDiag
2 Dense Dense
rows subj item fixed
316 Diagonal
24 Dense Diag/Dense
6 Dense Dense Dense

LikelihoodRatioTest

model-dof deviance χ² χ²-dof P(>χ²)
reaction ~ 1 + days + (1 | subj) 4 1794
reaction ~ 1 + days + (1 + days | subj) 6 1752 42 2 <1e-09

MixedModel

Est. SE z p σ_subj
(Intercept) 251.4051 9.506187 26.45 <1e-99 36.0121
days 10.4673 0.801735 13.06 <1e-38
Residual 30.89543
Est. SE z p σ_subj
(Intercept) 251.4051 6.63226 37.91 <1e-99 23.78047
days 10.4673 1.50224 6.97 <1e-11 5.71683
Residual 25.59182
Est. SE z p σ_subj σ_item
(Intercept) 0.1955555 0.405190 0.48 0.6294 1.339766 0.495305
anger 0.0575541 0.016758 3.43 0.0006
gender: M 0.3207844 0.191266 1.68 0.0935
btype: scold -1.0582595 0.256805 -4.12 <1e-04
btype: shout -2.1047525 0.258529 -8.14 <1e-15
situ: self -1.0549790 0.210303 -5.02 <1e-06

OptSummary

Initialization
Initial parameter vector [1.0, 0.0, 1.0]
Initial objective value 1784.642296192471
Optimizer settings
Optimizer (from NLopt) LN_BOBYQA
Lower bounds [0.0, -Inf, 0.0]
ftol_rel 1.0e-12
ftol_abs 1.0e-8
xtol_rel 0.0
xtol_abs [1.0e-10, 1.0e-10, 1.0e-10]
initial_step [0.75, 1.0, 0.75]
maxfeval -1
Result
Function evaluations 1
Final parameter vector [0.9292, 0.0182, 0.2226]
Final objective value 1751.9393
Return code FTOL_REACHED

VarCorr

Column Variance Std.Dev. Corr.
subj (Intercept) 565.51069 23.78047
days 32.68212 5.71683 +0.08
Residual 654.94145 25.59182

@codecov
Copy link

codecov bot commented Feb 25, 2021

Codecov Report

Merging #474 (ccf8569) into master (2e23253) will increase coverage by 0.65%.
The diff coverage is 98.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #474      +/-   ##
==========================================
+ Coverage   92.84%   93.49%   +0.65%     
==========================================
  Files          26       27       +1     
  Lines        1746     1906     +160     
==========================================
+ Hits         1621     1782     +161     
+ Misses        125      124       -1     
Impacted Files Coverage Δ
src/MixedModels.jl 100.00% <ø> (ø)
src/blockdescription.jl 100.00% <ø> (ø)
src/randomeffectsterm.jl 96.72% <95.45%> (+2.60%) ⬆️
src/mdshow.jl 98.62% <98.62%> (ø)
src/generalizedlinearmixedmodel.jl 88.23% <100.00%> (+0.44%) ⬆️
src/likelihoodratiotest.jl 98.68% <100.00%> (+0.01%) ⬆️
src/linearmixedmodel.jl 94.30% <100.00%> (-0.02%) ⬇️
src/mixedmodel.jl 83.33% <100.00%> (+1.51%) ⬆️
src/optsummary.jl 100.00% <100.00%> (ø)
src/pca.jl 97.95% <100.00%> (+2.04%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36dcd73...5741d91. Read the comment docs.

@palday palday requested a review from dmbates February 26, 2021 12:35
@palday palday mentioned this pull request Feb 26, 2021
Copy link
Collaborator

@dmbates dmbates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me. Thanks very much for doing this - formatting output is one of my least favorite parts of coding - probably tracing back to needing to write Fortran FORMAT statements in my youth.

src/pca.jl Show resolved Hide resolved
@palday palday merged commit f81ccbc into master Feb 26, 2021
@palday palday deleted the pa/show branch February 26, 2021 16:23
palday added a commit that referenced this pull request Feb 26, 2021
* specify plain-text MIME in show methods

* remove redudant method

* markdown show method for VarCorr

* show md blockdescription

* broaden size to work on GLMM

* show md method for MixedModel

* show method for LikelihoodRatioTest

* NEWS entry

* remove unused padding computation

* more usage notes

* not gonna PCA afterall

* remove unused and problematic digits kwarg

* optsummary

* tests

* disable BLAS info on 1.7

* better plain-text readability of markdown for MixedModel, BlockDescription

* force a particular model fit in tests

* fix future guard

* more forcing fit results for textual comparison

* helps if you save your changes

* format tweak

* whyyyy

* variability in printing exponent

(cherry picked from commit f81ccbc)
palday added a commit that referenced this pull request Feb 26, 2021
* Markdown show methods for our types (#474)

* specify plain-text MIME in show methods

* remove redudant method

* markdown show method for VarCorr

* show md blockdescription

* broaden size to work on GLMM

* show md method for MixedModel

* show method for LikelihoodRatioTest

* NEWS entry

* remove unused padding computation

* more usage notes

* not gonna PCA afterall

* remove unused and problematic digits kwarg

* optsummary

* tests

* disable BLAS info on 1.7

* better plain-text readability of markdown for MixedModel, BlockDescription

* force a particular model fit in tests

* fix future guard

* more forcing fit results for textual comparison

* helps if you save your changes

* format tweak

* whyyyy

* variability in printing exponent

(cherry picked from commit f81ccbc)

* version bump
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

Successfully merging this pull request may close these issues.

show methods for other MIME types
2 participants