createresponse: generate a response variable, given ranks and effect size

Description Usage Arguments Details Value Examples

View source: R/createresponse.R

Description

generate a response variable, given ranks and effect size

Usage

1
createresponse(ranks, Nmulti, effectsize, error)

Arguments

ranks

a named vector with the ranks (and individual IDs as name); typically the output from datagenfunc

Nmulti

integer, the number of observations to create per individual

effectsize

numeric, the effect size

error

numeric, the error

Details

the function calculates a response variable with the following formula:

resp = effectsize * ranks + rnorm(..., mean = 0, sd = error)

in addition, a random intercept is generated:

random intercept = rnorm(length(ranks))

Value

a data.frame with length(ranks) * Nmulti rows

Examples

1
2
3
4
ranks <- 1:4
names(ranks) <- LETTERS[1:4]
xdata <- createresponse(ranks, 2, effectsize = 2, error = 0.5)
plot(xdata$rank, xdata$response)

gobbios/radagio documentation built on Dec. 26, 2019, 6:13 p.m.