datsim: Simulation of data

Description Usage Arguments Value Examples

View source: R/datsim.R

Description

Creates a data frame consisting of pairs (x, y) where the first component is distributed according to a given probability density and y satisfies y = m(x) + e where e is a normally distributed error term.

Usage

1
datsim(dens, m, n)

Arguments

dens

a probability density on [0,1]

m

a regression function

n

a numeric value, specifying the number of pairs of values to be generated

Value

an n x 2-data.frame

Examples

1
2
3
4
5
#define a density on [0,1]
dens1 <- function(x) 1 + 0.5 * sin(2 * pi * x)
#using the log-function as regression function
datasim1 <- datsim(dens1, log, 50)
datasim1

nschaefer1211/OSE documentation built on Dec. 31, 2020, 12:59 a.m.