Mean Difference Hypothesis Test in R Survey Package

Asked

Viewed 125 times

2

Please, using the Survey package, how to make a hypothesis test of mean difference? i.e. if the sample mean of 2003 is the same in 2008 for a certain variable. I’m working with PNAD data

1 answer

2


The function you will need to use is called svyttest.

In the examples, when you use help(svytest) he does it this way:

data(api)
dclus2<-svydesign(id=~dnum+snum, fpc=~fpc1+fpc2, data=apiclus2)
svyttest(enroll~comp.imp, dclus2)

In this example he compares the average number of students enrolled in American schools who have reached a "comparable improvement measure".

In your case you must have an object created by the function svydesign right? So to test just use the function svyttestas follows:

svyttest(variavel_que_vc_quer_comparar~ano_como_fator, objeto_svydesign)

In any case, it would be interesting if you provided a small sample of your data to anyone trying to answer, to be able to see if it is working for your problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.