Skip to contents

This function calculates the Rao-Scott adjustment for clustered binary data to account for intra-cluster correlation when analyzing dose-response relationships.

Usage

get_RS_adj_val(group, replicate, affected, total)

Arguments

group

Vector of treatment group identifiers

replicate

Vector of replicate/tank identifiers within treatment groups

affected

Vector of counts of affected subjects (fish with injuries) in each replicate

total

Vector of total subjects (fish) in each replicate

Value

A tibble containing the following columns:

grp

Treatment group identifier

x

Total number of affected subjects in the treatment group

n

Total number of subjects in the treatment group

m

Number of replicates in the treatment group

p_hat

Estimated proportion of affected subjects in the treatment group

b

Binomial variance of p_hat

v

Estimated variance accounting for clustering

D

Design effect (ratio of cluster-adjusted variance to binomial variance)

n_tilde

Adjusted sample size accounting for clustering

x_tilde

Adjusted number of affected subjects accounting for clustering

Details

The function is modified based on the function written by Allen Olmstead. It first aggregates data by treatment group to calculate overall proportions. It then computes the variance within each treatment group accounting for clustering, and calculates a design effect (D) as the ratio of cluster-adjusted variance to binomial variance. The sample size and affected counts are then adjusted by dividing by this design effect.

Author

Allen Olmstead