make.data: Basic function for simulating bivariate data

Description Usage Arguments Details Value Author(s) Examples

View source: R/make.data.R

Description

Basic function for simulating bivariate data

Usage

1
2
make.data(cor = NULL, means, sds, n, names = c("X", "Y"),
  groups = c("A", "B"), digits = 0, cap = NULL)

Arguments

cor

The correlation coefficient between the Y and X

means

A vector of length two that indicates the mean of Y and X, respectively

sds

A vector of length two that indicates the standard deviations of Y and X, respectively

n

Either a single value or a vector indicating the sample size of each group

names

The names of the Y and X variables, respectively

groups

The names of the groups

digits

The number of digits the numeric variables should be rounded to

cap

The min/max values for each of the variables, to be used for truncating scores, coded as a vector.

Details

This can model either numeric on numeric data or categorical on numeric.

Value

a simulated dataset

Author(s)

Dustin Fife

Examples

1
2
3
4
5
fake.data = make.data(cor=.6, means=c(50, 100), sds = c(15, 15), n=100, names=c("Exam Score", "IQ"))
flexplot::flexplot(IQ~Exam.score, data=fake.data)

fake.data = make.data(means = c(10, 50, 30), sds=c(4, 15, 9), n=c(20, 26, 55), names=c("Depression", "Condition"), groups=c("Control", "Medication + Therapy", "Therapy"))
flexplot::flexplot(Depression~Condition, data=fake.data)

dustinfife/fifer2 documentation built on Nov. 4, 2019, 11:04 a.m.