Skip to content

Commit 5b6d3ca

Browse files
Patch README + new version (#270)
* Enhance README with model inspection methods Added methods to inspect results from the reg() model object and clarified the need for a dataframe in certain functions. * Bump version from 1.12.0 to 1.12.1 * Fix formatting for code block in README * Add additional StatsAPI functions to README * Remove StatsAPI prefix from method calls in README * Update explanation for predict and residuals functions * Fix formatting and update notes in README.md * Revise GPU support section in README Updated GPU usage instructions in README.
1 parent dae81ea commit 5b6d3ca

2 files changed

Lines changed: 32 additions & 10 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FixedEffectModels"
22
uuid = "9d5cd8c9-2029-5cab-9928-427838db53e3"
3-
version = "1.12.0"
3+
version = "1.12.1"
44

55
[deps]
66
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

README.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,39 @@ reg(df, @formula(Sales ~ NDI + fe(State) + fe(Year)), Vcov.cluster(:State), weig
8282

8383

8484
## Output
85-
`reg` returns a light object. It is composed of
86-
87-
- the vector of coefficients & the covariance matrix (use `coef`, `coefnames`, `vcov` on the output of `reg`)
88-
- a boolean vector reporting rows used in the estimation
89-
- a set of scalars (number of observations, the degree of freedoms, r2, etc)
90-
91-
Methods such as `predict`, `residuals` are still defined but require to specify a dataframe as a second argument. The problematic size of `lm` and `glm` models in R or Julia is discussed [here](http://www.r-bloggers.com/trimming-the-fat-from-glm-models-in-r/), [here](https://blogs.oracle.com/R/entry/is_the_size_of_your), [here](http://stackoverflow.com/questions/21896265/how-to-minimize-size-of-object-of-class-lm-without-compromising-it-being-passe) [here](http://stackoverflow.com/questions/15260429/is-there-a-way-to-compress-an-lm-class-for-later-prediction) (and for absurd consequences, [here](http://stackoverflow.com/questions/26010742/using-stargazer-with-memory-greedy-glm-objects) and [there](http://stackoverflow.com/questions/22577161/not-enough-ram-to-run-stargazer-the-normal-way)).
9285

86+
The model object returned by `reg()` is lightweight. The following methods from `StatsAPI`\ can be used to inspect the results
87+
```julia
88+
# Coefficients
89+
coef(m::FixedEffectModel)
90+
vcov(m::FixedEffectModel)
91+
confint(m::FixedEffectModel)
92+
coefnames(m::FixedEffectModel)
93+
responsename(m::FixedEffectModel)
94+
95+
# Statistics
96+
nobs(m::FixedEffectModel)
97+
dof(m::FixedEffectModel)
98+
dof_residual(m::FixedEffectModel)
99+
r2(m::FixedEffectModel)
100+
islinear(m::FixedEffectModel)
101+
deviance(m::FixedEffectModel)
102+
nulldeviance(m::FixedEffectModel)
103+
rss(m::FixedEffectModel)
104+
mss(m::FixedEffectModel)
105+
loglikelihood(m::FixedEffectModel)
106+
nullloglikelihood(m::FixedEffectModel)
107+
adjr2(m::FixedEffectModel)
108+
coeftable(m::FixedEffectModel)
109+
formula(m::FixedEffectModel)
110+
111+
# Prediction and residuals
112+
predict(m::FixedEffectModel, df)
113+
residuals(m::FixedEffectModel, df)
114+
```
115+
Note that the functions `predict` and `residuals` require a table (`df`) as a second argument because the object returned by `reg` does not store the original dataset (to keep the model lightweight). For background on the tradeoff of storing the original data inside fitted model objects, see [1](http://www.r-bloggers.com/trimming-the-fat-from-glm-models-in-r/), [2](https://blogs.oracle.com/R/entry/is_the_size_of_your), [3](http://stackoverflow.com/questions/21896265/how-to-minimize-size-of-object-of-class-lm-without-compromising-it-being-passe), [4](http://stackoverflow.com/questions/15260429/is-there-a-way-to-compress-an-lm-class-for-later-prediction), [5](http://stackoverflow.com/questions/26010742/using-stargazer-with-memory-greedy-glm-objects), and [6](http://stackoverflow.com/questions/22577161/not-enough-ram-to-run-stargazer-the-normal-way).
93116

94-
You may use [RegressionTables.jl](https://github.com/jmboehm/RegressionTables.jl) to get publication-quality regression tables.
117+
Finally, you can use [RegressionTables.jl](https://github.com/jmboehm/RegressionTables.jl) to get publication-quality regression tables.
95118

96119

97120
## Performances
@@ -103,7 +126,6 @@ You may use [RegressionTables.jl](https://github.com/jmboehm/RegressionTables.jl
103126
The package has an experimental support for GPUs. This can make the package an order of magnitude faster for complicated problems.
104127

105128
If you have a Nvidia GPU, run `using CUDA` before `using FixedEffectModels`. Then, estimate a model with `method = :CUDA`.
106-
107129
```julia
108130
using CUDA, FixedEffectModels
109131
@assert CUDA.functional()

0 commit comments

Comments
 (0)