R语言survey包 svydesign函数使用说明 您所在的位置:网站首页 R语言怎么下载survey包 R语言survey包 svydesign函数使用说明

R语言survey包 svydesign函数使用说明

2023-10-25 05:38| 来源: 网络整理| 查看: 265

返回R语言survey包函数列表

功能\作用概述:

指定复杂的测量设计。

语法\用法:

svydesign(ids, probs=NULL, strata = NULL, variables = NULL, fpc=NULL,data = NULL, nest = FALSE, check.strata = !nest, weights=NULL,pps=FALSE,...)## Default S3 method:svydesign(ids, probs=NULL, strata = NULL, variables = NULL, fpc=NULL,data = NULL, nest = FALSE, check.strata = !nest, weights=NULL, pps=FALSE,variance=c("HT","YG"),...)## S3 method for class 'imputationList'svydesign(ids, probs = NULL, strata = NULL, variables = NULL, fpc = NULL, data, nest = FALSE, check.strata = !nest, weights = NULL, pps=FALSE, ...)## S3 method for class 'character'svydesign(ids, probs = NULL, strata = NULL, variables = NULL, fpc = NULL, data, nest = FALSE, check.strata = !nest, weights = NULL, pps=FALSE, dbtype = "SQLite", dbname, ...)

参数说明:

ids : 指定从最大级别到最小级别的群集ID的公式或数据帧,~0或~1是无群集的公式。

probs : 指定整群抽样概率的公式或数据帧

strata : 公式或向量指定地层,使用空为无地层

variables : 公式或数据框,指定调查中测量的变量。如果为NULL,则使用数据参数。

fpc : 有限总体校正:详见下文

weights : 指定抽样权重作为问题替代的公式或向量

data : 用于在formulaarguments、数据库表名或imputationList对象中查找变量的数据框,请参见下文

nest : 如果为TRUE,则重新标记集群ID以强制层内嵌套

check.strata : 如果为TRUE,请检查集群是否嵌套在内部

示例\实例:

data(api)# stratified sampledstrat< - svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)# one-stage cluster sampledclus1< - svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)# two-stage cluster sample: weights computed from population sizes.dclus2< - svydesign(id=~dnum+snum, fpc=~fpc1+fpc2, data=apiclus2)

## multistage sampling has no effect when fpc is not given, so## these are equivalent.dclus2wr< - svydesign(id=~dnum+snum, weights=weights(dclus2), data=apiclus2)dclus2wr2< - svydesign(id=~dnum, weights=weights(dclus2), data=apiclus2)

## syntax for stratified cluster sample##(though the data weren't really sampled this way)svydesign(id=~dnum, strata=~stype, weights=~pw, data=apistrat,nest=TRUE)

## PPS sampling without replacementdata(election)dpps< - svydesign(id=~1, fpc=~p, data=election_pps, pps="brewer")

##database example: requires RSQLite## Not run: library(RSQLite)dbclus1< - svydesign(id=~dnum, weights=~pw, fpc=~fpc,data="apiclus1",dbtype="SQLite", dbname=system.file("api.db",package="survey"))

## End(Not run)



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有