323:  # calendar time effects
324-  #-----------------------------------------------------------------------------
325-
326-  if (type == "calendar") {
327-
328-    # drop time periods where no one is treated yet
329-    # (can't get treatment effects in those periods)
330-    minG <- min(group)
331-    calendar.tlist <- tlist[tlist>=minG]
332-
333-    # calendar time specific atts
334-    calendar.att.t <- sapply(calendar.tlist, function(t1) {
335-      # look at post-treatment periods for group g
336-      whicht <- which( (t == t1) & (group <= t))
337-      attt <- att[whicht]
338-      mean(attt)
339-    })
340-
341-    # get standard errors and influence functions
342-    # for each time specific att
343-    calendar.se.inner <- lapply(calendar.tlist, function(t1) {
344-      whicht <- which( (t == t1) & (group <= t))
345-      wif.t <- wif(keepers=whicht,
--
372:    # get overall att under calendar time effects
373-    # this is just average over all time periods
374-    calendar.att <- mean(calendar.att.t)
375-
376-    # get overall influence function
377-    calendar.inf.func <- get_agg_inf_func(att=calendar.att.t,
378-                                           inffunc1=calendar.inf.func.t,
379-                                           whichones=(1:length(calendar.tlist)),
380-                                           weights.agg=rep(1/length(calendar.tlist), length(calendar.tlist)),
381-                                           wif=NULL)
382-
383-    # get overall standard error
384-    calendar.se <- getSE(calendar.inf.func, dp)
385-
386-    return(AGGTEobj(overall.att=calendar.att,
387-                    overall.se=calendar.se,
388-                    type=type,
389-                    egt=sapply(calendar.tlist,t2orig),
390-                    att.egt=calendar.att.t,
391-                    se.egt=calendar.se.t,
392-                    crit.val.egt=calendar.crit.val,
===
-- v2.0
124:  pgg <- pg
210:    # (here use pgg instead of pg because we can just look at each group)
211:    selective.att <- sum(selective.att.g * pgg)/sum(pgg)
213:    # account for having to estimate pgg in the influence function
215:                         pg=pgg,
224:                                           weights.agg=pgg/sum(pgg),
-- v2.1.1
156:  pgg <- pg
270:    # (here use pgg instead of pg because we can just look at each group)
271:    selective.att <- sum(selective.att.g * pgg)/sum(pgg)
273:    # account for having to estimate pgg in the influence function
275:                         pg=pgg,
284:                                           weights.agg=pgg/sum(pgg),
