I achive something diferent, I replicated the t value, the std. error and
the hypothesis test but differents betas.
But, you are right, the thing is, I detach the dataset, but even with it, I
couldn't.
I going to describe all because perhaps I omitted something important.
I have this vector for the weights "wst7". My dataset it's a panel survey
with 103 observations missing. "wst7" is the weight and the non response
adjustment factor, with data only for 248 observations.
> class(wst7)
[1] "numeric"
> summary(wst7)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
0.00 10.26 13.52 21.33 25.85 146.00 103
If I use "wst7" to create de svydesign this appear:
> test <- svydesign(id=~1,weights=~wst7)
Error in function (object, ...) : missing values in `weights'
So, I create a vector without NAs (now with the dataset detach).
peso<-na.omit(matrix(data$wst7))
Then
test <- svydesign(id=~fullid,weights=~peso)
(fullid is the identification for each observation, I also used "1", or
whatever you whant there)
Then
logit <- svyglm(bach ~ job2 + mujer + egp4 + programa + delay + mdeo + str
+
evprivate, family=binomial(link="logit"), design=test,
data=data)
This appear
Error in svyglm.survey.design(bach ~ job2 + mujer + egp4 + programa + :
all variables must be in design= argument
Even if I try to use svy as svymean
svymean(data$mujer, design=test)
mean SE
[1,] 0.78843 0.0479
Warning messages:
1: In x * pweights :
longer object length is not a multiple of shorter object length
2: In x * pweights :
longer object length is not a multiple of shorter object length
When the mean for "mujer" is
. svy: mean mujer
(running mean on estimation sample)
Survey: Mean estimation
Number of strata = 1 Number of obs = 248
Number of PSUs = 248 Population size = 5290.16
Design df = 247
Linearized
Mean Std. Err. [95% Conf. Interval]
mujer .5551581 .0410122 .4743798 .6359363
So, I thing that the problem is in the survey design...
On Tue, Nov 27, 2012 at 11:49 PM, David Winsemius <
dwins...@comcast.net>wrote:
>
> On Nov 27, 2012, at 2:31 PM, Pablo Menese wrote:
>
> Sorry, it send it alone...
>>
>> When I use it:
>>
>> logit <- glm(bach ~ egp4 + programa, weight=wst7,
>> family=quasibinomial(link"**logit"))
>>
>> I reach the same betas that in STATA, but the hypothesis test, the t
>> value, and the std. error is different.
>>
>
> As might be expected if one (Stata) were a weighted analysis and the (R)
> other is using a different interpretation of "weights".
>
>
>> I think that the solution can't be so far from this...
>>
>
> If so, then you will be the one to achieve it. You have offered no data in
> either the original question for which you have omitted context, and the
> code in this posting is obviously incorrect. Furthermore you started with
> a `svyglm` question and this code only attempts to use `glm`.
>
>
> --
>
> David Winsemius, MD
> Alameda, CA, USA
>
>
[[alternative HTML version deleted]]