Learn R Programming

matie (version 1.2)

sbd: Generates sample bivariate data.

Description

This function generates a sample bivariate data set.

Usage

sbd(func,min,max,n,Rsq)

Arguments

func
a user supplied function of one variable, y = func(x), near which data is generated.
min
min value for the domain of func
max
max value for the domain of func
n
number of sample points to generate
Rsq
coefficient of determination for the data set

Value

Returns an n x 2 bivariate data set

Details

If func is NULL then a normal bivariate data set of n samples is generated with correlation coefficient sqrt(Rsq). If func is passed by the user then n sample points are scattered about y=func(x) with variance governed by the Rsq parameter

References

Discovering general multidimensional associations, http://arxiv.org/abs/1303.1828

See Also

ma

Examples

Run this code
    f <- function(x,name="Sinusoidal",def="y = 1 + sin(x)"){
      return(1 + sin(x))
    }
    d <- sbd(f,min=-2*pi,max=2*pi,n=500,Rsq=0.9)
    ma(d)$A
    plot(d)

Run the code above in your browser using DataLab