eugen pircalabelu
2007-Nov-24 17:47 UTC
[R] question regarding an error message from survey package
Hi R-users! Can anyone tell me what this error message refers to exactly> a<-c('m','f','m') > b<-c(1:3) > st<-c(1:3) > data.frame(a,b,st)a b st 1 m 1 1 2 f 2 2 3 m 3 3> data.frame(a,b,st)->l > p<-svydesign(ids=~1, data=l) > pop<-c('(intercept)'=100, st1=10,st2=20) > calibrate(p,~st, pop)Error in regcalibrate.survey.design2(design, formula, population, aggregate.stage = aggregate.stage, : Population and sample totals are not the same length. Thank you and have a great day! --------------------------------- [[alternative HTML version deleted]]
James Reilly
2007-Nov-25 03:07 UTC
[R] question regarding an error message from survey package
Your calibration model has one linear predictor, so it only has two
parameters, but you have specified three population totals. A slightly
different setup should work; try again with:
st <- factor(1:3, levels=c(3, 1:2))
pop<-c('(Intercept)'=100, st1=10, st2=20)
James Reilly
Department of Statistics, University of Auckland
Private Bag 92019, Auckland, New Zealand
On 25/11/07 6:47 AM, eugen pircalabelu wrote:> Hi R-users!
> Can anyone tell me what this error message refers to exactly
>
>> a<-c('m','f','m')
>> b<-c(1:3)
>> st<-c(1:3)
>> data.frame(a,b,st)
> a b st
> 1 m 1 1
> 2 f 2 2
> 3 m 3 3
>> data.frame(a,b,st)->l
>> p<-svydesign(ids=~1, data=l)
>> pop<-c('(intercept)'=100, st1=10,st2=20)
>> calibrate(p,~st, pop)
> Error in regcalibrate.survey.design2(design, formula, population,
aggregate.stage = aggregate.stage, :
> Population and sample totals are not the same length.
>
> Thank you and have a great day!
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.