Dear R list,

I am trying to plot the curve of a function.

Here's the R code:

library(mvtnorm)

p <- function(x, mu){
   mu <- c(mu, 0)
   dmvnorm(c(x, 1), mu, diag(2))
}

> curve(p(x, 2), from = 0, to =1)
Error in dmvnorm(c(x, 1), mu, diag(2)) :
  mean and sigma have non-conforming size

I think my matrix probably have different size inside curve(), maybe I need
to use apply()?  I am not sure.

Thanks so much!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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