sim_curve: Generate data from quadratic curve

Description Usage Arguments Value Examples

View source: R/ltt_pvals.R

Description

Function to simulate from quadratic curve

Usage

1
sim_curve(n, b0, b1, b2, sd = 1, range = c(-3, 3))

Arguments

n

sample size

b0

intercept of curve

b1

first order poly term

b2

second order poly term

sd

standard deviation for random noise around curve

range

range of x values over which to generate data

Value

dataframe of simulated x,y pairs

Examples

1
2
3
curve_dat <- sim_curve(n=100, b0=0, b1=0, b2=.3, sd=2.6, range=c(-3,3))
plot(curve_dat)
summary(lm(y ~ I(x^2), data=curve_dat))

kmaurer/teaTasteR documentation built on Jan. 22, 2020, 5:18 a.m.