Description Details Author(s) References Examples
Fits cusp catastrophe to data using Cobb's maximum likelihood method with a different algorithm. The package contains utility functions for plotting, and for comparing the model to linear regression and logistic curve models. The package allows for multivariate response subspace modelling in the sense of the GEMCAT software of Oliva et al.
Package: | cusp |
Type: | Package |
Version: | 2.0 |
Date: | 2008-02-14 |
License: | GNU GPL v2 (or higher) |
This package helps fitting Cusp catastrophy models to data, as advanced in Cobb et al. (1985). The main functions are
cusp | Fit Cobb's Cusp catastrophe model; see example below. |
summary.cusp | Summary statistics of cusp model fit. |
confint.cusp | Confidence intervals for parameter estimates |
plot.cusp | Diagnostic plots for cusp model fit |
cusp3d | 3D graphical display of cusp model fit (experimental). |
dcusp | Density of Cobb's cusp distribtution |
pcusp | Cumulative probability function of Cobb's cusp distribution |
qcusp | Quantile function of Cobb's cusp distribution |
rcusp | Sample from Cobb's cusp distribution. |
cusp.logist | Fit logistic model for bifurctation testing (experimental) |
Raoul Grasman <rgrasman@uva.nl>
L. Cobb and S. Zacks (1985) Applications of Catastrophe Theory for Statistical Modeling in the Biosciences (article), Journal of the American Statistical Association, 392:793–802.
P. Hartelman (1996). Stochastic Catastrophy Theory. Unpublished PhD-thesis.
H. L. J. van der Maas, R. Kolstein, J van der Pligt (2003). Sudden Transitions in Attitudes, Sociological Methods \& Research, 32:125-152.
Oliva, DeSarbo, Day, \& Jedidi. (1987) GEMCAT : A General Multivariate Methodology for Estimating Catastrophe Models, Behavioral Science, 32:121-137.
R. P. P. P. Grasman, H. L. J. van der Maas, \& E-J. Wagenmakers (2009). Fitting the Cusp Catastrophe in R: A cusp Package Primer. Journal of Statistical Software 32(8), 1-28. URL http://www.jstatsoft.org/v32/i08/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | set.seed(123)
# fitting cusp to cusp data
x <- rcusp(100, alpha=0, beta=1)
fit <- cusp(y ~ x, alpha ~ 1, beta ~ 1)
print(fit)
# example with regressors
## Not run:
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)
print(fit)
summary(fit)
plot(fit)
cusp3d(fit)
## End(Not run)
# use of OK
npar <- length(fit$par)
## Not run:
while(!fit$OK) # refit if necessary until convergence is OK
fit <- cusp(y ~ z, alpha ~ x1+x2, beta ~ x1+x2, data, start=rnorm(npar))
## End(Not run)
## Not run:
# example 1 from paper
data(attitudes)
data(attitudeStartingValues)
fit.attitudes <- cusp(y ~ Attitude, alpha ~ Orient + Involv, beta ~ Involv,
data = attitudes, start=attitudeStartingValues)
summary(fit.attitudes)
plot(fit.attitudes)
cusp3d(fit.attitudes, B = 0.75, Y = 1.35, theta = 170, phi = 30, Yfloor = -9)
## End(Not run)
|
Call: cusp(formula = y ~ x, alpha = alpha ~ 1, beta = beta ~ 1)
Coefficients:
a[(Intercept)] b[(Intercept)] w[(Intercept)] w[x]
-0.1385 1.4992 -0.1348 1.0584
Degrees of Freedom: 99 Total (i.e. Null); 96 Residual
Null Deviance: 129.4
Delay Deviance: 34.52 AIC: 261.5
Call: cusp(formula = y ~ z, alpha = alpha ~ x1 + x2, beta = beta ~ x1 + x2, data = data)
Coefficients:
a[(Intercept)] a[x1] a[x2] b[(Intercept)] b[x1]
-1.84895 2.96779 0.45627 -0.59675 1.00533
b[x2] w[(Intercept)] w[z]
3.76966 0.04711 1.09503
Degrees of Freedom: 149 Total (i.e. Null); 142 Residual
Null Deviance: 307.1
Delay Deviance: 77.1 AIC: 223.1
Call:
cusp(formula = y ~ z, alpha = alpha ~ x1 + x2, beta = beta ~
x1 + x2, data = data)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.27600 -0.28075 0.04203 0.33374 2.41136
Coefficients:
Estimate Std. Error z value Pr(>|z|)
a[(Intercept)] -1.84895 0.35112 -5.266 1.40e-07 ***
a[x1] 2.96779 0.46664 6.360 2.02e-10 ***
a[x2] 0.45627 0.29906 1.526 0.127
b[(Intercept)] -0.59675 0.57007 -1.047 0.295
b[x1] 1.00533 0.66945 1.502 0.133
b[x2] 3.76966 0.50438 7.474 7.79e-14 ***
w[(Intercept)] 0.04711 0.06231 0.756 0.450
w[z] 1.09503 0.04144 26.426 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Null deviance: 307.100 on 149 degrees of freedom
Linear deviance: 136.567 on 146 degrees of freedom
Logist deviance: NA on NA degrees of freedom
Delay deviance: 77.104 on 142 degrees of freedom
R.Squared logLik npar AIC AICc BIC
Linear model 0.4667668 -205.8043 4 419.6086 419.8845 431.6512
Cusp model 0.7519607 -103.5558 8 223.1116 224.1329 247.1967
---
Note: R.Squared for cusp model is Cobb's pseudo-R^2. This value
can become negative.
Chi-square test of linear vs. cusp model
X-squared = 204.5, df = 4, p-value = 0
Number of optimization iterations: 46
Call:
cusp(formula = y ~ Attitude, alpha = alpha ~ Orient + Involv,
beta = beta ~ Involv, data = attitudes, start = attitudeStartingValues)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.67547 -0.71609 -0.03732 0.55902 2.62736
Coefficients:
Estimate Std. Error z value Pr(>|z|)
a[(Intercept)] 0.15271 0.56218 0.272 0.7859
a[Orient] 0.46210 0.06414 7.204 5.83e-13 ***
a[Involv] 0.09736 0.05445 1.788 0.0738 .
b[(Intercept)] 0.12397 0.38643 0.321 0.7484
b[Involv] 0.22738 0.02993 7.597 3.02e-14 ***
w[(Intercept)] 0.10543 0.24485 0.431 0.6668
w[Attitude] 0.87758 0.06682 13.134 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Null deviance: 1067.4 on 1386 degrees of freedom
Linear deviance: 1204.6 on 1383 degrees of freedom
Logist deviance: NA on NA degrees of freedom
Delay deviance: 1183.2 on 1380 degrees of freedom
R.Squared logLik npar AIC AICc BIC
Linear model 0.13086701 -1870.298 4 3748.596 3748.625 3769.535
Cusp model -0.09743411 -1804.883 7 3623.765 3623.847 3660.410
---
Note: R.Squared for cusp model is Cobb's pseudo-R^2. This value
can become negative.
Chi-square test of linear vs. cusp model
X-squared = 130.8, df = 3, p-value = 0
Number of optimization iterations: 21
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.