[R] 3d graph question

David Kaplan dkaplan at education.wisc.edu
Thu May 17 21:42:08 CEST 2007


Hi, this is simple,

I've generated a bivariate normal distribution with a known correlation. 
  I want to plot the density function with p(y,x) on the vertical axis 
and x, and y on the horizontal axes.  How is that done? Thanks in advance!


library(MASS)
mu <- c(0,1) # mean vector
sigma <- matrix(c(1,.8,.8,1), ncol=2)
tmp <- mvrnorm(1000, mu, sigma)
cor(tmp)
plot(tmp,ylab='achievement', xlab='ses') # plot data

-- 
===========================================================================
David Kaplan, Ph.D.
Professor
Department of Educational Psychology
University of Wisconsin - Madison
Educational Sciences, Room, 1061
1025 W. Johnson Street
Madison, WI 53706

email: dkaplan at education.wisc.edu
homepage: http://www.education.wisc.edu/edpsych/facstaff/kaplan/kaplan.htm
Phone: 608-262-0836



More information about the R-help mailing list