Skip to content

Problem with svyvar in survey package

6 messages · amitava, Thomas Lumley

#
I am facing a problem with a function in survey package. The function svyvar
gives the estimated population variance from a given sampling scheme.  I am
working with a data having more than four continuous variables. In order to
have have population total for all those cont. variables I have written in
the following format 

svyvar(~var1+var2+var3+var4+var5+var6,data) ; var1,var2,...,var6 are 6 cont.
variables

Now the problem is that,this function works properly when the number of
cont. variables are less than or equal to three. But when the number of
variables goes beyond three it gives a wrong answer,where we have two
estimates for the 1st variable (here it is var1),and one of the variable is
dropped,and also estimates differs. Sometimes it comes out to be a negative
quantity.

Please tell me why these problems are happening.

--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-svyvar-in-survey-package-tp3932818p3932818.html
Sent from the R help mailing list archive at Nabble.com.
#
On Mon, Oct 24, 2011 at 4:21 AM, amitava <amtv.statpresi at gmail.com> wrote:
You will have to give more information: what you describe does not
happen when I use svyvar. For example, using one of the built-in data
sets:
variance       SE
api00    11182.82 1386.414
api99    12735.21 1450.082
ell        285.01   54.081
mobility   127.11   55.790
meals      709.07  102.109
variance     SE
api00    11183 1386.4
api99    12735 1450.1
variance     SE
ell        285.01 54.081
mobility   127.11 55.790
variance     SE
meals   709.07 102.11

I assume you are using a current version of survey -- there was a bug
in printing svyvar results (though not in calculating them), but that
was fixed well over a year ago, as listed in the NEWS file.
#
Respected Sir
        Thanks for your reply.I am giving a part of my output to clarify my
problem.
[1]  6 29 27 44 37 43  1 10 26 20
Independent Sampling design
svydesign(id = ~1, weights = rep((N/n), n), fpc = rep(N, n), 
    data = srswor_sample_data)
variance         SE
salary 7.1883e+07 2.5445e+07
salary 1.1267e+04 4.8569e+03
yrsemp 9.8333e+00 5.5376e+00
educ   1.1267e+04 4.8569e+03
super  3.2889e+00 1.4384e+00
variance         SE
salary  7.1883e+07 2.5445e+07
yrsemp  5.6732e+04 1.6373e+04
priorex 9.8222e+00 3.9900e+00



Above svyvar returns different results in two different situations(estimates
of population variance of salary).



--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-svyvar-in-survey-package-tp3932818p3936205.html
Sent from the R help mailing list archive at Nabble.com.
#
Yes, but you didn't answer the question: what version of the package
are you using?

   -thomas
On Tue, Oct 25, 2011 at 3:03 AM, amitava <amtv.statpresi at gmail.com> wrote:

  
    
2 days later
2 days later
#
Well, you need to use the current version, then.

    -thomas
On Fri, Oct 28, 2011 at 10:09 PM, amitava <amtv.statpresi at gmail.com> wrote: