On 28/07/12 05:45, Anders Holm wrote:
Dear list members



I need a function that calculates the bivariate normal distribution for each observation. 
It is part of a likelihood function and I have 1000's of cases. As I understand it I 
cannot use packages like "mvtnorm" because it requres a covariance matrix of 
the same dimension as the number of observations.

    Huh?  Where ever did you get that idea?  (Makes no sense at all,
    as far as I can see.)
Basically what I need is a function that takes as arguments a n*2 matrix of 
bivariate values given a common mean and covariance matrix, where n is the 
number of cases and which returns a n*1 vector of the probabilities of the 
bivariate normal distribution of the n*2 vector of values.

    Sorry, I must be a bit dim, but I don't follow this at all.

    Anyhow, either dmnorm() from the "mnormt" package or
    dmvnorm() from the "mvtnorm" package should, properly applied,
    do everything that you want.

        cheers,

            Rolf

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to