[R] correlation matrix o

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Wed Dec 8 16:09:09 CET 2004

Hi Liliana,

how about the following:

p <- 10 # assume a 10-dim normal
H <- abs(outer(1:p, 1:p, "-")) # I think you |i-j|

fn <- function(rho, dat, H) -sum(log(dmvnorm(dat, sigma=rho^H)))

optimize(fn, c(-1,1), dat=rmvnorm(1000, sigma=0.5^H), H=H)

I hope it helps.


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat

----- Original Message ----- 
From: "Liliana Forzani" <lforzani at stat.umn.edu>
Cc: "R-News" <r-help at stat.math.ethz.ch>
Sent: Wednesday, December 08, 2004 3:32 PM
Subject: [R] correlation matrix o

> Hi, I have data normal with mean 0, I was wondering how to get 
> (using R)
> the best r such that the correlation matrix of my data has the form
> {r^(i-j)} where (i,j) indicate row and columm respectivly. Thanks. 
> Liliana
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list