Displaying 1 result from an estimated 1 matches for "pmat1".
Did you mean:
mat1
2006 Mar 11
2
Draw level lines on the surface of a bivariate function
...list(x = tr[,1]/tr[,4], y= tr[,2]/tr[,4])
}
mean1 = c(2,4)
cov1 = matrix(c(0.7, 0.2,0.2,0.7), ncol=2)
x = seq(0, 5, by = 0.1)
y = seq(0,10, by= 0.1)
z = matrix(nrow = length(x), ncol=length(y))
for(i in 1:length(x))
for(j in 1:length(y))
{
z[i,j]=dmvnorm(c(x[i],y[j]),mean1,cov1)
}
pmat1 = persp(x, y, z, col= "red",shade = 0.25, border=NA)
lev =contourLines(x,y,z, nlevel = 10)
for(i in 1:length(lev))
lines(trans3d(lev[[i]]$x, lev[[i]]$y, lev[[i]]$level, pmat1), col="black")
--