Learn R Programming

matie (version 1.2)

std: Generates sample trivariate data set.

Description

This function generates a sample trivariate data set.

Usage

std(func,xMin,xMax,yMin,yMax,n,Rsq)

Arguments

func
a user supplied function of two variables, z = func(x,y), near which data is generated
xMin
min value for the x domain of func
xMax
max value for the x domain of func
yMin
min value for the y domain of func
yMax
max value for the y domain of func
n
number of sample points to generate
Rsq
coefficient of determination for the data set

Value

Returns an n x 3 trivariate data set.

Details

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

References

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

See Also

ma sbd

Examples

Run this code
    f <- function(x,y,name="MexicanHat", def="z=(1-t^2)exp(-t^2div2), t^2=x^2+y^2"){
      t <- sqrt(x^2 + y^2)
      z <- (1.0 - t^2) * exp(- t * t / 2)
      return(z)
    }
    d <- std(f, xMin=-2, xMax=2, yMin=-2, yMax=2, n=500, Rsq=0.85)
    ma(d)$A
    # if you have rgl you can view the data set in 3D 
    # library("rgl")  
    # plot3d(d)

Run the code above in your browser using DataLab