[R] Fw: Complex sampling survey _ Use of survey package
Ahoussou Sylvie
sylvie.ahoussou at antilles.inra.fr
Fri Sep 12 15:57:46 CEST 2008
--------------------------------------------------
From: "Ahoussou Sylvie" <sylvie.ahoussou at antilles.inra.fr>
Sent: Friday, September 12, 2008 9:48 AM
To: "Thomas Lumley" <tlumley at u.washington.edu>
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
>
> 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.
>
>
> --------------------------------------------------
> From: "Thomas Lumley" <tlumley at u.washington.edu>
> Sent: Friday, September 12, 2008 12:02 AM
> To: "Ahoussou Sylvie" <sylvie.ahoussou at antilles.inra.fr>
> Cc: <r-help at r-project.org>
> Subject: Re: [R] Complex sampling survey _ Use of survey package
>
>> On Thu, 11 Sep 2008, Ahoussou Sylvie wrote:
>>
>>> Data base = tab1 here are the five first rows of the database (nrow =
>>> 11792)
>>>
>>>
>>>
>>>
>>> num
>>> esp
>>> Quarters
>>> Totcat
>>> Totshp
>>> Totgt
>>> Tbtpos
>>> fpc1
>>> Totanim
>>> Id_An
>>>
>>> 10
>>> 2045
>>> G
>>> 01-Q1
>>> 0
>>> 0
>>> 12
>>> 1
>>> 551
>>> 10
>>> 10
>>>
>>> 11
>>> 2046
>>> G
>>> 01-Q1
>>> 8
>>> 0
>>> 60
>>> 1
>>> 551
>>> 11
>>> 11
>>>
>>> 50
>>> 2070
>>> G
>>> 01-Q1
>>> 0
>>> 3
>>> 6
>>> 1
>>> 551
>>> 50
>>> 50
>>>
>>> 51
>>> 2070
>>> S
>>> 01-Q1
>>> 0
>>> 3
>>> 6
>>> 1
>>> 551
>>> 51
>>> 51
>>>
>>> 52
>>> 2070
>>> S
>>> 01-Q1
>>> 0
>>> 3
>>> 6
>>> 1
>>> 551
>>> 52
>>> 52
>>>
>>>
>>
>> This has 11 data values in each row but only 10 variable names. If we
>> assume the first number doesn't belong it, the fpc1 column lines up
>> correctly, so I will do that.
>>
>> It is surprising that Id_An is the same as Totanim for each of these five
>> records
>>
>>>
>>> - First strata = herds
>>>
>>> herd's id column = num
>>>
>>> sampled in 551 herds (column fpc1)
>>>
>>>
>>>
>>> - Second strata = animals
>>>
>>> animal id column= Id_An
>>>
>>> sampled in Totanim
>>>
>>>
>>>
>>> I tried :
>>>
>>> clustot <- svydesign (id=~num+Id_An, fpc=~fpc1+~Totanim, data=tab1)
>>>
>> This should be
>> clustot <- svydesign (id=~num+Id_An, fpc=~fpc1+Totanim, data=tab1)
>> but that doesn't explain the problem
>>
>> Your svydesign() call looks correct if fpc1 is the total number of herds
>> in the population and Totanim is the total number of animals in the
>> particular herd. I am not sure from your explanation whether this is how
>> the variables are defined.
>>
>> -thomas
>>
>>
>>>
>>> and I get 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.
>>>
>>>
>>>
>>> I don't have any strata with 100% sampling so do you know which
>>> arguments of the fonction svydesign I'm supposed to use ?
>>>
>>>
>>>
>>> Thanks in advance
>>>
>>>
>>>
>>> AHOUSSOU Sylvie
>>> Vétérinaire Epidémiologiste
>>> CIRAD Domaine Duclos
>>> 97 170 Petit-Bourg
>>> tel : 05 90 25 59 47
>>> [[alternative HTML version deleted]]
>>>
>>>
>>
>> Thomas Lumley Assoc. Professor, Biostatistics
>> tlumley at u.washington.edu University of Washington, Seattle
>>
>>
>>
More information about the R-help
mailing list