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: [EMAIL PROTECTED]
homepage: http://www.education.wisc.edu/edpsych/facstaff/kaplan/kaplan.htm
Phone: 608-262-0836

______________________________________________
[email protected] 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