deff: Design Effect and Intra-cluster Correlation

Description Usage Arguments Value Author(s) See Also Examples

View source: R/deff.s

Description

Computes the Kish design effect and corresponding intra-cluster correlation for a single cluster-sampled variable

Usage

1
deff(y, cluster)

Arguments

y

variable to analyze

cluster

a variable whose unique values indicate cluster membership. Any type of variable is allowed.

Value

a vector with named elements n (total number of non-missing observations), clusters (number of clusters after deleting missing data), rho(intra-cluster correlation), and deff (design effect).

Author(s)

Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com

See Also

bootcov, robcov

Examples

1
2
3
4
set.seed(1)
blood.pressure <- rnorm(1000, 120, 15)
clinic <- sample(letters, 1000, replace=TRUE)
deff(blood.pressure, clinic)

Example output

Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

           n     clusters          rho         deff 
1.000000e+03 2.600000e+01 1.439064e-03 1.054975e+00 

Hmisc documentation built on Feb. 28, 2021, 9:05 a.m.