On Fri, 12 Sep 2008, Ahoussou Sylvie wrote:
--------------------------------------------------
From: "Ahoussou Sylvie" <[EMAIL PROTECTED]>
Sent: Friday, September 12, 2008 9:48 AM
To: "Thomas Lumley" <[EMAIL PROTECTED]>
Subject: Re: [R] Complex sampling survey _ Use of survey package
Thanks for your answer
I think I made a mistake when I recopied the 5 first rows of my database
here is the table with the comlums of interest
num esp fpc1 Totanim Id_An
2045 G 551 12 10
2046 C 551 68 11
2070 G 551 9 50
2070 S 551 9 51
2070 S 551 9 52
yes Totanim is the total number of animals in the farm and num is the total
number of herds
Do you mean 'fpc1 is the total number of herds'? That is what your
svydesign() call says.
I keep on obtaining this error message
clustot<-svydesign(id=~num+ ~ Id_An, fpc=~fpc1+~Totanim, data=tab1)
Erreur dans as.fpc(fpc, strata, ids) :
FPC implies >100% sampling in some strata.
Well, we seem to have either a bug or a problem with the data.
If you do
options(error=recover)
before the svydesign() call you can go into as.fpc() and look at the data.
As an example;
Error in as.fpc(fpc, strata, ids) :
FPC implies >100% sampling in some strata.
Enter a frame number, or 0 to exit
1: svydesign(id = ~dnum + snum, fpc = ~fpc1 + I(pmin(fpc2, 4)), data =
apiclus2)
2: svydesign.default(id = ~dnum + snum, fpc = ~fpc1 + I(pmin(fpc2, 4)),
data = apiclus2)
3: as.fpc(fpc, strata, ids)
Selection: 3
Called from: eval(expr, envir, enclos)
Browse[1]> which(sampsize>popsize, arr.ind=TRUE)
row col
22 22 2
23 23 2
24 24 2
...
Browse[1]> sampsize[22,2]
[1] 5
Browse[1]> popsize[22,2]
[1] 4
Browse[1]> ids[22,]
dnum snum
22 200 200.841
So in this case one of the problems is in dnum 200, snum 841, where the
population size was specified as 4 but the sample size is 5.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
[EMAIL PROTECTED] University of Washington, Seattle
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.