Storing the cluster robust standard error to create a new variable— Stata 12 for Mac

StackOverflow https://stackoverflow.com/questions/12484171

  •  02-07-2021
  •  | 
  •  

Вопрос

I need to store the value for the cluster robust standard error in order to use it to create a new variable.

I am able to get the cluster robust standard error with the mean command, but stata does not store this value.

Do you have any suggestions about how to calculate the cluster robust standard error for an estimate and then store this value in order to use it to create a new variable?

Это было полезно?

Решение

I think this might almost do the trick. There might be a more elegant way to do this. Toy data, nonsensical example:

/* Get some data */
webuse nhanes2f, clear
svyset psuid [pweight=finalwgt], strata(stratid)

/* get the standard error of the constant, which is the mean */
svy: reg zinc
display _se[_cons]
generate se = _se[_cons]

/* Verify that this is correct */
svy: mean zinc

However, you also want to cluster, which complicates things. I think if you only have survey weights (aka first stage clusters), you can do:

reg zinc [pweight=finalwgt], cluster(region)

There might a way to do what you want with -glamm-, which is user-written command. You should ask this question on Statalist if you don't get much of response here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top