Dear R users, I know of the possibility to import bitmaps via the nice pixmap library. But if you later on create a PDF it is somewhat disappointing to have such graphics bitmapped. Is there a trick (via maps?) to import a vector graphic and have them plotted onto a graph? My searching attempts in the searchable r-help archive did not seem to result in anything useful... Cheers, hinrich d8-)
On Tue, 7 Dec 2004, Hinrich G??hlmann wrote:> Dear R users, > > I know of the possibility to import bitmaps via the nice pixmap library. > But if you later on create a PDF it is somewhat disappointing to > have such graphics bitmapped. Is there a trick (via maps?) to import a > vector graphic and have them plotted onto a graph? My searching attempts > in the searchable r-help archive did not seem to result in anything > useful...No, nothing obvious. If you have an Xfig file - or convert to one from PS, you may be able to extract the lines with their attributes by hand (the file is just text, so you can "see" the vector graphics), and write an R function to plot them (rescaled) onto the device if you need a single graphical element many times. Otherwise, perhaps edit the graphics file after R has completed its work. None of the vector map formats is easy to use for this kind of trick, especially because you probably need attributes on the lines (thickness, colour).> > Cheers, > hinrich d8-) >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no
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| library(mvtnorm) 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. Best, Dimitris ---- 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 http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm ----- 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 >
Liliana Forzani wrote:>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 > > >Thats the correlation matrix for an autoregressive(1) process, with equal time increments. So you could use arima with your regressors in xreg and ar1 structure, or package nlme with corAR1 correlation structure. Kjetil>______________________________________________ >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 > > > >-- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra
Thanks for your suggestions! Even though they are less than encouraging, I quickly want to give you the rational why I have asked this. Actually I was inspired by Paul Murrell's useR presentation - have a look at the very last slide of his presentation which you can find at http://www.stat.auckland.ac.nz/~paul/Talks/useR2004.pdf - If only this kind of functionality could be generalized to any vector graphics... Oh, well, still pixmap gives a solution for the moment and that's ok. Thanks again! Cheers, hinrich d8-) Roger Bivand wrote:> On Tue, 7 Dec 2004, Hinrich G??hlmann wrote: > > >>Dear R users, >> >>I know of the possibility to import bitmaps via the nice pixmap library. >> But if you later on create a PDF it is somewhat disappointing to >>have such graphics bitmapped. Is there a trick (via maps?) to import a >>vector graphic and have them plotted onto a graph? My searching attempts >>in the searchable r-help archive did not seem to result in anything >>useful... > > > No, nothing obvious. If you have an Xfig file - or convert to one from PS, > you may be able to extract the lines with their attributes by hand (the > file is just text, so you can "see" the vector graphics), and write an R > function to plot them (rescaled) onto the device if you need a single > graphical element many times. Otherwise, perhaps edit the graphics file > after R has completed its work. None of the vector map formats is easy to > use for this kind of trick, especially because you probably need > attributes on the lines (thickness, colour). > > >>Cheers, >>hinrich d8-) >> > >