[R] Multivariate Normal: Help wanted!

meddee meddee1000 at gmail.com
Wed Aug 31 00:01:42 CEST 2011


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.



More information about the R-help mailing list