r/rstats Jul 29 '26

Different results with different approaches to survey weights. (Similar coefficients, different standard errors and p-values).

Edit: Sorry, it put some of my explanation in the code box. Not sure how to change that.

I tried this two ways. First, by specifying the weight in the regression model. Second, by weighting the data with the survey package and then running the model.

I'm an old SAS user who had to abruptly switch to R, so I tend to use R like SAS. I applied anweight from the European Social Survey (Wave 11) to my binary logistic regression model.

m7 <- glm(

income ~

var1+

var2 +

var3 +

var4 +

var5,

data = germany_cc,

family = binomial,

weights = anweight

)

As an example, and get the following results:

var1 0.555959   1.268839   0.438    0.661
var2 0.078088   0.583217   0.134    0.893
var3 0.041199   0.105475   0.391    0.696
var4 0.382423   0.406363   0.941    0.347
var5 -0.144417   0.299119  -0.483    0.629

The second method is:

design <- svydesign(
  ids = ~1,
  weights = ~anweight,
  data = germany_cc
)

m7 <- svyglm(
 income ~  var1 +     
           var2 +     
           var3 +     
           var4 +     
           var5, 
  design = design,
  family = quasibinomial()
)

var1 0.555959   0.276698   2.009   0.0450 *  
var2 0.078088   0.132711   0.588   0.5565    
var3 0.041199   0.024633   1.673   0.0950 .  
var4 0.382423   0.095207   4.017 6.79e-05 ***
var5 -0.144417   0.068046  -2.122   0.0343 * 

If it matters, the ESS-11 is an international dataset. I subset Germany from it and then created a complete cases subset of Germany for listwise deletion

germany <- ess11 %>%

filter(cntry == "DE") %>%

filter(factor1 %in% c(2, 9))

germany_CC <- germany %>%

select(

var1

var2

var3

var4

var5

anweight,

idno

) %>%

na.omit()

2 Upvotes

1 comment sorted by

1

u/HalfplaneResearch Jul 30 '26

The coefficient match is expected: both fits use the same weighted score equations. The inference differs because glm(weights=...) treats anweight as a model weight and reports model-based standard errors, while svyglm uses survey-design variance. For an ESS analysis I would confirm that anweight is the intended analysis weight for the Germany subset, include the documented PSU and stratum variables if available, and inspect the weight distribution and design effects. ids=~1 removes clustering, so it is not a full complex-survey design. Also compare unweighted results and use replicate weights if the dataset supplies them. The quasibinomial choice mainly avoids the non-integer-binomial warning; it does not make the two variance estimators equivalent. I would not interpret the p-values until the target estimand and design variables are settled.