Skip to content

Commit b647c44

Browse files
Claude cleanup (#276)
* claude cleanup * update * update
1 parent 859a69b commit b647c44

13 files changed

Lines changed: 304 additions & 256 deletions

File tree

.github/workflows/CompatHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
run: which julia
1616
continue-on-error: true
1717
- name: Install Julia, but only if it is not already available in the PATH
18-
uses: julia-actions/setup-julia@v1
18+
uses: julia-actions/setup-julia@v2
1919
with:
2020
version: '1'
2121
arch: ${{ runner.arch }}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
version:
20-
- '1.9'
20+
- '1.10'
2121
- '1'
2222
# - 'nightly'
2323
os:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
1+
Manifest.toml
2+
settings.local.json
23
benchmark/.sublime2Terminal.jl
34
.vscode/settings.json

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Vcov = "ec2bfdc2-55df-4fc9-b9ae-4958c2cf2486"
1919

2020
[compat]
2121
DataFrames = "0.21, 0.22, 1"
22-
FixedEffects = "2.6"
22+
FixedEffects = "2.6, 3"
2323
PrecompileTools = "1"
2424
Reexport = "0.1, 0.2, 1"
2525
Statistics = "1"
@@ -29,7 +29,7 @@ StatsFuns = "0.9, 1"
2929
StatsModels = "0.7"
3030
Tables = "1"
3131
Vcov = "0.8"
32-
julia = "1.9"
32+
julia = "1.10"
3333

3434

3535
[extras]

src/FixedEffectModel.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function StatsAPI.adjr2(model::FixedEffectModel, variant::Symbol=:devianceratio)
9999
n = nobs(model)
100100
dev = deviance(model)
101101
dev0 = nulldeviance(model)
102-
1 - (dev*(n - (has_int | has_fe(model)))) / (dev0 * max(n - k, 1))
102+
1 - (dev*(n - (has_int || has_fe(model)))) / (dev0 * max(n - k, 1))
103103
else
104104
throw(ArgumentError("variant must be one of :McFadden or :devianceratio"))
105105
end
@@ -184,7 +184,7 @@ function StatsAPI.residuals(m::FixedEffectModel, data)
184184
Tables.istable(data) ||
185185
throw(ArgumentError("expected second argument to be a Table, got $(typeof(data))"))
186186
has_fe(m) &&
187-
throw("To access residuals for a model with high-dimensional fixed effects, run `m = reg(..., save = :residuals)` and then access residuals with `residuals(m)`.")
187+
throw(ArgumentError("To access residuals for a model with high-dimensional fixed effects, run `m = reg(..., save = :residuals)` and then access residuals with `residuals(m)`."))
188188
cdata = StatsModels.columntable(data)
189189
cols, nonmissings = StatsModels.missing_omit(cdata, m.formula_schema.rhs)
190190
Xnew = modelmatrix(m.formula_schema, cols)
@@ -201,8 +201,10 @@ end
201201

202202
function StatsAPI.residuals(m::FixedEffectModel)
203203
if m.residuals === nothing
204-
has_fe(m) && throw("To access residuals in a fixed effect regression, run `reg` with the option save = :residuals, and then access residuals with `residuals()`")
205-
!has_fe(m) && throw("To access residuals, use residuals(m, data) where `m` is an estimated FixedEffectModel and `data` is a Table")
204+
throw(ArgumentError(
205+
has_fe(m) ? "To access residuals in a fixed effect regression, run `reg` with the option save = :residuals, and then access residuals with `residuals()`" :
206+
"To access residuals, use residuals(m, data) where `m` is an estimated FixedEffectModel and `data` is a Table"
207+
))
206208
end
207209
m.residuals
208210
end
@@ -214,11 +216,11 @@ Return a DataFrame with fixed effects estimates.
214216
The output is aligned with the original DataFrame used in `reg`.
215217
216218
### Keyword arguments
217-
* `keepkeys::Bool' : Should the returned DataFrame include the original variables used to defined groups? Default to false
219+
* `keepkeys::Bool` : Should the returned DataFrame include the original variables used to defined groups? Default to false
218220
"""
219221

220222
function fe(m::FixedEffectModel; keepkeys = false)
221-
!has_fe(m) && throw("fe() is not defined for fixed effect models without fixed effects")
223+
!has_fe(m) && throw(ArgumentError("fe() is not defined for fixed effect models without fixed effects"))
222224
if keepkeys
223225
m.fe
224226
else

0 commit comments

Comments
 (0)