Reputation: 701
The signature of the dmvnorm
function in the mvtnorm R package is:
dmvnorm(x, mean = rep(0, p), sigma = diag(p), log = FALSE)
In the description, the x argument is the vector or matrix of quantiles. If the means and covariance matrix is provided, then this should be enough to define the distribution, so why is quartile information required?
Example usage with 2d distribution:
cbind(map_data$X, map_data$Y)
x_mean <- mean(map_data$X)
y_mean <- mean(map_data$Y)
covar <- var(cbind(map_data$X, map_data$Y))
dmvnorm(x = ?, mean = c(x_mean, y_mean), sigma = covar)
What is the x argument for and why is this required?
Upvotes: 3
Views: 2138
Reputation: 8252
dmvnorm
doesn't return a function; it evaluates the density where ever you tell it to.
The x-argument contains the values at which you want the density function evaluated.
Upvotes: 5