I have the following function, a MSE calc based on some Multivariate normals:

MV.MSE<-function(n,EP,X,S){ 
           (dmvnorm(X,mean=rep(0,2),I+S+EP)-dmvnorm(X,mean=rep(0,2),I+S))^2 
+
           1/n*(dmvnorm(X,mean=rep(0,2),1+S+EP/2)*det(4*pi*EP)^-.5- 
           (dmvnorm(X,mean=rep(0,2),I+S+EP ))^2)}

I can get the  MV.MSE for given values of the function e.g
         MV.MSE(10,diag(0.5,2),c(.25,.25),diag(1,2))

But I would like to how MV.MSE varies for different EP matrices. I tried
this,
         ep<-seq(0,10,by=.01)
         EP <- lapply(ep, function(d) diag(d, 2)) # thanks Joshua, Mark!
         MV.MSE(10,EP,c(.25,.25),diag(1,2))

but got this error: *Error in diag(1, 2) + S + EP : non-numeric argument to
binary operator*

Any help would be most welcome!

Meddee


--
View this message in context: 
http://r.789695.n4.nabble.com/Multivariate-Normal-Help-wanted-tp3779831p3779831.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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