Description Usage Arguments Details Value Author(s) See Also Examples
Provides the fuzzy probability matrix and classification vector for inputted observations assuming the model provided by the teigen
object.
1 2 |
object |
An object of class |
newdata |
Data frame or matrix of new observations on the same variables used in the fitting of the |
modelselect |
A character string of either |
... |
Arguments to be passed to other functions. |
Note that the scale argument from the teigen
object is passed along to the predict
function. See examples below for plotting.
fuzzy |
Matrix of fuzzy classification probabilities |
classification |
Vector of maximum a posteriori classifications |
Jeffrey L. Andrews
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 | set.seed(2521)
ind <- sample(1:nrow(faithful), 20)
set.seed(256)
tfaith_unscaled <- teigen(faithful[-ind,], models = "UUUU", Gs = 2, verbose = FALSE, scale=FALSE)
pred_unscaled <- predict(tfaith_unscaled, faithful[ind,])
set.seed(256)
tfaith_scaled <- teigen(faithful[-ind,], models = "UUUU", Gs = 2, verbose = FALSE, scale=TRUE)
pred_scaled <- predict(tfaith_scaled, faithful[ind,])
identical(pred_unscaled$classification, pred_scaled$classification)
##Plotting UNSCALED
plot(tfaith_unscaled, what="contour")
points(faithful[ind,1], faithful[ind,2], pch=15)
plotcolours <- rainbow(tfaith_unscaled$G)
points(faithful[ind,1], faithful[ind,2], pch=20, col=plotcolours[pred_unscaled$classification])
##Plotting SCALED
plot(tfaith_scaled, what="contour")
points((faithful[ind,1]-tfaith_scaled$info$scalemeans[1])/tfaith_scaled$info$scalesd[1],
(faithful[ind,2]-tfaith_scaled$info$scalemeans[2])/tfaith_scaled$info$scalesd[2],
pch=15)
plotcolours <- rainbow(tfaith_scaled$G)
points((faithful[ind,1]-tfaith_scaled$info$scalemeans[1])/tfaith_scaled$info$scalesd[1],
(faithful[ind,2]-tfaith_scaled$info$scalemeans[2])/tfaith_scaled$info$scalesd[2],
pch=20, col=plotcolours[pred_scaled$classification])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.