diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd0b2cf..c4b9f9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: version: - - '1.6' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'. + - '1.9' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'. - '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia. os: - ubuntu-latest @@ -27,7 +27,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: diff --git a/Project.toml b/Project.toml index 6ff8d04..dd48fbd 100644 --- a/Project.toml +++ b/Project.toml @@ -34,7 +34,7 @@ StatsModels = "0.7" StatsFuns = "0.9, 1" Tables = "1" Vcov = "0.8" -julia = "1.6" +julia = "1.9" [extras] CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" diff --git a/src/fit.jl b/src/fit.jl index a504ad2..5570936 100644 --- a/src/fit.jl +++ b/src/fit.jl @@ -67,12 +67,12 @@ function regife( Symbol(fesymbol(a)) ∉ factor_vars && error("FixedEffect should correspond to id or time dimension of the factor model") end end - fes, ids, fekeys, formula = FixedEffectModels.parse_fixedeffect(df, formula) + fes, ids, fekeys, formula = parse_fixedeffect(df, formula) has_fes = !isempty(fes) has_fes_intercept = false ## Compute factors, an array of AbtractFixedEffects if has_fes - if any([isa(fe.interaction, Ones) for fe in fes]) + if any([isa(fe.interaction, UnitWeights) for fe in fes]) formula = FormulaTerm(formula.lhs, tuple(ConstantTerm(0), (t for t in eachterm(formula.rhs) if t!= ConstantTerm(1))...)) has_fes_intercept = true end @@ -93,7 +93,7 @@ function regife( ############################################################################## ## - ## Construict vector y and matrix X + ## Construct vector y and matrix X ## ############################################################################## subdf = Tables.columntable((; (x => disallowmissing(view(df[!, x], esample)) for x in unique(vcat(vars)))...)) diff --git a/src/utils/formula.jl b/src/utils/formula.jl index bf6f042..e242206 100644 --- a/src/utils/formula.jl +++ b/src/utils/formula.jl @@ -14,3 +14,13 @@ eachterm(@nospecialize(x::NTuple{N, AbstractTerm})) where {N} = x ############################################################################## fesymbol(t::FixedEffectModels.FixedEffectTerm) = t.x fesymbol(t::FunctionTerm{typeof(fe)}) = Symbol(t.args[1]) + +function parse_fixedeffect(df, formula) + if isdefined(FixedEffectModels, :parse_fe) + formula, formula_fes = FixedEffectModels.parse_fe(formula) + fes, ids, fekeys = FixedEffectModels.parse_fixedeffect(df, formula_fes) + else + fes, ids, fekeys, formula = FixedEffectModels.parse_fixedeffect(df, formula) + end + return fes, ids, fekeys, formula +end \ No newline at end of file