Skip to content

Commit e3006f2

Browse files
committed
Adjust show method for fitted models
Only show the coefficients instead of the full coefficients table. At the time of the fitting, the user cannot pass arguments related to inference such as the level of the confidence interval, so it is better to only show this output when calling coeftable explicitly. Also, include the distribution family and link function when fitting glms as well as include the number of observations, the residual degrees of freedom and the residual deviance in the output. Adjust the show method to include MIME"text/plain" as it is producing "decorated" output. Finally, explicitly test the show method agaist reference output instead of just writing it to an IOBuffer.
1 parent c5e2b2a commit e3006f2

File tree

5 files changed

+636
-150
lines changed

5 files changed

+636
-150
lines changed

docs/src/api.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,34 @@ julia> using RDatasets
2626
2727
julia> df = RDatasets.dataset("mlmRev", "Oxboys");
2828
29-
julia> fit(LinearModel, hcat(ones(nrow(df)), df.Age), df.Height)
29+
julia> fit(LinearModel, @formula(Height ~ Age), df)
3030
LinearModel
3131
32+
Formula: Height ~ 1 + Age
33+
3234
Coefficients:
33-
─────────────────────────────────────────────────────────────────
34-
Coef. Std. Error t Pr(>|t|) Lower 95% Upper 95%
35-
─────────────────────────────────────────────────────────────────
36-
x1 149.372 0.528565 282.60 <1e-99 148.33 150.413
37-
x2 6.52102 0.816987 7.98 <1e-13 4.91136 8.13068
38-
─────────────────────────────────────────────────────────────────
35+
(Intercept) Age
36+
149.4 6.521
37+
38+
Number of observations: 234
39+
Residual degrees of freedom: 232
40+
Residual deviance: 15148.5
3941
```
4042

4143
This model can also be fit as
4244
```jldoctest constructors
43-
julia> lm(hcat(ones(nrow(df)), df.Age), df.Height)
45+
julia> lm(@formula(Height ~ Age), df)
4446
LinearModel
4547
48+
Formula: Height ~ 1 + Age
49+
4650
Coefficients:
47-
─────────────────────────────────────────────────────────────────
48-
Coef. Std. Error t Pr(>|t|) Lower 95% Upper 95%
49-
─────────────────────────────────────────────────────────────────
50-
x1 149.372 0.528565 282.60 <1e-99 148.33 150.413
51-
x2 6.52102 0.816987 7.98 <1e-13 4.91136 8.13068
52-
─────────────────────────────────────────────────────────────────
51+
(Intercept) Age
52+
149.4 6.521
53+
54+
Number of observations: 234
55+
Residual degrees of freedom: 232
56+
Residual deviance: 15148.5
5357
```
5458

5559
```@docs

0 commit comments

Comments
 (0)