I’ve been searching the answer but didn’t find any information about this function except the off. R docs.
If i want to calculate the values of 1-dimentional normal distribution in the same x with different means or standard deviations i’ll just call
dnorm(x, mu, sigma)
where mu and sigma will be arrays with desired means and sigmas.
Is there any way to perform same trick with dmnorm function from mnormt module, when x and mu are vectors and sigma is a covariation matrix?
P.S.: Sorry for my English, thanks for answers.
In R the collections of functions are called “packages”. If a function is not vectorized in its parameters, you can pass it one parameter as a vector with
sapplyor as a parallelized set of list withmapply. So you should consider the mathematical issue, especially that the ‘mean’ is no longer a single number but rather a vector, and that sigma (whichdmnormis calling ‘varcov’)is no longer a single number but rather a matrix. The first example in the help page gives you the densities of 21 different x,y,z’s and a single mean vector and sigma matrix.Using that example as a starting point, make a list of 7 x,y,x and 7 varying means and sigmas and then
mapplyit to the first 7 items in the xyz’s :