@@ -93,16 +93,16 @@ and a group that did not receive any treatment in any sample period.
9393See also [`nevertreated`](@ref).
9494
9595# Fields
96- - `e::Vector{Int }`: group indices for units that did not receive any treatment.
96+ - `e::Tuple{Vararg{TimeType} }`: group indices for units that did not receive any treatment.
9797- `c::C`: an instance of [`ParallelCondition`](@ref).
9898- `s::S`: an instance of [`ParallelStrength`](@ref).
9999"""
100100struct NeverTreatedParallel{C,S} <: TrendParallel{C,S}
101- e:: Vector{Int }
101+ e:: Tuple{Vararg{TimeType} }
102102 c:: C
103103 s:: S
104104 function NeverTreatedParallel (e, c:: ParallelCondition , s:: ParallelStrength )
105- e = unique! (sort! ([e... ]))
105+ e = ( unique! (sort! ([e... ])) ... , )
106106 isempty (e) && error (" field `e` cannot be empty" )
107107 return new {typeof(c),typeof(s)} (e, c, s)
108108 end
@@ -111,11 +111,12 @@ end
111111istreated (pr:: NeverTreatedParallel , x) = ! (x in pr. e)
112112
113113show (io:: IO , pr:: NeverTreatedParallel ) =
114- print (IOContext (io, :compact => true ), " NeverTreated{" , pr. c, " ," , pr. s, " }(" , pr. e, " )" )
114+ print (IOContext (io, :compact => true ), " NeverTreated{" , pr. c, " ," , pr. s, " }" ,
115+ length (pr. e)== 1 ? string (" (" , pr. e[1 ], " )" ) : pr. e)
115116
116117function show (io:: IO , :: MIME"text/plain" , pr:: NeverTreatedParallel )
117118 println (io, pr. s, " trends with any never-treated group:" )
118- print (io, " Never-treated groups: " , pr. e)
119+ print (io, " Never-treated groups: " , join ( string .( pr. e), " , " ) )
119120 pr. c isa Unconditional || print (io, " \n " , pr. c)
120121end
121122
@@ -133,14 +134,14 @@ a wrapper method of `nevertreated` calls this method.
133134```jldoctest; setup = :(using DiffinDiffsBase)
134135julia> nevertreated(-1)
135136Parallel trends with any never-treated group:
136- Never-treated groups: [-1]
137+ Never-treated groups: -1
137138
138139julia> typeof(nevertreated(-1))
139- NeverTreatedParallel{Unconditional,Exact,Tuple{Int64} }
140+ NeverTreatedParallel{Unconditional,Exact}
140141
141142julia> nevertreated([-1, 0])
142143Parallel trends with any never-treated group:
143- Never-treated groups: [ -1, 0]
144+ Never-treated groups: -1, 0
144145
145146julia> nevertreated([-1, 0]) == nevertreated(-1:0) == nevertreated(Set([-1, 0]))
146147true
@@ -167,8 +168,8 @@ and any group that received the treatment relatively late (or never receved).
167168See also [`notyettreated`](@ref).
168169
169170# Fields
170- - `e::Vector{Int }`: group indices for units that received the treatment relatively late.
171- - `ecut::Vector{Int }`: user-specified period(s) when units in a group in `e` started to receive treatment.
171+ - `e::Tuple{Vararg{TimeType} }`: group indices for units that received the treatment relatively late.
172+ - `ecut::Tuple{Vararg{TimeType} }`: user-specified period(s) when units in a group in `e` started to receive treatment.
172173- `c::C`: an instance of [`ParallelCondition`](@ref).
173174- `s::S`: an instance of [`ParallelStrength`](@ref).
174175
@@ -178,14 +179,14 @@ See also [`notyettreated`](@ref).
178179 - the sample has a rotating panel structure with periods overlapping with some others.
179180"""
180181struct NotYetTreatedParallel{C,S} <: TrendParallel{C,S}
181- e:: Vector{Int }
182- ecut:: Vector{Int }
182+ e:: Tuple{Vararg{TimeType} }
183+ ecut:: Tuple{Vararg{TimeType} }
183184 c:: C
184185 s:: S
185186 function NotYetTreatedParallel (e, ecut, c:: ParallelCondition , s:: ParallelStrength )
186- e = unique! (sort! ([e... ]))
187+ e = ( unique! (sort! ([e... ])) ... , )
187188 isempty (e) && error (" field `e` cannot be empty" )
188- ecut = unique! (sort! ([ecut... ]))
189+ ecut = ( unique! (sort! ([ecut... ])) ... , )
189190 isempty (ecut) && error (" field `ecut` cannot be empty" )
190191 return new {typeof(c),typeof(s)} (e, ecut, c, s)
191192 end
@@ -194,12 +195,13 @@ end
194195istreated (pr:: NotYetTreatedParallel , x) = ! (x in pr. e)
195196
196197show (io:: IO , pr:: NotYetTreatedParallel ) =
197- print (IOContext (io, :compact => true ), " NotYetTreated{" , pr. c, " ," , pr. s, " }(" , pr. e, " )" )
198+ print (IOContext (io, :compact => true ), " NotYetTreated{" , pr. c, " ," , pr. s, " }" ,
199+ length (pr. e)== 1 ? string (" (" , pr. e[1 ], " )" ) : pr. e)
198200
199201function show (io:: IO , :: MIME"text/plain" , pr:: NotYetTreatedParallel )
200202 println (io, pr. s, " trends with any not-yet-treated group:" )
201- println (io, " Not-yet-treated groups: " , pr. e)
202- print (io, " Treated since: " , pr. ecut)
203+ println (io, " Not-yet-treated groups: " , join ( string .( pr. e), " , " ) )
204+ print (io, " Treated since: " , join ( string .( pr. ecut), " , " ) )
203205 pr. c isa Unconditional || print (io, " \n " , pr. c)
204206end
205207
@@ -218,21 +220,21 @@ a wrapper method of `notyettreated` calls this method.
218220```jldoctest; setup = :(using DiffinDiffsBase)
219221julia> notyettreated(5)
220222Parallel trends with any not-yet-treated group:
221- Not-yet-treated groups: [5]
222- Treated since: [5]
223+ Not-yet-treated groups: 5
224+ Treated since: 5
223225
224226julia> typeof(notyettreated(5))
225- NotYetTreatedParallel{Unconditional,Exact,Tuple{Int64},Tuple{Int64} }
227+ NotYetTreatedParallel{Unconditional,Exact}
226228
227229julia> notyettreated([-1, 5, 6], 5)
228230Parallel trends with any not-yet-treated group:
229- Not-yet-treated groups: [ -1, 5, 6]
230- Treated since: [5]
231+ Not-yet-treated groups: -1, 5, 6
232+ Treated since: 5
231233
232234julia> notyettreated([4, 5, 6], [4, 5, 6])
233235Parallel trends with any not-yet-treated group:
234- Not-yet-treated groups: [ 4, 5, 6]
235- Treated since: [ 4, 5, 6]
236+ Not-yet-treated groups: 4, 5, 6
237+ Treated since: 4, 5, 6
236238```
237239"""
238240notyettreated (e, ecut, c:: ParallelCondition , s:: ParallelStrength ) =
0 commit comments