# std: Generates sample trivariate data set. In matie: Measuring Association and Testing Independence Efficiently

## Description

This function generates a sample trivariate data set.

## Usage

 `1` ```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

## 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.

## Value

Returns an n x 3 trivariate data set.

## Note

See examples below on how to set up user defined functions.

## Author(s)

Ben Murrell, Dan Murrell & Hugh Murrell.

## References

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

## See Also

`ma` `sbd`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ``` 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) ```

### Example output

```[1] 0.6340628
```

matie documentation built on May 2, 2019, 3:52 a.m.