On Fri, 2013-08-02 at 17:30 +0100, Allin Cottrell wrote:
On Thu, 1 Aug 2013, Giuseppe Vittucci wrote:
> Moreover, the same option cluster does not work and returns an error if
> there is at least one missing observation.
I cannot replicate that -- could you give an example?
It was really hard to replicate the issue....
Here is a simple example:
nulldata 10000
series y = normal(0,1)
series x = 0
series d = 0
loop for i=1..100 --quiet
smpl index > 100*(i-1) && index <= 100*i --restrict --replace
d = i
y = y + i
x = randgen1(n,0,1)
endloop
smpl full
ols y 0 x
ols y 0 x --cluster=d
This works.
There are 100 clusters each one made up of 100 obs.
Now, if you remove from y the first observation of each cluster, i.e.
loop for i=1..100 --quiet
j = 100*(i-1)+1
y[j] = NA
endloop
or the i-th obs in the i-th cluster:
loop for i=1..100 --quiet
j = 100*(i-1)+i
y[j] = NA
endloop
and run:
ols y 0 x --cluster=d
gretl returns an error:
Missing values encountered
Error executing script: halting
This instead works:
smpl ok(y) --restrict
ols y 0 x --cluster=d
and produces estimates for s.e. which are consistent with the Stata
command:
reg y x, vce(cluster d)
Bye
Giuseppe Vittucci