Try this code:
# Standard deviations and correlation
sig_x <- 1
sig_y <- 2
rho_xy <- 0.7
# Covariance between X and Y
sig_xy <- rho_xy * sig_x *sig_y
# Covariance matrix
Sigma_xy <- matrix(c(sig_x ^ 2, sig_xy, sig_xy, sig_y ^ 2), nrow = 2,
ncol = 2)
# Load the mvtnorm package
library("mvtnor
Please look at my book
Statistical Analysis and Data Display
https://www.springer.com/us/book/9781493921218
Figures 3.8, 3.9, 3.10
The code for these figures is available in the HH package
install.packages("HH")
library(HH)
HHscriptnames(3) ## this gives the filename on your computer containing
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of JEFFERY
> REICHMAN
> # Standard deviations and correlation
> sig_x <- 1
> sig_y <- 1
> rho_xy <- 0.0
>
> # Covariance between X and Y
> sig_xy <- rho_xy * sig_x *sig_y
>
> # Covariance matrix
> Sig
R-Help
I am attempting to create a series of bivariate normal distributions. So using
the mvtnorm library I have created the following code ...
# Standard deviations and correlation
sig_x <- 1
sig_y <- 1
rho_xy <- 0.0
# Covariance between X and Y
sig_xy <- rho_xy * sig_x *sig_y
# Covariance m
4 matches
Mail list logo