Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 6d1dabf

Browse files
authored
Improve post! and DID result interface and add GroupContrasts (#33)
1 parent ba1abb8 commit 6d1dabf

File tree

11 files changed

+258
-57
lines changed

11 files changed

+258
-57
lines changed

src/DiffinDiffsBase.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using PooledArrays: _label
1414
using PrettyTables: pretty_table
1515
using Reexport
1616
using StatsBase: CoefTable, Weights, stderror, uweights
17-
using StatsFuns: tdistccdf, tdistinvcdf
17+
using StatsFuns: normccdf, norminvcdf, tdistccdf, tdistinvcdf
1818
@reexport using StatsModels
1919
using StatsModels: Schema
2020
using StructArrays: StructArray
@@ -111,6 +111,7 @@ export cb,
111111
CheckData,
112112
GroupTreatintterms,
113113
GroupXterms,
114+
GroupContrasts,
114115
CheckVars,
115116
GroupSample,
116117
MakeWeights,
@@ -124,6 +125,7 @@ export cb,
124125
DIDResult,
125126
AggregatedDIDResult,
126127
vce,
128+
treatment,
127129
outcomename,
128130
treatnames,
129131
treatcells,

src/StatsProcedures.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,13 @@ end
604604
@specset [option option=val ...] default_args... for v in (...) ... end
605605
@specset [option option=val ...] default_args... for v in (...), w in (...) ... end
606606
607-
Construct a vector of [`StatsSpec`](@ref) with shared default values for arguments
607+
Construct a vector of [`StatsSpec`](@ref)s with shared default values for arguments
608608
and then conduct the procedures by calling [`proceed`](@ref).
609+
The vector of [`StatsSpec`](@ref)s and a vector of result objects are returned,
610+
unless alternative behavior is specified with the `option`s.
609611
610612
# Arguments
611-
- `[option option=val ...]`: optional settings for @specset including keyword arguments for [`proceed`](@ref).
613+
- `[option option=val ...]`: optional settings for `@specset` including keyword arguments for [`proceed`](@ref).
612614
- `default_args...`: optional default values for arguments shared by all [`StatsSpec`](@ref)s.
613615
- `code block`: a `begin/end` block or a `for` loop containing arguments for constructing [`StatsSpec`](@ref)s.
614616
@@ -634,7 +636,7 @@ For options that take a Boolean value,
634636
specifying the name of the option is enough for setting the value to be true.
635637
636638
The following options are available for altering the behavior of `@specset`:
637-
- `noproceed::Bool=false`: do not call [`proceed`](@ref) and return the vector of [`StatsSpec`](@ref).
639+
- `noproceed::Bool=false`: do not call [`proceed`](@ref) and only return the vector of [`StatsSpec`](@ref).
638640
- `verbose::Bool=false`: print the name of each step when it is called.
639641
- `keep=nothing`: names (of type `Symbol`) of additional objects to be returned.
640642
- `keepall::Bool=false`: return all objects generated by procedures along with arguments from the [`StatsSpec`](@ref)s.
@@ -683,6 +685,8 @@ macro specset(args...)
683685
for i in 1:nspec
684686
sps[i] = StatsSpec($(esc(formatter))(merge($defaults, $args_set[i]))...)
685687
end
688+
# The same args_set will be reused if exectuted again without recalling the macro
689+
empty!($args_set)
686690
end
687691

688692
if noproceed
@@ -693,7 +697,7 @@ macro specset(args...)
693697
else
694698
return quote
695699
$blk
696-
proceed(sps; $options...)
700+
sps, proceed(sps; $options...)
697701
end
698702
end
699703
end

0 commit comments

Comments
 (0)