I am using the LPDID command and I am unsure of what I am doing wrong, I have tried setting the values for the tau_n,m = x, and so on but the error does not change. What could I be doing wrong here?
/ Define tau values from regression coefficients
. scalar tau44 = _b[c.d4#c.f04]
. scalar tau45 = _b[c.d4#c.f05]
. scalar tau46 = _b[c.d4#c.f06]
.
. // Define number of observations and sigma
. local N = 1000 // Adjust as needed
. scalar sigma = 1 // Standard deviation of the error term
.
. // Set seed for reproducibility
. set seed 12345
.
. //Close any previously opened postfile with the same handle
. capture postclose results
.
. // Initialize postfile to store results
. postfile results tau_estimate using "lpdid_results.dta", replace
.
. // Loop over simulations
. forvalues i = 1/1000 {
2. quietly set seed =12345 + i''
3.
. clear
4. set obs N'
5.
. // Simulate Data
. gen time = ceil(runiform()*6) // Time periods 1 to 6
6. gen treated = (time >= 4) // Units treated starting from time peri
> od 4
7.
. gen y = ///
> (time == 4 & treated == 1) * tau44 + ///
> (time == 5 & treated == 1) * tau45 + ///
> (time == 6 & treated == 1) * tau46 + ///
> rnormal(0, sigma)
8.
. // Run lpdid
. quietly lpdid y time treated, options
9.
. // Extract the estimate
. scalar tau_estimate = r(tauhat)
10.
. // Post the result
. post handle value_list
11. }
number of observations (_N) was 0, now 1,000
too many variables specified
r(103);
end of do-file
/ Define tau values from regression coefficients
. scalar tau44 = _b[c.d4#c.f04]
. scalar tau45 = _b[c.d4#c.f05]
. scalar tau46 = _b[c.d4#c.f06]
.
. // Define number of observations and sigma
. local N = 1000 // Adjust as needed
. scalar sigma = 1 // Standard deviation of the error term
.
. // Set seed for reproducibility
. set seed 12345
.
. //Close any previously opened postfile with the same handle
. capture postclose results
.
. // Initialize postfile to store results
. postfile results tau_estimate using "lpdid_results.dta", replace
.
. // Loop over simulations
. forvalues i = 1/1000 {
2. quietly set seed =12345 + i''
3.
. clear
4. set obs N'
5.
. // Simulate Data
. gen time = ceil(runiform()*6) // Time periods 1 to 6
6. gen treated = (time >= 4) // Units treated starting from time peri
> od 4
7.
. gen y = ///
> (time == 4 & treated == 1) * tau44 + ///
> (time == 5 & treated == 1) * tau45 + ///
> (time == 6 & treated == 1) * tau46 + ///
> rnormal(0, sigma)
8.
. // Run lpdid
. quietly lpdid y time treated, options
9.
. // Extract the estimate
. scalar tau_estimate = r(tauhat)
10.
. // Post the result
. post handle value_list
11. }
number of observations (_N) was 0, now 1,000
too many variables specified
r(103);
end of do-file