Skip to content
Prev 361886 / 398506 Next

svykappa using the survey package

hi pradip, this should give you what you want


    library(foreign)
    library(survey)

    tf <- tempfile()

    download.file( "
https://meps.ahrq.gov/mepsweb/data_files/pufs/h163ssp.zip" , tf , mode =
'wb' )

    z <- unzip( tf , exdir = tempdir() )

    x <- read.xport( z )

    names( x ) <- tolower( names( x ) )

    design <- svydesign(id=~varpsu,strat=~varstr, weights=~perwt13f,
data=x, nest=TRUE)

    # include missings as "No" values here
    design <-
        update(design,
            xbpchek53 = ifelse(bpchek53 ==1,'yes','no or missing'),
            xcholck53 = ifelse(cholck53 ==1, 'yes','no or missing')
        )

    # subset out records that were missing for either variable
    svykappa( ~ xbpchek53 + xcholck53 , subset(design, bpchek53 > 0 &
cholck53 > 0 ) )


















On Mon, Jun 20, 2016 at 7:49 PM, Muhuri, Pradip (AHRQ/CFACT) <
Pradip.Muhuri at ahrq.hhs.gov> wrote:

            

  
  
Message-ID: <CAOwvMDxq8-E2+UZc2sQpv=PRa9ZuA6djqPOn=CrjnC2GGbWMew@mail.gmail.com>
In-Reply-To: <BN1PR09MB03050FCD28F9620F5A3449BAD32A0@BN1PR09MB0305.namprd09.prod.outlook.com>