Generate 3D plot of Cusp Catatrophe Model Fit

Description

This function generates a 3D display of the fit (object) of a cusp model.

Usage

1
2
3
4
5
6
cusp3d(y, alpha = if (!missing(y) && is.list(y)) y$lin[, "alpha"],
    beta = if (!missing(y) && is.list(y)) y$lin[, "beta"], w = 0.03,
    theta = 170, phi = 35, B = 4, Y = 3, Yfloor = -15,
    np = 180, n.surface = 30, surface.plot = TRUE,
    surf.alpha = 0.75, surf.gamma = 1.5, surf.chroma = 35, surf.hue = 240,
    surf.ltheta = 0, surf.lphi = 45, ...)

Arguments

y

object returned by cusp or a vector of observed state values

alpha

vector of normal/symmetry factor values corresponding to the state values in y

beta

vector of bifurcation/splitting factor values corresponding to the state values in y

w

number that specifies the size of the data points plotted on the cusp surface

theta, phi

angles defining the viewing direction. theta gives the azimuthal direction and phi the colatitude.

B

range of the splitting factor axis

Y

range of the state variable axis

Yfloor

location on state variable axis where the control surface is plotted

np

factor that determines the fineness of the drawing

n.surface

factor that determines the fineness of the rendered surface

surface.plot

plot the surface?

surf.alpha

transparency level of rendered surface

surf.gamma

factor that determines the shading of surface facets (surf.gamma<1 deminishes shading, surf.gamma>1 exagerates shading)

surf.chroma, surf.hue

chroma and hue of surface color (see hcl)

surf.ltheta, surf.lphi

the surface is shaded as though it was being illuminated from the direction specified by azimuth surf.ltheta and colatitude surf.lphi

...

named parameters that are pased to persp

Details

This function is experimental.

Value

cusp3d returns the viewing transformation matrix, say VT, a 4 x 4 matrix suitable for projecting 3D coordinates (x,y,z) into the 2D plane using homogeneous 4D coordinates (x,y,z,t). It can be used to superimpose additional graphical elements on the 3D plot, by lines() or points(), using the simple function trans3d().

Note

Currently still somewhat buggy.

Author(s)

Raoul Grasman

References

See cusp-package

See Also

persp, plot.cusp, cusp3d.surface

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(123)
x1 = runif(150)
x2 = runif(150)
z = Vectorize(rcusp)(1, 4*x1-2, 4*x2-1)
data <- data.frame(x1, x2, z)
fit <- cusp(y ~ z, alpha ~ x1+x2, beta ~ x1+x2, data)
## Not run: 
cusp3d(fit)

## End(Not run)