dmnorm | R Documentation |
Prediction of the normal probability density of multivariate observations.
dmnorm(X = NULL, mu = NULL, sigma = NULL)
## S3 method for class 'Dmnorm'
predict(object, X, ...)
X |
For |
mu |
The mean ( |
sigma |
The covariance matrix ( |
object |
A result of a call to |
... |
Optional arguments. |
See the examples.
data(iris)
X <- iris[, 1:2]
## Distribution of the class "Setosa"
Xtrain <- X[1:40, ]
Xtest <- X[40:50, ]
fm <- dmnorm(Xtrain)
fm
k <- 50
x1 <- seq(min(Xtrain[, 1]), max(Xtrain[, 1]), length.out = k)
x2 <- seq(min(Xtrain[, 2]), max(Xtrain[, 2]), length.out = k)
zX <- expand.grid(x1, x2)
pred <- predict(fm, zX)$pred
contour(x1, x2, matrix(pred, nrow = 50))
points(Xtest, col = "red", pch = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.