Re: [R] the survey package

2007-09-10 Thread Thomas Lumley
On Thu, 6 Sep 2007, Tobias Verbeke wrote:

> eugen pircalabelu wrote:
>
>>   I'm trying to use the survey package to get a better point of view 
>> for my data, but i need some piece of advice:
>>
>>   i have some data from a survey which has been stratified using 2 
>> criteria: region(7 values), size of locality(5 values)  Using the 
>> survey pakage how can i define in a correct way this design (taking 
>> into account all 4 strata not just one as in the Survey example)
>>

> According to ?svydesign, strata is a formula.
>
> The following should work (untested):
>
> design <- svydesign(ids=~0, strata=~regiune + size_loc, data=tabel)

This would be a two-stage sample, you actually need ~interaction(regiune, 
size_loc).

[this reply is just to make sure it ends up linked in the archives].

-thomas

__
R-help@stat.math.ethz.ch 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.


Re: [R] the survey package

2007-09-06 Thread Tobias Verbeke
eugen pircalabelu wrote:

>   I'm trying to use the survey package to get a better point of view for my 
> data, but i need some piece of advice:
>
>   i have some data from a survey which has been stratified using 2 criteria: 
> region(7 values), size of locality(5 values)  Using the survey pakage how can 
> i define in a correct way this design (taking into account all 4 strata not 
> just one as in the Survey example) 
>
>   i have tried 
>
>   design<- svydesign(ids=~0, strata= c(~regiune,~size_loc), data=tabel) # for 
> 2 criteria
>
>   and got this error
>
>   Error in strata[, 1] : incorrect number of dimensions
>   My "tabel" looks like this:

According to ?svydesign, strata is a formula.

The following should work (untested):

design <- svydesign(ids=~0, strata=~regiune + size_loc, data=tabel)

HTH,
Tobias

P.S. See http://faculty.washington.edu/tlumley/survey/
for all information relating to this package.

-- 

Tobias Verbeke - Consultant
Business & Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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.


[R] the survey package

2007-09-06 Thread eugen pircalabelu
Good afternoon!
   
  I'm trying to use the survey package to get a better point of view for my 
data, but i need some piece of advice:
   
  i have some data from a survey which has been stratified using 2 criteria: 
region(7 values), size of locality(5 values)  Using the survey pakage how can i 
define in a correct way this design (taking into account all 4 strata not just 
one as in the Survey example) 
   
  i have tried 
   
  design<- svydesign(ids=~0, strata= c(~regiune,~size_loc), data=tabel) # for 2 
criteria
   
  and got this error
   
  Error in strata[, 1] : incorrect number of dimensions
  My "tabel" looks like this:
   
   cod  cantitate   pondere  regiune  size_loc  
size_hhage_hhh
7405977.604  0.9962673   1  1   
3 52
74213879.362 0.8674601  1  1   
3  42
  743   7876.3220.9845403   1 1 
   4 53
7451169.084  1.1690844   11 
 3   50
  7464430.431  0.9845403   11   
   350
751 3938.161  0.9845403   1   1 
 2 39

   
   
  What does it mean and where was i wrong? 
   
  I'm sorry for taking up your time but i don't know how to fix my problem. 
Thank you!

   
-
Luggage? GPS? Comic books? 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.