Message-ID: <CAOwvMDzX6ynvk3BiEEP=wkd-b2V2om9sJ39qe0+owTE8Xbt2kA@mail.gmail.com>
Date: 2017-01-01T15:00:27Z
From: Anthony Damico
Subject: how to extract weighted data in "survey" package
In-Reply-To: <DM3PR13MB065282B9229E45F06A9BD22DFA6C0@DM3PR13MB0652.namprd13.prod.outlook.com>
# load the survey library
library(survey)
# load the apistrat data.frame
data(api)
# look at the first six records
head(apistrat)
# look at the weight column only
apistrat$pw
On Sun, Jan 1, 2017 at 9:49 AM, Kristi Glover <kristi.glover at hotmail.com>
wrote:
> Hi R Users,
>
> Happy New Year
>
>
> I wanted to see the data after raw data was adjusted/weighted but I could
> not get it. Any suggestions?
>
> I would like to see which data points got more weight after the design was
> used.
>
>
> I have given you an example what I tried but I was not successful .
>
>
> Thanks
>
>
> library(survey)
>
> data(api)
>
>
> rawData<-data.frame(API00=apistrat$api00, API99=apistrat$api99)
>
> head(rawData)
>
> dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat,
> fpc=~fpc)
>
> svyplot(api00~api99, design=dstrat, style="bubble")
>
>
> adjustedData<-data.frame(API00=(~api00, design=dstrat),API99=(~api99,
> design=dstrat ))
>
> head(adjustedData)
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
[[alternative HTML version deleted]]