[R] Test of Significance for overall-accuracy
Hello, I have two classifications. How can I compare the overall-accuracy of these classifications to each other? Is there a possibility within R to test if the achieved overall-accuracy for the classifications are differing significantly? Additionaly, are the McNemar-Test and Broker-Test implented in a package of R? Thank in advance for your help, Markus . Markus Schwarz Wissenschaftlicher Mitarbeiter Eidg. Forschungsanstalt WSL Zürcherstrasse 111 CH-8903 Birmensdorf Telefon +41-44-739 22 87 Fax +41-44-739 22 15 [EMAIL PROTECTED] http://www.wsl.ch/staff/markus.schwarz/ . __ R-help@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
Re: [R] Wireframe axis labels
Cashorali, Tanya wrote: Hi, I'm trying to do a surface plot using the wireframe function. Everything is working beautifully except that I want to be able to re-scale it a LOT so that I can fit ~145 labels on the x-axis or y-axis. I've tried using zoom, scales, aspect, .. nothing seems to work. The help on wireframe in R says that you can input a list of labels for any of the axes, but this has also failed. H, you can do so, but I do not believe you really want 145 labels: g - expand.grid(x = 1:145, y = 1:145, gr = 1:2) g$z - log((g$x^g$g + g$y^2) * g$gr) wireframe(z ~ x * y, data = g, groups = gr, scales = list(arrows = FALSE, at=1:145)) Uwe Ligges Thanks for any help! -Tanya [[alternative HTML version deleted]] __ R-help@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 __ R-help@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
Re: [R] R GUI's on a Mac?
Anyone who responds to Berton, please, CC me: I am also interested. Best, Philippe Grosjean Berton Gunter wrote: Folks: A question for R users on Macs. AFAIK, R's Tcl/TK tools allow one to build GUI interfaces to R's functionality across all platforms. My question: How well do the TK widget tools work on a Mac? More specifically, is there any extra difficulty or complication in porting such applications to a Mac? Is there any special requirement for the Mac OS or version? Any glitches that should give one pause? Please reply privately, as this is not of general interest to the list. Many thanks. -- Bert Gunter Genentech __ R-help@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 __ R-help@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
[R] sort of fread to read from a file at fixed positions?
Hello everybody, I need to read a file with a header (EDF files, recorded electroencephalogram signals) that has fixed byte positions for each field of its header. These fields have no separator between them, for example: 8 ascii name of the patient10ascii start time of the recording4 ascii ... etc. I read that perfectly in Octave by using fread, fseek and other C-derived file access methods, but i dont see such a method being avalaible in R? I read the scan help page but it doesn't seem to be able to read x chars then from that position read another y chars then jump at position 80 and read z chars etc. Thanks in advance, Gael de Lannoy. __ R-help@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
Re: [R] sort of fread to read from a file at fixed positions?
See ?read.fwf, and also the `R Data Import/Export Manual' that ships with every copy of R. Also, you can do in R in the way you describe for Octave with connections and readChar (again, see the manual). On Tue, 14 Mar 2006, Gael de Lannoy wrote: Hello everybody, I need to read a file with a header (EDF files, recorded electroencephalogram signals) that has fixed byte positions for each field of its header. These fields have no separator between them, for example: 8 ascii name of the patient10ascii start time of the recording4 ascii ... etc. I read that perfectly in Octave by using fread, fseek and other C-derived file access methods, but i dont see such a method being avalaible in R? I read the scan help page but it doesn't seem to be able to read x chars then from that position read another y chars then jump at position 80 and read z chars etc. Thanks in advance, Gael de Lannoy. __ R-help@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 -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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
Re: [R] Error Message from Variogram.lme Example
On Tue, 14 Mar 2006, Prof Brian Ripley wrote: So this is most likely a bug in package nlme. However, we need a reproducible example to be able to do anything about it, and without even the traceback() we cannot be sure that it is in nlme. Please follow the bug-reporting procedure. It does seem to be a bug in Variogram.lme (assuming this is the BodyWeight dataset from package nlme). The lines val - na.omit(val) val$n.pairs - as.vector(table(na.omit(cutDist))) need to be interchanged since one bin has a zero count and gets omitted. On Mon, 13 Mar 2006, Rick Bilonick wrote: When I try to run the example from Variogram with an lme object, I get an error (although summary works): R : Copyright 2005, The R Foundation for Statistical Computing Version 2.2.1 (2005-12-20 r36812) ISBN 3-900051-07-0 ... fm1 - lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat) Error: couldn't find function lme Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE) Error: couldn't find function Variogram library(nlme) fm1 - lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat) Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE) Error in $-.data.frame(`*tmp*`, n.pairs, value = c(160, 0, 160, 16, : replacement has 10 rows, data has 9 [...] Information on package 'nlme' Description: Package: nlme Version: 3.1-68.1 Date: 2006-01-05 -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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
Re: [R] how to make a contour plot in R?
Uwe Ligges wrote: Arnau Mir Torres wrote: Hello. I am an nxn data frame in the variable frame. I want to make a contour plot with it. That is, I want to plot a square of dimensions [1,n]x[1,n] with the gray level of square [i,i+1]x[j,j+1] equal to frame[i,j]. How can I make it? See ?image Uwe Ligges Thanks, Arnau. __ R-help@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 __ R-help@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 The problem is image works with matrices but I am a data frame. So, the question is: how can I transform a data frame in a matrix? Arnau. __ R-help@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
[R] VAR
Hello! I'm trying to forecast the UK exchange rate. To estimate my model I use ar() function. However, I can't get a forecast of the exchange rate using the function forecast(). Regards, Julija Kackina [[alternative HTML version deleted]] __ R-help@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
Re: [R] Numerical Derivatives in R
Spencer == Spencer Graves [EMAIL PROTECTED] on Mon, 13 Mar 2006 15:37:16 -0800 writes: Spencer Hi, Paul, Tolga, Ravi, et al.: What about using Spencer splines to compute both derivatives and integrals? That seems good and pretty obvious to me, and for that reason there have been the functions D1ss() and D2ss() in package 'sfsmisc' forever (since 1992, longer than R exists) install.package(sfsmisc) library(sfsmisc) ?D1ss ## yes, even the help file says that I wrote these in 1992 They are not as nice as you suggest below, (since at that time I knew a bit less than now :-) but might still be a useful start. Martin Maechler, ETH Zurich Spencer These could be used, for example, to summarize Spencer complicated, expensive Monte Carlo results in a Spencer relatively simple form could then be manipulated Spencer analytically and quickly converted to other forms Spencer by a variety of helper functions. Spencer For example, I'm currently struggling with a Spencer multilevel modeling application for which lmer Spencer won't help, because I can't transform it to an Spencer additive normal situation. I need to integrate out Spencer the random parameters to obtain the marginal Spencer likelihood, which I then maximize over variations Spencer in hyperparameters. This problem could be Spencer simplified by first building a multidimensional Spencer spline model over variations in the variable of Spencer integration and the hyperparameters. The resulting Spencer spline model could then be used for parameter Spencer estimation, computing confidence intervals, etc. Spencer I'd like to extend this further for modeling Spencer applications where known special cases and Spencer asymptotics might be blended and extended using Spencer spline model adjustments or interpolants. Spencer What do you think? Best Wishes, Spencer Spencer Graves Spencer Ravi Varadhan wrote: Hi Paul, Tolga, and others: I had also written some codes to compute derivatives, jacobians, and Hessians. Please see the attached file for the code. I will be happy to help out with the development of a package and/or with the documentation process. Best, Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Paul Gilbert Sent: Monday, March 13, 2006 12:09 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] Numerical Derivatives in R (This code looks vaguely familiar.) Is anyone interested in participating in an effort to make a self contained package for numerical derivatives? I would be happy to extract the Richardson extrapolation code for first and second derivatives from my package in the devel area of CRAN, but I'm a bit too busy to spend much time on it myself right now. (Also, one thing missing is good documentation, and I find it helps to have more than one person look at the documentation.) Paul Gilbert Tolga Uzuner wrote: Actually, I did implement this using richardson extrapolation, but am having trouble vectorising it. For some reason, it fails within integrate... Anyone willing to look over the below and let me know what I am doing wrong, helps much appreciated. You can cut paste the below into the console.. XX richardson.grad - function(func, x10, d=0.01, eps=1e-4, r=6, show=F){ sapply(x10,function(x){ v - 2 # reduction factor. n - length(x) # Integer, number of variables. a.mtr - matrix(1, r, n) b.mtr - matrix(1, (r - 1), n) h - abs(d*x)+eps*(x==0.0) for(k in 1:r) { # successively reduce h for(i in 1:n) { x1.vct - x2.vct - x x1.vct[i] - x[i] + h[i] x2.vct[i] - x[i] - h[i] if(k == 1) a.mtr[k,i] - (func(x1.vct) - func(x2.vct))/(2*h[i]) else{ if(abs(a.mtr[(k-1),i])1e-20) # some functions are unstable near 0.0 a.mtr[k,i] - (func(x1.vct)-func(x2.vct))/(2*h[i]) else a.mtr[k, i] - 0 } } h - h/v # Reduced h by 1/v. } if(show) { cat(\n,first order approximations, \n) print(a.mtr, 12) } for(m in 1:(r - 1)) { for(i in 1:(r - m)) b.mtr[i,]- (a.mtr[(i+1),]*(4^m)-a.mtr[i,])/(4^m-1) if(show m!=(r-1) ) { cat(\n,Richarson improvement group No. , m, \n) print(a.mtr[1:(r-m),], 12) } } a.mtr[length(a.mtr)]}) } ## try it out richardson.grad(function(x){x3},2) #works fine... should return 12. # now try integrating something simple integrate(function(i) richardson.grad(function(x) x2,i),0,1) #also works fine, but instead try this: CDFLHP -function(x,D,B)
Re: [R] how to make a contour plot in R?
Arnau Mir Torres wrote: Uwe Ligges wrote: Arnau Mir Torres wrote: Hello. I am an nxn data frame in the variable frame. I want to make a contour plot with it. That is, I want to plot a square of dimensions [1,n]x[1,n] with the gray level of square [i,i+1]x[j,j+1] equal to frame[i,j]. How can I make it? See ?image Uwe Ligges Thanks, Arnau. __ R-help@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 __ R-help@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 The problem is image works with matrices but I am a data frame. So, the question is: how can I transform a data frame in a matrix? maybe, as.matrix() data.matrix() Antonio Arnau. __ R-help@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 __ R-help@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
Re: [R] R GUI's on a Mac?
PhGr == Philippe Grosjean [EMAIL PROTECTED] on Tue, 14 Mar 2006 09:30:26 +0100 writes: PhGr Anyone who responds to Berton, please, CC me: I am PhGr also interested. Best, (but then you do read R-help, and I disagree with Berton that this should be answered in private only) PhGr Berton Gunter wrote: Folks: A question for R users on Macs. AFAIK, R's Tcl/TK tools allow one to build GUI interfaces to R's functionality across all platforms. My question: How well do the TK widget tools work on a Mac? More specifically, is there any extra difficulty or complication in porting such applications to a Mac? Is there any special requirement for the Mac OS or version? Any glitches that should give one pause? I'm really not the expert here, but John Fox' RCmdr relies on R's tcltk package, and it's true that people can well install R on the Mac without Tcl/Tk capabilities --- just seen a month ago in a course we taught. For this reason, John has added instructions (based on help from Rob Goedman) on how to install things on the Mac : http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html I think for Berton's question, the only necessary step is JFox 1) Install X11.app from Apple Install disks (this is a JFox must if you want to use any tcltk-based package with R.app). Please reply privately, as this is not of general interest to the list. Many thanks. I disagree a bit and hence reply to R-help. -- Bert Gunter Genentech Martin Maechler, ETH Zurich __ R-help@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
[R] Maximum likelihood
Hello all, I'm trying to calculate the Maximum likelihood of individuals to get the ancestry. I mixd 3 populations 15 generations in proportion of 20% 20% 60% when each population sorce have diferent genome (0 1 and 2) with frequencies for each one. So now i have individuals looks like 0 0 2 1 1 2 0 . and i don't now how to calculate the mle although i try to figure out from the package state4. can somebody help me please? Thanks [[alternative HTML version deleted]] __ R-help@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
[R] name of the graphics output
Hello. In the file list.txt, I have the name of n files in data frame format. I want to make an image for each file and save the images in pdf format. To do this, I do the following: llista = scan(file=list.txt,what=list(nom=)) for (file.name in llista[[1]]){ aux=read.table(file=file.name) aux=as.matrix(aux) pdf() image(aux) system(mv Rplots.pdf file.name.pdf) dev.off() } All is OK except for the command system(mv Rplots.pdf file.name.pdf). All the outputs names are file.name.pdf but I want to put a different name for each graphic. I have tried pdf(file=file.name.pdf) but it doesn't work. How can I make it? Thanks, Arnau. __ R-help@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
Re: [R] Constrained linear least squares
mgcv::pcls will do this, but there are other packages for quadratic programming as well. Simon On Tue, 7 Mar 2006, Domenico Vistocco wrote: Is there a function in R for constrained linear least squares? I used the matlab function LSQLIN: my aim is to obtain non-negative regression coefficients which sum 1. Thanks in advance, domenico vistocco __ R-help@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
Re: [R] how to make a contour plot in R?
Arnau Mir Torres wrote: Uwe Ligges wrote: Arnau Mir Torres wrote: Hello. I am an nxn data frame in the variable frame. I want to make a contour plot with it. That is, I want to plot a square of dimensions [1,n]x[1,n] with the gray level of square [i,i+1]x[j,j+1] equal to frame[i,j]. How can I make it? See ?image Uwe Ligges Thanks, Arnau. __ R-help@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 __ R-help@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 The problem is image works with matrices but I am a data frame. So, the question is: how can I transform a data frame in a matrix? Arnau. ?as.matrix Uwe Ligges __ R-help@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
Re: [R] name of the graphics output
On Tue, Mar 14, 2006 at 12:55:47PM +0100, Arnau Mir Torres wrote: All the outputs names are file.name.pdf but I want to put a different name for each graphic. you can use paste() to put together the command: file =foo system( paste(mv Rplots.pdf , file, .name.pdf, sep='') ) cu Philipp -- Dr. Philipp PagelTel. +49-8161-71 2131 Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 Technical University of Munich Science Center Weihenstephan 85350 Freising, Germany and Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675 GSF - National Research Center Fax. +49-89-3187 3585 for Environment and Health Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ R-help@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
Re: [R] name of the graphics output
On 3/14/2006 6:55 AM, Arnau Mir Torres wrote: Hello. In the file list.txt, I have the name of n files in data frame format. I want to make an image for each file and save the images in pdf format. To do this, I do the following: llista = scan(file=list.txt,what=list(nom=)) for (file.name in llista[[1]]){ aux=read.table(file=file.name) aux=as.matrix(aux) pdf() image(aux) system(mv Rplots.pdf file.name.pdf) dev.off() } All is OK except for the command system(mv Rplots.pdf file.name.pdf). All the outputs names are file.name.pdf but I want to put a different name for each graphic. I have tried pdf(file=file.name.pdf) but it doesn't work. Try pdf(file=paste(file.name,.pdf,sep=). Duncan Murdoch How can I make it? Thanks, Arnau. __ R-help@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 __ R-help@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
Re: [R] name of the graphics output
On Tue, Mar 14, 2006 at 01:03:22PM +0100, Philipp Pagel wrote: On Tue, Mar 14, 2006 at 12:55:47PM +0100, Arnau Mir Torres wrote: All the outputs names are file.name.pdf but I want to put a different name for each graphic. you can use paste() to put together the command: file =foo system( paste(mv Rplots.pdf , file, .name.pdf, sep='') ) Oops - of course it makes a lot more sense to put together the filename when opening the pdf device: pdf(file=paste(file, .name.pdf, sep='') ) cu Philipp -- Dr. Philipp PagelTel. +49-8161-71 2131 Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 Technical University of Munich Science Center Weihenstephan 85350 Freising, Germany and Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675 GSF - National Research Center Fax. +49-89-3187 3585 for Environment and Health Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ R-help@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
[R] Generating a PostScript graphics under Windows
Hi, I'am trying to generate a PS Graphic under Windows with a fixed location via postscript(file=C:\\test.ps) But I always become the error: unable to start device PostScript can not open 'postscript' file argument 'c:\test.ps' There must be a very simple thing, that I make wrong. Thanks in advance Sigbert Klinke __ R-help@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
Re: [R] Generating a PostScript graphics under Windows
Sigbert Klinke wrote: Hi, I'am trying to generate a PS Graphic under Windows with a fixed location via postscript(file=C:\\test.ps) But I always become the error: unable to start device PostScript can not open 'postscript' file argument 'c:\test.ps' There must be a very simple thing, that I make wrong. Thanks in advance Sigbert Klinke Did you close the device using dev.off()? postscript(file=C:\\test.ps) plot(1:10) dev.off() HTH, --sundar __ R-help@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
Re: [R] Generating a PostScript graphics under Windows
Sigbert Klinke [EMAIL PROTECTED] writes: Hi, I'am trying to generate a PS Graphic under Windows with a fixed location via postscript(file=C:\\test.ps) But I always become the error: unable to start device PostScript can not open 'postscript' file argument 'c:\test.ps' There must be a very simple thing, that I make wrong. Do you have write permissions there? (Possibly a silly question, but must be asked...) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@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
Re: [R] Generating a PostScript graphics under Windows
Sigbert Klinke wrote: Hi, I'am trying to generate a PS Graphic under Windows with a fixed location via postscript(file=C:\\test.ps) But I always become the error: unable to start device PostScript can not open 'postscript' file argument 'c:\test.ps' There must be a very simple thing, that I make wrong. Probably the file already exists and is write protected for some reason we cannot know. Uwe Ligges Thanks in advance Sigbert Klinke __ R-help@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 __ R-help@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
[R] irregular time series
Hi everybody, I'm currently working with time series: do you know if there's something like stl(package stats, seasonal decomposition of time series by loess) working also with objects of class irts? Thanks Alessandro __ R-help@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
Re: [R] Incrementing a counter in lapply
Thanks, Gabor Thomas. Apologies, but I used an example that obfuscated the question that I wanted to ask. I really wanted to know how to have extra arguments in functions that would allow, per the example code, for something like a counter to be incremented. Thomas's suggestion of using mapply (reproduced below with corrections) is probably closest. Jack. PS Here's the corrected code: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) windows(); plot(Y ~ X, d, type=n) colors- c(blue,green) junk- mapply( function(z,color) with(z, lines(X, predict(lm(Y~X)), col=color)), with(d, split(d,D)), color=colors ) Thomas Lumley [EMAIL PROTECTED] wrote: You can't get lapply to increment i, but you can use mapply and write your function with two arguments. mapply( function(z,colour) with(z, lines(X, predict(lm(Y~X), col=colour)), with(d, split(d,D)), colors) -thomas Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: plot(Y ~ X, d, type = n) f - function(i) abline(lm(Y ~ X, d, subset = D == i), col = colors[i+1]) junk - lapply(unique(d$D), f) On 3/13/06, John McHenry wrote: Hi All, I'm looking for some hints on idiomatic R usage using 'lapply' or similar. What follows is a simple example from which to generalize my question... # Suppose, in this simple example, I want to plot a number of different lines in different colors; # I define the colors I wish to use and I plot them in a loop: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) # graph the relation of Y to X when # i) D==0 # ii) D==1 with( d, plot(X, Y, type=n) ) component- with( d, split(d, D) ) colors- c(blue, green) for (i in 1:length(component)) with( component[[i]], lines(X, predict(lm(Y ~ X)), col=colors[i]) ) # # ... seems easy enough # # [Q.]: How to do the same as the above but using 'lapply'? # ... i.e. something along the lines of: with( d, plot(X, Y, type=n) ) colors- c(blue, green) # how do I get lapply to increment i? lapply( with(d, split(d, D)), function(z) with(z, lines(X, predict(lm(Y ~ X)), col=colors[i])) ) Thanks, Jack. - [[alternative HTML version deleted]] __ R-help@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 - [[alternative HTML version deleted]] __ R-help@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
Re: [R] Incrementing a counter in lapply
There are two ways to do that: one is to use mapply as Thomas showed and the other is to iterate over an index rather than over the data itself. Here is a rather lame example using + but hopefully it conveys the idea of the two possibilities: # 1 x - y - 1:4 mapply(+, x, y) # 2 sapply(seq(along = x), function(i) x[i]+y[i]) On 3/14/06, John McHenry [EMAIL PROTECTED] wrote: Thanks, Gabor Thomas. Apologies, but I used an example that obfuscated the question that I wanted to ask. I really wanted to know how to have extra arguments in functions that would allow, per the example code, for something like a counter to be incremented. Thomas's suggestion of using mapply (reproduced below with corrections) is probably closest. Jack. PS Here's the corrected code: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) windows(); plot(Y ~ X, d, type=n) colors- c(blue,green) junk- mapply( function(z,color) with(z, lines(X, predict(lm(Y~X)), col=color)), with(d, split(d,D)), color=colors ) Thomas Lumley [EMAIL PROTECTED] wrote: You can't get lapply to increment i, but you can use mapply and write your function with two arguments. mapply( function(z,colour) with(z, lines(X, predict(lm(Y~X), col=colour)), with(d, split(d,D)), colors) -thomas Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: plot(Y ~ X, d, type = n) f - function(i) abline(lm(Y ~ X, d, subset = D == i), col = colors[i+1]) junk - lapply(unique(d$D), f) On 3/13/06, John McHenry wrote: Hi All, I'm looking for some hints on idiomatic R usage using 'lapply' or similar. What follows is a simple example from which to generalize my question... # Suppose, in this simple example, I want to plot a number of different lines in different colors; # I define the colors I wish to use and I plot them in a loop: d- data.frame(read.table(textConnection( Y X D 85 30 0 95 40 1 90 40 1 75 20 0 100 60 1 90 40 0 90 50 0 90 30 1 100 60 1 85 30 1 ), header=TRUE)) # graph the relation of Y to X when # i) D==0 # ii) D==1 with( d, plot(X, Y, type=n) ) component- with( d, split(d, D) ) colors- c(blue, green) for (i in 1:length(component)) with( component[[i]], lines(X, predict(lm(Y ~ X)), col=colors[i]) ) # # ... seems easy enough # # [Q.]: How to do the same as the above but using 'lapply'? # ... i.e. something along the lines of: with( d, plot(X, Y, type=n) ) colors- c(blue, green) # how do I get lapply to increment i? lapply( with(d, split(d, D)), function(z) with(z, lines(X, predict(lm(Y ~ X)), col=colors[i])) ) Thanks, Jack. - [[alternative HTML version deleted]] __ R-help@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 Relax. Yahoo! Mail virus scanning helps detect nasty viruses! __ R-help@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
Re: [R] irregular time series
One solution is to convert an irregular time series into a regular one, interpolating missing values. Obviously, it is only acceptable if the number of missing items is low. See ?regul in pastecs, for instance. Best, Philippe Grosjean alessandro carletti wrote: Hi everybody, I'm currently working with time series: do you know if there's something like stl(package stats, seasonal decomposition of time series by loess) working also with objects of class irts? Thanks Alessandro __ R-help@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 __ R-help@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
[R] [R-pkgs] New version of the LDheatmap package
Version 0.2 of the package LDheatmap is now on CRAN. The main function LDheatmap produces a graphical display, as a heat map, of measures of pairwise linkage disequilibria between SNPs. Users may optionally include the physical locations or genetic map distances of each SNP on the plot. The revisions to the package are aimed at improving the user's ability to modify and annotate the heatmap. Most notably, LDheatmap is now based on grid graphics. Examples of how to modify the plot using tools from the grid package are included in the LDheatmap help file. Sigal Blay ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@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
[R] book and website announcement
The 2nd Edition of my book (with Jiahui Wang) Modeling Financial Time Series with S-PLUS has recently been published by Springer-Verlag. The 2nd Edition is updated to cover S-PLUS 7 and S+FinMetrics 2.0. I have also created a website for the 2nd Edition, which can be found at http://faculty.washington.edu/ezivot/MFTS2ndEdition.htm The website contains scripts for all of the examples in the book, as well as a substantial amount of additional material and examples. [[alternative HTML version deleted]] __ R-help@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
[R] R CMD check: problems possibly from mapply?
Dear expeRts, I am trying to wrap up a package utilities (for my internal use). After adding a function datNAtreat that uses mapply, R CMD check gives WARNINGs for S3 generic/method consistency, checking replacement functions and checking foreign function calls, all of which are accompanied by the following error message: Error in .try_quietly : Error: unable to load R code in package 'utilities' Execution halted Additionally, I get an ERROR for missing documentation entries (which I don't understand, because this function like all others is documented). R CMD check works without problems when omitting this function. The function itself also works when running the code outside the package. I have now stripped it down (omitted error controls etc., it still works), and can only guess that the R CMD check problems have to do with mapply (with which I am not all that familiar). I include the code (not reproducible) in case someone has an idea what I can do to make this function packageable. (The function as.factora is defined elsewhere in the package and takes the arguments x (a column of a data frame), na.level and na.show (a logical).): ## datNAtreat - function(x, na.levels=NULL, na.show=FALSE) { if (!is.data.frame(x)) x - as.data.frame(x) names - colnames(x) if (is.null(names)) names - paste(x,1:ncol(x),sep=) x - as.data.frame(mapply(as.factora, x, na.level=na.levels, MoreArgs=list(na.show = na.show), SIMPLIFY=FALSE)) colnames(x) - names return(x) } Any suggestions are appreciated, as I have no idea where else to look. With kind regards, Ulrike __ R-help@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
Re: [R] R CMD check: problems possibly from mapply?
Sorry, just pressing the send button brought the solution :-) The problem has nothing to do with any programming issues, but rather with confusion about directories to use R CMD from. Regards, Ulrike -- Forwarded Message --- From: Ulrike Grömping [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tue, 14 Mar 2006 15:25:05 +0100 Subject: R CMD check: problems possibly from mapply? Dear expeRts, I am trying to wrap up a package utilities (for my internal use). After adding a function datNAtreat that uses mapply, R CMD check gives WARNINGs for S3 generic/method consistency, checking replacement functions and checking foreign function calls, all of which are accompanied by the following error message: Error in .try_quietly : Error: unable to load R code in package 'utilities' Execution halted Additionally, I get an ERROR for missing documentation entries (which I don't understand, because this function like all others is documented). R CMD check works without problems when omitting this function. The function itself also works when running the code outside the package. I have now stripped it down (omitted error controls etc., it still works), and can only guess that the R CMD check problems have to do with mapply (with which I am not all that familiar). I include the code (not reproducible) in case someone has an idea what I can do to make this function packageable. (The function as.factora is defined elsewhere in the package and takes the arguments x (a column of a data frame), na.level and na.show (a logical).): ## datNAtreat - function(x, na.levels=NULL, na.show=FALSE) { if (!is.data.frame(x)) x - as.data.frame(x) names - colnames(x) if (is.null(names)) names - paste(x,1:ncol(x),sep=) x - as.data.frame(mapply(as.factora, x, na.level=na.levels, MoreArgs=list(na.show = na.show), SIMPLIFY=FALSE)) colnames(x) - names return(x) } Any suggestions are appreciated, as I have no idea where else to look. With kind regards, Ulrike --- End of Forwarded Message --- ** Prof. Dr. Ulrike Grömping Fachbereich II TFH Berlin Luxemburger Str. 10 13353 Berlin mail: [EMAIL PROTECTED] www: www.tfh-berlin.de/~groemp/ __ R-help@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
[R] problem with optim: (list) object cannot be coerced to 'double'
Hi, I am trying to use optim to solve a heavy calibration problem. I supply the parameters in vector form. But before entering my target The call is simply: optim(par = parameters, fn = SumLSQ, method = Nelder-Mead) the function SumLSQ is simply: SumLSQ-function(parameters, data = timeseries){ print(sumLSQ) nbseries = dim(timeseries)[2]/3 SumLSQ = 0 for (i in (1:nbseries)){ SumLSQ = SumLSQ + LSQ(parameters,timeseries[,((i-1)*3+1):(i*3)]) } } I actually never enter the objective function SumLSQ. I always receive the error: (list) object cannot be coerced to 'double' And I really don't know where it comes from. II thought it was the format of par argument but I think it is correct to supply a numerical vector ... Thnaks a lot for any help! Stephane *** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. *** __ R-help@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
Re: [R] Generating a PostScript graphics under Windows
Peter Dalgaard wrote: Do you have write permissions there? (Possibly a silly question, but must be asked...) No. Thanks a lot Sigbert __ R-help@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
Re: [R] newline in plotmath expressions
Pascal A. Niklaus wrote: Hi all, When trying to amend a graphic with a text, I run into the following problem: text(10,10,First line\nSecond line,pos=2) works. However, because I have a plotmath expression, I tried: text(10,10,expression(First line with[subscript]*\nsecond line),pos=2) but \n does not lead to the result I wish. I considered the plotmath help page but could not find how to insert a newline. Is there a possibility to insert linebreaks in plotmath expressions, or do I have to print the individual lines with separete text commands? The latter. Uwe Ligges Thanks for you help Pascal __ R-help@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 __ R-help@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
Re: [R] problem with optim: (list) object cannot be coerced to 'double'
Zebouni, Stephane (Exchange) wrote: Hi, I am trying to use optim to solve a heavy calibration problem. I supply the parameters in vector form. But before entering my target The call is simply: optim(par = parameters, fn = SumLSQ, method = Nelder-Mead) the function SumLSQ is simply: SumLSQ-function(parameters, data = timeseries){ print(sumLSQ) nbseries = dim(timeseries)[2]/3 SumLSQ = 0 for (i in (1:nbseries)){ SumLSQ = SumLSQ + LSQ(parameters,timeseries[,((i-1)*3+1):(i*3)]) } } I actually never enter the objective function SumLSQ. I always receive the error: (list) object cannot be coerced to 'double' And I really don't know where it comes from. II thought it was the format of par argument but I think it is correct to supply a numerical vector ... Yes, it is. Please type str(parameters) an tell us the result. Uwe Ligges Thnaks a lot for any help! Stephane *** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. *** __ R-help@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 __ R-help@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
Re: [R] R GUI's on a Mac?
Hi, On Mar 14, 2006, at 3:05 AM, Martin Maechler wrote: I think for Berton's question, the only necessary step is JFox 1) Install X11.app from Apple Install disks (this is a JFox must if you want to use any tcltk-based package with R.app). The initial step is to make sure that the tcl/tk link is installed while installing R.app on Mac OS. This is possible during the 4th step of installing R.app (select the Customize button that shows up in the lower left corner of the installer window). I typically suggest folks load Fortran as well at that point, same customize screen. Regards, Rob __ R-help@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
[R] bwplot and outlier symbols
Hi, I was just trying to figure out how to beautify the output of my bwplot-output. Altogether I figured most of the things out on my own. The one thing which puzzles me though are the symbols for the outliers. I can easily change the form of the median symbol by using pch but I don't know how to do this for outliers. Obviously the outpch of the bxp-function is not implemented. Any clue how to do this? Any documentation reference at hand? cheers Vincent [[alternative HTML version deleted]] __ R-help@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
Re: [R] Incrementing a counter in lapply
On Tue, 14 Mar 2006, John McHenry wrote: Thanks, Gabor Thomas. Apologies, but I used an example that obfuscated the question that I wanted to ask. I really wanted to know how to have extra arguments in functions that would allow, per the example code, for something like a counter to be incremented. Thomas's suggestion of using mapply (reproduced below with corrections) is probably closest. It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. If you could work out how to increment a counter (and you could, with sufficient effort), it would not necessarily work, because the 'i'th evaluation would not necessarily be of the 'i'th element. [lapply() does in fact start at the beginning, go on until it gets to the end, and then stop, but this isn't documented. Suppose R became multithreaded, for example] -thomas Jack. PS Here's the corrected code: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) windows(); plot(Y ~ X, d, type=n) colors- c(blue,green) junk- mapply( function(z,color) with(z, lines(X, predict(lm(Y~X)), col=color)), with(d, split(d,D)), color=colors ) Thomas Lumley [EMAIL PROTECTED] wrote: You can't get lapply to increment i, but you can use mapply and write your function with two arguments. mapply( function(z,colour) with(z, lines(X, predict(lm(Y~X), col=colour)), with(d, split(d,D)), colors) -thomas Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: plot(Y ~ X, d, type = n) f - function(i) abline(lm(Y ~ X, d, subset = D == i), col = colors[i+1]) junk - lapply(unique(d$D), f) On 3/13/06, John McHenry wrote: Hi All, I'm looking for some hints on idiomatic R usage using 'lapply' or similar. What follows is a simple example from which to generalize my question... # Suppose, in this simple example, I want to plot a number of different lines in different colors; # I define the colors I wish to use and I plot them in a loop: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) # graph the relation of Y to X when # i) D==0 # ii) D==1 with( d, plot(X, Y, type=n) ) component- with( d, split(d, D) ) colors- c(blue, green) for (i in 1:length(component)) with( component[[i]], lines(X, predict(lm(Y ~ X)), col=colors[i]) ) # # ... seems easy enough # # [Q.]: How to do the same as the above but using 'lapply'? # ... i.e. something along the lines of: with( d, plot(X, Y, type=n) ) colors- c(blue, green) # how do I get lapply to increment i? lapply( with(d, split(d, D)), function(z) with(z, lines(X, predict(lm(Y ~ X)), col=colors[i])) ) Thanks, Jack. - [[alternative HTML version deleted]] __ R-help@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 - Relax. Yahoo! Mail virus scanning helps detect nasty viruses! Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@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
[R] bwplot and outlier symbols
Hi, I was just trying to figure out how to beautify the output of my bwplot-output. Altogether I figured most of the things out on my own. The one thing which puzzles me though are the symbols for the outliers. I can easily change the form of the median symbol by using pch but I don't know how to do this for outliers. Obviously the outpch of the bxp-function is not implemented. Any clue how to do this? Any documentation reference at hand? cheers Vincent [[alternative HTML version deleted]] __ R-help@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
Re: [R] Incrementing a counter in lapply
From: Thomas Lumley On Tue, 14 Mar 2006, John McHenry wrote: Thanks, Gabor Thomas. Apologies, but I used an example that obfuscated the question that I wanted to ask. I really wanted to know how to have extra arguments in functions that would allow, per the example code, for something like a counter to be incremented. Thomas's suggestion of using mapply (reproduced below with corrections) is probably closest. It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. If you could work out how to increment a counter (and you could, with sufficient effort), it would not necessarily work, because the 'i'th evaluation would not necessarily be of the 'i'th element. [lapply() does in fact start at the beginning, go on until it gets to the end, and then stop, but this isn't documented. Suppose R became multithreaded, for example] The corollary, it seems to me, is that sometimes it's better to leave the good old for loop alone. It's not always profitable to turn for loops into some *apply construct. The trick is learning to know when to do it and when not to. Andy -thomas Jack. PS Here's the corrected code: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) windows(); plot(Y ~ X, d, type=n) colors- c(blue,green) junk- mapply( function(z,color) with(z, lines(X, predict(lm(Y~X)), col=color)), with(d, split(d,D)), color=colors ) Thomas Lumley [EMAIL PROTECTED] wrote: You can't get lapply to increment i, but you can use mapply and write your function with two arguments. mapply( function(z,colour) with(z, lines(X, predict(lm(Y~X), col=colour)), with(d, split(d,D)), colors) -thomas Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: plot(Y ~ X, d, type = n) f - function(i) abline(lm(Y ~ X, d, subset = D == i), col = colors[i+1]) junk - lapply(unique(d$D), f) On 3/13/06, John McHenry wrote: Hi All, I'm looking for some hints on idiomatic R usage using 'lapply' or similar. What follows is a simple example from which to generalize my question... # Suppose, in this simple example, I want to plot a number of different lines in different colors; # I define the colors I wish to use and I plot them in a loop: d- data.frame(read.table(textConnection( Y X D 8530 0 9540 1 9040 1 7520 0 10060 1 9040 0 9050 0 9030 1 10060 1 8530 1 ), header=TRUE)) # graph the relation of Y to X when # i) D==0 # ii) D==1 with( d, plot(X, Y, type=n) ) component- with( d, split(d, D) ) colors- c(blue, green) for (i in 1:length(component)) with( component[[i]], lines(X, predict(lm(Y ~ X)), col=colors[i]) ) # # ... seems easy enough # # [Q.]: How to do the same as the above but using 'lapply'? # ... i.e. something along the lines of: with( d, plot(X, Y, type=n) ) colors- c(blue, green) # how do I get lapply to increment i? lapply( with(d, split(d, D)), function(z) with(z, lines(X, predict(lm(Y ~ X)), col=colors[i])) ) Thanks, Jack. - [[alternative HTML version deleted]] __ R-help@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 - Relax. Yahoo! Mail virus scanning helps detect nasty viruses! Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@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 __ R-help@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
Re: [R] problem with optim: (list) object cannot be coerced to 'double'
Here is what I get using str(parameters): num [1:120] 0.2000 -0.0166 0.0934 -0.0300 -0.3219 ... again, it doesn't even get into the objective function - I checked that Many thanks Stephane -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: 14 March 2006 15:18 To: Zebouni, Stephane (Exchange) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] problem with optim: (list) object cannot be coerced to 'double' Zebouni, Stephane (Exchange) wrote: Hi, I am trying to use optim to solve a heavy calibration problem. I supply the parameters in vector form. But before entering my target The call is simply: optim(par = parameters, fn = SumLSQ, method = Nelder-Mead) the function SumLSQ is simply: SumLSQ-function(parameters, data = timeseries){ print(sumLSQ) nbseries = dim(timeseries)[2]/3 SumLSQ = 0 for (i in (1:nbseries)){ SumLSQ = SumLSQ + LSQ(parameters,timeseries[,((i-1)*3+1):(i*3)]) } } I actually never enter the objective function SumLSQ. I always receive the error: (list) object cannot be coerced to 'double' And I really don't know where it comes from. II thought it was the format of par argument but I think it is correct to supply a numerical vector ... Yes, it is. Please type str(parameters) an tell us the result. Uwe Ligges Thnaks a lot for any help! Stephane *** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. *** __ R-help@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 *** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. *** __ R-help@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
[R] Tiny Typo in R Data Import/Export Manual
Dear all, in the first paragraph in Section 4.3.2 of the R Data Import/Export Manual, it is written 'We havew tested...'. Most likely it should be 'We have tested...' It is just such a minor thing that I was unsure whether to submit a bug report. I use now R 2.2.1 on Win32 but I guess this is independent of the platform and version. Best, Roland P.S. Thanks for the great work all the time! + This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@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
Re: [R] Incrementing a counter in lapply
On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: On Tue, 14 Mar 2006, John McHenry wrote: Thanks, Gabor Thomas. Apologies, but I used an example that obfuscated the question that I wanted to ask. I really wanted to know how to have extra arguments in functions that would allow, per the example code, for something like a counter to be incremented. Thomas's suggestion of using mapply (reproduced below with corrections) is probably closest. It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. I suspect that a huge amount of application code takes advantage of this order. __ R-help@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
Re: [R] bwplot and outlier symbols
vincent david wrote: Hi, I was just trying to figure out how to beautify the output of my bwplot-output. Altogether I figured most of the things out on my own. The one thing which puzzles me though are the symbols for the outliers. I can easily change the form of the median symbol by using pch but I don't know how to do this for outliers. Obviously the outpch of the bxp-function is not implemented. Any clue how to do this? Any documentation reference at hand? cheers Vincent Hi, Vincent, You need to change the setting for plot.symbol. trellis.par.set(theme = col.whitebg()) # not required, but my preference bwplot(voice.part ~ height, data = singer, xlab = Height (inches), par.settings = list(plot.symbol = list(pch = 2, col = blue))) I'm not sure where this is documented. I figured it out by reading the code for panel.bwplot which shows the settings used to plot the outlier symbols. HTH, --sundar __ R-help@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
[R] setMethod confusion
Hello I've checked through previous postings but don't see a fully equivalent problem-just a few hints. I have been trying to set a new method for the existing function table or as.data.frame.table for my class tfSites. Taking out all the useful code and just returning the input class I get the error setMethod(table, tfSites, function(.Object) .Object) Error in conformMethod(signature, mnames, fnames, f) : In method for function table: formal arguments omitted in the method definition cannot be in the signature (exclude = tfSites) setMethod(as.data.frame.table, tfSites, function(.Object) .Object ) Error in conformMethod(signature, mnames, fnames, f) : In method for function as.data.frame.table: formal arguments omitted in the method definition cannot be in the signature (x = tfSites) What does this mean? Is there something peculiar about the table function? Is it because it takes arguments beginning table(..., etc) Thanks In Advance Stephen Henderson Wolfson Inst. for Biomedical Research Cruciform Bldg., Gower Street University College London United Kingdom, WC1E 6BT +44 (0)207 679 6827 ** This email and any files transmitted with it are confidentia...{{dropped}} __ R-help@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
Re: [R] Tiny Typo in R Data Import/Export Manual
On 3/14/2006 10:58 AM, Rau, Roland wrote: Dear all, in the first paragraph in Section 4.3.2 of the R Data Import/Export Manual, it is written 'We havew tested...'. Most likely it should be 'We have tested...' It is just such a minor thing that I was unsure whether to submit a bug report. Thanks for noticing that; I'll fix it. It's better not to submit bug reports for things like this, because they take extra work to mark as resolved. The risk is that a simple message like yours will be overlooked, but in the case of a typo like this, that wouldn't be the end of the world. Duncan Murdoch I use now R 2.2.1 on Win32 but I guess this is independent of the platform and version. Best, Roland P.S. Thanks for the great work all the time! + This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@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 __ R-help@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
[R] help on moran's I index of point pattern, not areal pattern
hi,friends, we all know that moran's I index and Geary'C index can be used to test spatial autocorrelation in both the area data and point data, but i only can find something on how to calculate on the data of area, and can't find the methods to perform it on the point data, could anybody give me some information, thanks in advance! -- Kind Regards, Zhi Jie,Zhang ,PHD Department of Epidemiology, School of Public Health, Fudan University Tel:86-21-54237149 [[alternative HTML version deleted]] __ R-help@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
[R] (no subject)
Hi: Does anyone know how to run a test of trends for repeated measurements in R? Thanks Graciela __ R-help@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
[R] Ordered logistic regression in R vs in SAS
I tried the following ordered logistic regression in R: mod1 - polr(altitude~sp + wind_dir + wind_speed + hr, data=altioot) But when I asked The summary of my regression I got the folloing error message: summary (mod1) Re-fitting to get Hessian Error in optim(start, fmin, gmin, method = BFGS, hessian = Hess, ...) : the initial value of 'vmin' is not finished. I decided to try it in SAS with the following program: PROC LOGISTIC DATA=altioot; CLASS sp wind_dir ; title mod1; output out=mod1; MODEL altitude = sp wind_dir wind_speed hr; RUN; And it ran well with an good output. So my question is: Can someone tell me what is the difference between the ordered logistic regression of R and that of SAS? Does anyone have a suggestion to help me run my program in R? Thank you very much, Emilie Berthiaume graduate student Biology Department Sherbrooke University Sherbrooke, Quebec CANADA [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@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
[R] setMethod confusion
---sorry to repost I sent it as HTML last time--- Hello I've checked through previous postings but don't see a fully equivalent problem-just a few hints. I have been trying to set a new method for the existing function table or as.data.frame.table for my class tfSites. Taking out all the useful code and just returning the input class I get the error setMethod(table, tfSites, function(.Object) .Object) Error in conformMethod(signature, mnames, fnames, f) : In method for function table: formal arguments omitted in the method definition cannot be in the signature (exclude = tfSites) setMethod(as.data.frame.table, tfSites, function(.Object) .Object ) Error in conformMethod(signature, mnames, fnames, f) : In method for function as.data.frame.table: formal arguments omitted in the method definition cannot be in the signature (x = tfSites) What does this mean? Is there something peculiar about the table function? Is it because it takes arguments beginning table(..., etc) Thanks In Advance Stephen Henderson Wolfson Inst. for Biomedical Research Cruciform Bldg., Gower Street University College London United Kingdom, WC1E 6BT +44 (0)207 679 6827 ** This email and any files transmitted with it are confidentia...{{dropped}} __ R-help@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
Re: [R] bwplot and outlier symbols
On 3/14/06, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: vincent david wrote: Hi, I was just trying to figure out how to beautify the output of my bwplot-output. Altogether I figured most of the things out on my own. The one thing which puzzles me though are the symbols for the outliers. I can easily change the form of the median symbol by using pch but I don't know how to do this for outliers. Obviously the outpch of the bxp-function is not implemented. Any clue how to do this? Any documentation reference at hand? cheers Vincent Hi, Vincent, You need to change the setting for plot.symbol. trellis.par.set(theme = col.whitebg()) # not required, but my preference bwplot(voice.part ~ height, data = singer, xlab = Height (inches), par.settings = list(plot.symbol = list(pch = 2, col = blue))) I'm not sure where this is documented. I figured it out by reading the code for panel.bwplot which shows the settings used to plot the outlier symbols. Should have been (but isn't) documented in ?panel.bwplot. I'll add a note. Deepayan __ R-help@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
Re: [R] R GUI's on a Mac? -- Thanks
My thanks to all who replied. Your advice and links were very helpful. Kind regards, -- Bert Bert Gunter Genentech __ R-help@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
Re: [R] Incrementing a counter in lapply
On Tue, 14 Mar 2006, Gabor Grothendieck wrote: On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. I suspect that a huge amount of application code takes advantage of this order. I don't. The order of evaluation is usually not readily observable. You either have to use - to modify an external variable or you have to produce printed or graphical output where the order matters. There's probably some examples, but there are some examples of people using solve(t(X) %*% W %*% X) %*% W %*% Y to compute regression coefficients, too. -thomas __ R-help@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
[R] JOB: mixed models
Insightful is in need of a statistician/research scientist interested in researching and developing mixed models. There is a strong computational component to the work. The person would be responsible for developing S-PLUS/R packages, first focusing on mixed models (frailty in particular), and then going forward with new ideas/applications/methodology. Please send resumes to [EMAIL PROTECTED] Thank you very much! Jill Jill Goldschneider, PhD Director of Research Insightful Corporation 1700 Westlake Ave N, Suite 500 Seattle WA 98103 (206) 802-2327 (office) (206) 953-9355 (cell) (206) 283-8691 (fax) __ R-help@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
Re: [R] Incrementing a counter in lapply
On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: On Tue, 14 Mar 2006, Gabor Grothendieck wrote: On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. I suspect that a huge amount of application code takes advantage of this order. I don't. The order of evaluation is usually not readily observable. You either have to use - to modify an external variable or you have to produce printed or graphical output where the order matters. There's probably some examples, but there are some examples of people using solve(t(X) %*% W %*% X) %*% W %*% Y to compute regression coefficients, too. By order do you mean that the result is returned in a random order or that the result is returned in a fixed order but computed it a random order? __ R-help@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
Re: [R] Incrementing a counter in lapply
On Tue, 14 Mar 2006, Gabor Grothendieck wrote: On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: On Tue, 14 Mar 2006, Gabor Grothendieck wrote: On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. I suspect that a huge amount of application code takes advantage of this order. I don't. The order of evaluation is usually not readily observable. You either have to use - to modify an external variable or you have to produce printed or graphical output where the order matters. There's probably some examples, but there are some examples of people using solve(t(X) %*% W %*% X) %*% W %*% Y to compute regression coefficients, too. By order do you mean that the result is returned in a random order or that the result is returned in a fixed order but computed it a random order? It is returned in a fixed order, the first output corresponding to the first input. The documentation does not specify what order it is *computed* in. This in contrast to eapply(), which returns the results in a random order. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@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
Re: [R] Maximum likelihood
Erez Shabo shaboerez at gmail.com writes: Hello all, I'm trying to calculate the Maximum likelihood of individuals to get the ancestry. I mixd 3 populations 15 generations in proportion of 20% 20% 60% when each population sorce have diferent genome (0 1 and 2) with frequencies for each one. So now i have individuals looks like 0 0 2 1 1 2 0 . and i don't now how to calculate the mle although i try to figure out from the package state4. can somebody help me please? You haven't given quite enough information for us to help you. Remember that we're not all geneticists here ... can you give a little bit more context? Are you trying to estimate pedigrees, or populations of origin, or ... ? Another way to make it clearer would be to present the code you used to generate the data (it sounds like you did this in R). (The mle function from stats4 provides a *framework* for maximum-likelihood estimation; you still need to be able to write down a function for the likelihood of a given set of parameters.) Ben Bolker __ R-help@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
Re: [R] bwplot and outlier symbols
Hello again, I'm still confused how this is supposed to work. Especially the symbol for the outliers still puzzle me. This is what I do: bwplot (points ~ general[,1] | groups, layout = c(1, 3), scales = list(x = list(at = seq(10, 100, by=5), labels=seq(10, 100, by=5), tck=c(1,0))), panel=function(x,y) { panel.bwplot(x,y, horizontal=FALSE, pch=-, outlty=1, outpch=NA) }, horizontal=FALSE) The symbol for the outliers don't get changed wheras the pch changes the symbol for the median. Which parameter changes the outliers? cheers Vincent On 3/14/06, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: vincent david wrote: Hi, I was just trying to figure out how to beautify the output of my bwplot-output. Altogether I figured most of the things out on my own. The one thing which puzzles me though are the symbols for the outliers. I can easily change the form of the median symbol by using pch but I don't know how to do this for outliers. Obviously the outpch of the bxp-function is not implemented. Any clue how to do this? Any documentation reference at hand? cheers Vincent Hi, Vincent, You need to change the setting for plot.symbol. trellis.par.set(theme = col.whitebg()) # not required, but my preference bwplot(voice.part ~ height, data = singer, xlab = Height (inches), par.settings = list(plot.symbol = list(pch = 2, col = blue))) I'm not sure where this is documented. I figured it out by reading the code for panel.bwplot which shows the settings used to plot the outlier symbols. HTH, --sundar [[alternative HTML version deleted]] __ R-help@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
Re: [R] Incrementing a counter in lapply
On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: On Tue, 14 Mar 2006, Gabor Grothendieck wrote: On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: On Tue, 14 Mar 2006, Gabor Grothendieck wrote: On 3/14/06, Thomas Lumley [EMAIL PROTECTED] wrote: It is probably worth pointing out here that the R documentation does not specify the order in which lapply() does the computation. I suspect that a huge amount of application code takes advantage of this order. I don't. The order of evaluation is usually not readily observable. You either have to use - to modify an external variable or you have to produce printed or graphical output where the order matters. There's probably some examples, but there are some examples of people using solve(t(X) %*% W %*% X) %*% W %*% Y to compute regression coefficients, too. By order do you mean that the result is returned in a random order or that the result is returned in a fixed order but computed it a random order? It is returned in a fixed order, the first output corresponding to the first input. The documentation does not specify what order it is *computed* in. This in contrast to eapply(), which returns the results in a random order. In that case I misunderstood. __ R-help@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
[R] different values of a vector
Hello. I have a vector of length 2771 but it has only 87 different values. How can I obtain them? Thanks, Arnau. __ R-help@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
Re: [R] different values of a vector
On Tue, 2006-03-14 at 18:45 +0100, Arnau Mir wrote: Hello. I have a vector of length 2771 but it has only 87 different values. How can I obtain them? Thanks, Arnau. If you just want the unique values themselves, you can use: unique(vector) For example: v [1] b b c a a a c c c c unique(v) [1] b c a If you wanted counts of each unique value, you can use table(): table(v) v a b c 3 2 5 HTH, Marc Schwartz __ R-help@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
Re: [R] bwplot and outlier symbols
Hi, Vincent, You need to add par.settings = list(plot.symbol = list(pch = 2, col = blue, cex = 2)) to your bwplot call. Just change the values for pch, col, cex, etc. to suit your needs. The plot.symbol setting determines the symbol for the outliers. As Deepayan noted, it's not documented in panel.bwplot, but looking at the code for panel.bwplot reveals the solution. To see all the settings in use, try the following: show.settings() or to see a particular one, try: trellis.par.get(plot.symbol) See also, ?trellis.par.get and ?bwplot (where par.settings is documented). HTH, --sundar vincent david wrote: Hello again, I'm still confused how this is supposed to work. Especially the symbol for the outliers still puzzle me. This is what I do: bwplot (points ~ general[,1] | groups, layout = c(1, 3), scales = list(x = list(at = seq(10, 100, by=5), labels=seq(10, 100, by=5), tck=c(1,0))), panel=function(x,y) { panel.bwplot(x,y, horizontal=FALSE, pch=-, outlty=1, outpch=NA) }, horizontal=FALSE) The symbol for the outliers don't get changed wheras the pch changes the symbol for the median. Which parameter changes the outliers? cheers Vincent On 3/14/06, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: vincent david wrote: Hi, I was just trying to figure out how to beautify the output of my bwplot-output. Altogether I figured most of the things out on my own. The one thing which puzzles me though are the symbols for the outliers. I can easily change the form of the median symbol by using pch but I don't know how to do this for outliers. Obviously the outpch of the bxp-function is not implemented. Any clue how to do this? Any documentation reference at hand? cheers Vincent Hi, Vincent, You need to change the setting for plot.symbol. trellis.par.set(theme = col.whitebg()) # not required, but my preference bwplot(voice.part ~ height, data = singer, xlab = Height (inches), par.settings = list(plot.symbol = list(pch = 2, col = blue))) I'm not sure where this is documented. I figured it out by reading the code for panel.bwplot which shows the settings used to plot the outlier symbols. HTH, --sundar [[alternative HTML version deleted]] __ R-help@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 __ R-help@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
Re: [R] different values of a vector
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Arnau Mir Sent: Tuesday, March 14, 2006 12:45 PM To: r-help@stat.math.ethz.ch Subject: [R] different values of a vector Hello. I have a vector of length 2771 but it has only 87 different values. How can I obtain them? It depends on what obtain means. This should get you started. foo - sample(1:87,2771,T) table(foo) #or... levels(as.factor(foo)) Thanks, Arnau. __ R-help@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 __ R-help@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
Re: [R] different values of a vector
?unique Arnau Mir wrote: Hello. I have a vector of length 2771 but it has only 87 different values. How can I obtain them? Thanks, Arnau. __ R-help@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 __ R-help@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
[R] Interpolate univariate data on regular 3D grid to new 3D grid
Dear R Users, I have some data that is very similar in form to a 3D image - ie univariate data on a regular 3D grid. I keep this as a 3D numeric array in R with attributes describing the sampling points along the 3 dimensions. I would like to interpolate this onto a new regular 3D grid that I specify (eg by supplying 3 vectors corresponding to the new grid locations on each of the 3 dimensions). Interpolation methods would ideally include nearest neighbour and linear. The arrays can be large ( 1e7 points) so I would like this to be efficient. I can find lots of 1d or 2d interpolation methods but no 3d ones and anything that I write will probably take me a while to optimise. Many thanks for any suggestions, Greg Jefferis. -- Gregory Jefferis, PhD and: Research Fellow Department of Zoology St John's College University of Cambridge Cambridge Downing Street CB2 1TP Cambridge, CB2 3EJ United Kingdom Lab Tel: +44 (0)1223 336683 Office: +44 (0)1223 339899 Lab Fax: +44 (0)1223 336676 http://www.zoo.cam.ac.uk/zoostaff/jefferis.html [EMAIL PROTECTED] __ R-help@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
[R] Multi-line paste function
Here's my contribution to R. When R interacts with external programs (MySQL, cURL, etc.), it often requires a pasted string that is sent to these programs. For readability reasons, it is often preferable to have complex commands (SQL for example) spread on several lines. However, the normal paste function requires to add additional ' , ' at the end of each line and another ' ' at the beginning of each new line. It becomes fastidious for long commands. Multi-line paste function: multi.line.paste -function (..., sep = , collapse = NULL) { args - list(...) if (length(args) == 0) if (length(collapse) == 0) character(0) else else { for (i in seq(along = args)) args[[i]] - gsub(\n,,as.character(args[[i]])) .Internal(paste(args, sep, collapse)) } } Example with a SQL command on multiple lines: multi.line.paste( SELECT * FROM estimates a, newtable b WHERE a.Ticker=b.Ticker AND a.Fiscal_Year=b.Fiscal_Year AND a.EPSb.EPS AND a.Date_Last_change-1.9b.Date_Last_change ) Regards, Pierre ** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@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
[R] Date problem
Hello, I have some stupid problems managing date data. I have a colomn date, which I converted from a character representation: for example: a=26/02/06 date=strptime(a,format=%d/%m/%y) For one part of the analysis, I'm interested only in the month and the year, so I did: m.y=strftime(date,format=%m/%y) This returns me 02/06, but this is an object of class character and I can't convert it into an object of class Date. Doing strptime(m.y,format=%m/%y) or as.Date(m.y,format=%m/%y) returns me NA How can a convert this colomn m.y in a Date class? Actually, I need it to plot fruiting data against time (month and year). Because I have many values of seeds in a month, I used the function tapply: seeds=tapply(data$seed,data$m.y,sum) But plot(x=names(seeds),y=seeds) doesn't work. Does anyone know an easier way? Thank you for your time, natalia __ R-help@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
Re: [R] bwplot and outlier symbols
Hi, that was it! I managed to set me parameters properly using: trellis.par.set(... What I still not quite understand though is how to use: par.settings = ... I cant use it in the bwplot-command itself - this throws a error. Whereas using it in a: panel = function (...){... enviroment doesn't change anything!? thanks again Vincent [[alternative HTML version deleted]] __ R-help@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
[R] ignoring objects containing NaN's in a recursive function
Hi- General question: I have written a function that performs a permutation test. I use the function sample to randomize my data, then I call on another function I wrote to analyze the randomized data. This process repeats n times-- 10, 100 or whatever. The function applied to the randomized data creates a matrix and sometimes the matrix contains NaN's. I would like my function to simply ignore any matrices that contain NaN's and continue to cycle until it has generated n matrices without any NaN's. I am aware of the function is.nan, but I'm not sure how to fit it in. Specifics: Here's the section of code that needs improvement: for (i in 1:n){ S[,,]= sample (Y[,,]) dig=auto(S,H,J,T) out[i,]=dig[1,]} n= number of randomizations S= array to store randomized data Y= original data array dig= the matrix returned by the function auto out= matrix that collects the first row of each dig matrix up to n Sometimes dig includes NaN's. I want the function to ignore those digs but keep working until it has generated n matrices that contain no NaN's. How could I do this? Thanks. Jason Mills __ R-help@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
[R] Hodges-lehmann test and CI/significance
Does anyone know of an implementation in R of the Hodges-Lehmann nonparametric difference between two groups? I am interested in the estimate of the difference and the CI or significance of that difference. I did some quick searching and didn't see it, but I may not have been looking for the right name, etc. Thanks, Sean __ R-help@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
Re: [R] Ordered logistic regression in R vs in SAS
Emilie Berthiaume wrote: I tried the following ordered logistic regression in R: mod1 - polr(altitude~sp + wind_dir + wind_speed + hr, data=altioot) You might also try library(Design) # also requires Hmisc package mod1 - lrm() mod1 summary(mod1) anova(mod1) Frank Harrell But when I asked The summary of my regression I got the folloing error message: summary (mod1) Re-fitting to get Hessian Error in optim(start, fmin, gmin, method = BFGS, hessian = Hess, ...) : the initial value of 'vmin' is not finished. I decided to try it in SAS with the following program: PROC LOGISTIC DATA=altioot; CLASS sp wind_dir ; title mod1; output out=mod1; MODEL altitude = sp wind_dir wind_speed hr; RUN; And it ran well with an good output. So my question is: Can someone tell me what is the difference between the ordered logistic regression of R and that of SAS? Does anyone have a suggestion to help me run my program in R? Thank you very much, Emilie Berthiaume graduate student Biology Department Sherbrooke University Sherbrooke, Quebec CANADA [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@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 -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@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
Re: [R] bwplot and outlier symbols
vincent david wrote: Hi, that was it! I managed to set me parameters properly using: trellis.par.set(... What I still not quite understand though is how to use: par.settings = ... I cant use it in the bwplot-command itself - this throws a error. What error? What version of R/lattice are you using? R.version.string [1] R version 2.2.1, 2005-12-20 packageDescription(lattice)$Version [1] 0.12-11 .Platform$OS.type [1] windows --sundar Whereas using it in a: panel = function (...){... enviroment doesn't change anything!? thanks again Vincent __ R-help@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
Re: [R] Multi-line paste function
I am not sure I clearly understand what you want, but getting the string returned by your multi.line.paste() function is straightforward using gsub(): gsub(\n, , SELECT * FROM estimates a, newtable b WHERE a.Ticker=b.Ticker AND a.Fiscal_Year=b.Fiscal_Year AND a.EPSb.EPS AND a.Date_Last_change-1.9b.Date_Last_change ) If you really want a custom function for that, then, define: multi.line.paste - function(str) gsub(\n, , str) Best, Philippe Grosjean Lapointe, Pierre wrote: Here's my contribution to R. When R interacts with external programs (MySQL, cURL, etc.), it often requires a pasted string that is sent to these programs. For readability reasons, it is often preferable to have complex commands (SQL for example) spread on several lines. However, the normal paste function requires to add additional ' , ' at the end of each line and another ' ' at the beginning of each new line. It becomes fastidious for long commands. Multi-line paste function: multi.line.paste -function (..., sep = , collapse = NULL) { args - list(...) if (length(args) == 0) if (length(collapse) == 0) character(0) else else { for (i in seq(along = args)) args[[i]] - gsub(\n,,as.character(args[[i]])) .Internal(paste(args, sep, collapse)) } } Example with a SQL command on multiple lines: multi.line.paste( SELECT * FROM estimates a, newtable b WHERE a.Ticker=b.Ticker AND a.Fiscal_Year=b.Fiscal_Year AND a.EPSb.EPS AND a.Date_Last_change-1.9b.Date_Last_change ) Regards, Pierre ** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@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 __ R-help@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
Re: [R] ignoring objects containing NaN's in a recursive function
if(any(is.nan(...)))... ##repeat However, 1) Have you tried RSiteSearch('permutation test',restr='function') to see what's already there? 2) I suspect that there are better ways to do this. In particular, generating all random whatevers at once is way more efficient than repeated calls; 2) It is **not** a permutation test, since there is no guarantee that all the calls to sample() generate different permutations. (depending on the sample size, this may be nitpicking). Cheers, -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mills, Jason Sent: Tuesday, March 14, 2006 11:00 AM To: r-help@stat.math.ethz.ch Subject: [R] ignoring objects containing NaN's in a recursive function Hi- General question: I have written a function that performs a permutation test. I use the function sample to randomize my data, then I call on another function I wrote to analyze the randomized data. This process repeats n times-- 10, 100 or whatever. The function applied to the randomized data creates a matrix and sometimes the matrix contains NaN's. I would like my function to simply ignore any matrices that contain NaN's and continue to cycle until it has generated n matrices without any NaN's. I am aware of the function is.nan, but I'm not sure how to fit it in. Specifics: Here's the section of code that needs improvement: for (i in 1:n){ S[,,]= sample (Y[,,]) dig=auto(S,H,J,T) out[i,]=dig[1,]} n= number of randomizations S= array to store randomized data Y= original data array dig= the matrix returned by the function auto out= matrix that collects the first row of each dig matrix up to n Sometimes dig includes NaN's. I want the function to ignore those digs but keep working until it has generated n matrices that contain no NaN's. How could I do this? Thanks. Jason Mills __ R-help@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 __ R-help@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
Re: [R] Date problem
On 3/14/06, natalia norden [EMAIL PROTECTED] wrote: Hello, I have some stupid problems managing date data. I have a colomn date, which I converted from a character representation: for example: a=26/02/06 date=strptime(a,format=%d/%m/%y) For one part of the analysis, I'm interested only in the month and the year, so I did: m.y=strftime(date,format=%m/%y) This returns me 02/06, but this is an object of class character and I can't convert it into an object of class Date. Doing strptime(m.y,format=%m/%y) or as.Date(m.y,format=%m/%y) returns me NA How can a convert this colomn m.y in a Date class? Actually, I need it to plot fruiting data against time (month and year). Because I have many values of seeds in a month, I used the function tapply: seeds=tapply(data$seed,data$m.y,sum) But plot(x=names(seeds),y=seeds) doesn't work. Does anyone know an easier way? Are these time series? If so, you could use the zoo package: library(zoo) seeds - zoo(1:100, as.Date(2000-01-01) + 0:99) # test data seeds.mon - aggregate(seeds, as.Date(as.yearmon(time(seeds))), sum) plot(seeds.mon) or if seeds is not a time series, i.e. does not have unique dates: library(zoo) seeds - 1:100 dd - rep(as.Date(2000-01-01) + 0:49, 2) seeds.mon - aggregate(zoo(seeds), as.Date(as.yearmon(dd)), sum) plot(seeds.mon) For info: library(zoo) vignette(zoo) __ R-help@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
Re: [R] Multi-line paste function
Hello Phillipe 1-You are right that for a simple example as the one I provided, paste and gsub give the same result. 2-For a more complex case, where let's say, I'd like to include a variable in my SQL statement, the multi.line.paste command is essential. variable -1.9 multi.line.paste( SELECT * FROM estimates3 a, newtable b WHERE a.Ticker=b.Ticker AND a.Fiscal_Year=b.Fiscal_Year AND a.EPSb.EPS AND a.Date_Last_change_or_conf-,variable,b.Date_Last_change_or_conf ,sep=) Regards, Pierre ** AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}} __ R-help@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
Re: [R] help on moran's I index of point pattern, not areal pattern
On Wed, 15 Mar 2006, zhijie zhang wrote: hi,friends, we all know that moran's I index and Geary'C index can be used to test spatial autocorrelation in both the area data and point data, but i only can find something on how to calculate on the data of area, and can't find the methods to perform it on the point data, could anybody give me some information, thanks in advance! There is no difference between area and point data given a Voronoi/Dirichlet tesselation. To use any such index, you are obliged to define neighours anyway, and whether you use a distance criterion, k-nearest neighbours, triangulation, or a graph criterion such as a minimum spanning tree, the duality remains. Functions for defining neighbours are found in ade4 and spdep, and suit points at least adequately. If you want a distance-based correlogram, define increasing distance bands (or see the off-CRAN ncf package). The functions are (among others) mstree() in ade4 taking a distance matrix as its argument, and dnearneigh(), knearneigh(), tri2nb(), gabrielneigh(), relativeneigh(), and soi.graph() taking a matrix of 2D coordinates as their argument in spdep (if your points are a regular grid, there is also cell2nb()). At least you have a choice here. -- Kind Regards, Zhi Jie,Zhang ,PHD Department of Epidemiology, School of Public Health, Fudan University Tel:86-21-54237149 [[alternative HTML version deleted]] __ R-help@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 -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@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
Re: [R] Multi-line paste function
Lapointe, Pierre wrote: Hello Phillipe 1-You are right that for a simple example as the one I provided, paste and gsub give the same result. 2-For a more complex case, where let's say, I'd like to include a variable in my SQL statement, the multi.line.paste command is essential. variable -1.9 multi.line.paste( SELECT * FROM estimates3 a, newtable b WHERE a.Ticker=b.Ticker AND a.Fiscal_Year=b.Fiscal_Year AND a.EPSb.EPS AND a.Date_Last_change_or_conf-,variable,b.Date_Last_change_or_conf ,sep=) Regards, Pierre Still simpler than your function: variable - 1.9 gsub(\, , paste( SELECT * FROM estimates3 a, newtable b WHERE a.Ticker=b.Ticker AND a.Fiscal_Year=b.Fiscal_Year AND a.EPSb.EPS AND a.Date_Last_change_or_conf-,variable,b.Date_Last_change_or_conf , sep=)) Philippe Grosjean __ R-help@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
Re: [R] need help in tune.nnet
You use tune function to find optimal parameters needed for particular classification algorithm. I had more experience with tune.svm but, I would try first to put parameters covering the whole possible range of each variable (in which algorithm do not crash), for example c(4^-2, 4^-1, 4^0, 4^1, 4^2) look at the results and than narrow down the search in the best ranges. For allowed ranges of parameters you will need to experiment or study documentation of your chosen classifier (nnet). Jarek Tuszynski -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of madhurima bhattacharjee Sent: Friday, March 10, 2006 5:38 AM To: r-help@stat.math.ethz.ch; Bioconductor Subject: [R] need help in tune.nnet Dear R people, I want to use the tune.nnet function of e1071 package to tune nnet . I am unable to understand the parameters of tune.nnet from the e1071 pdf document. I have performed nnet on a traindata and want to test it for class prediction with a testdata. I want to know the values of size,decay,range etc. parameters for which the prediction of testdata is best. Can anyone please tell me how to do this with the tune.nnet function. Anticipating quick response. Thanks and Regards, Madhurima. __ R-help@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 __ R-help@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
Re: [R] Hodges-lehmann test and CI/significance
On Tue, 2006-03-14 at 14:07 -0500, Sean Davis wrote: Does anyone know of an implementation in R of the Hodges-Lehmann nonparametric difference between two groups? I am interested in the estimate of the difference and the CI or significance of that difference. I did some quick searching and didn't see it, but I may not have been looking for the right name, etc. Thanks, Sean Sean, See the Details section of ?wilcox.test and/or the wilcox.exact() function in the exactRankTests CRAN package by Torsten Hothorn and Kurt Hornik. BTW: RSiteSearch(Hodges-Lehmann) would get you to both functions. HTH, Marc Schwartz __ R-help@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
[R] Interpolate univariate data on regular 3D grid to new 3D grid
Package gstat allows 3D interpolation. It doesn't accept a 3D array directly; you'll have to provide it as x1 y1 z1 obs1 x2 y2 z2 obs2 etc, e.g. by using expand.grid. Or, you may want to try out the classes provided by package sp, which allow for more than 2 dimensions in case of points and grids. -- Edzer __ R-help@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
Re: [R] Hodges-lehmann test and CI/significance
On Tue, 14 Mar 2006, Sean Davis wrote: Does anyone know of an implementation in R of the Hodges-Lehmann nonparametric difference between two groups? I am interested in the estimate of the difference and the CI or significance of that difference. I did some quick searching and didn't see it, but I may not have been looking for the right name, etc. wilcox.test() computes this. (I think it's false advertising to call something that assumes a location shift model nonparametric) -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@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
[R] highlight an area below a line
Hi, if I plot a normal distribution like this: d-density(rnorm(1)) plot(d) how can I highlight the area below the graph in a certain interval, say x=1,2? I understand that I should use polygon, but I have not found the right way to give the result that I want. Thanks a lot! Georg __ R-help@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
[R] R] highlight an area below a line
How about, d-density(rnorm(1)) plot(d) wvs - which(d$x 1 d$x 2) polygon(d$x[c( wvs[1], wvs, wvs[length(wvs)] ) ], c(0, d$y[wvs], 0), col = bisque) Georg Otto a écrit: Hi, if I plot a normal distribution like this: d-density(rnorm(1)) plot(d) how can I highlight the area below the graph in a certain interval, say x=1,2? I understand that I should use polygon, but I have not found the right way to give the result that I want. Thanks a lot! Georg -- Ken Knoblauch Inserm U371 Cerveau et Vision Dept. of Cognitive Neuroscience 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.lyon.inserm.fr/371/ __ R-help@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
Re: [R] RFC: default background on lattice plots
On 3/13/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Mon, 13 Mar 2006, Martin Maechler wrote: JohnF == John Fox [EMAIL PROTECTED] on Sat, 11 Mar 2006 13:29:34 -0500 writes: JohnF Dear Deepayan, As you say, it's currently very easy JohnF to change settings (which is what I do routinely), JohnF but since you asked, I much prefer the settings in JohnF canonical.theme(pdf) and therefore would prefer JohnF that the windows() device use these settings as a JohnF default (independent of the printing issue). JohnF Regards, and thanks for the lattice package, indeed, thanks a lot, Deepayan! I think it would make much sense to use the *same* canonical.theme for all interactive default devices. This may be important in teaching, packages, user-written functions which often are all meant to be used interactively; I think it would be painful if students in my class looked at quite differently colored pictures depending on if they are using MacOS X, Linux or Windows. Hence, if you change the setting for windows(), I think you should also do so for x11() and quartz(). That would be an even stronger argument if those devices all rendered RGB colours the same, but MacOS is running a different default interpretation, AFAIK (and many PC displays are still way off sRGB, hence the gamma argument of some devices but unfortunately not quartz()). Beyond that, the visual effect is dependent both on the brilliance setting of the display and ambient lighting levels, and most people have screens set far too bright (and work in too harshly lit environments) to achieve optimal rendition. I can see two defensible positions. 1) Default themes are chosen for each device with a common 'perceptual intent' (a technical phrase). I believe that was the aim of Trellis, but one not achieved on many displays (I remember a muddy brown background on an old Sun display Bill Venables had). 2) The same theme is chosen for all devices, and the user is expected to establish proper viewing conditions. That would mean using the same default theme for _all_ devices. I think 2) has to be the way forward, as nowadays there is no reason to suppose that postscript() or pdf() output will be printed rather than say included into a lecture presentation (and if so whether that will be printed or 'beamed'). I completely agree (personally, I would prefer to retain black and white defaults for postscript, but that's only because most of our printers are still BW). The important question is then, what should this default be? The current default (the one with a grey background) obviously has issues, but at least some thought was put into it (see, e.g. http://cm.bell-labs.com/stat/doc/trellis.tour.col.ps). The other available themes are (a) the current PDF default, which is essentially the screen defaults with background changed to white, followed by some of the lighter symbol colors made darker according to my whims at the time. (b) col.whitebg(), which was meant to be a proof of concept, and should not be considered seriously. There has been no systematic study of how these settings affect perception. I know of some work on the optimal choice of colors (e.g. http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/Ihaka.pdf), but they mostly apply to fill colors, not symbol/line colors. Personally, I'm happy enough with the PDF defaults (except maybe the third superpose.symbol color), but I'm sure they can be improved. -Deepayan (Ross Ihaka did once mention an intent to include colour management into R, so that R RGB colours were rendered as accurately as possible in sRGB. That would remove the MacOS anomaly.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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
[R] map question
Would anyone with experience with the map functions know how to divide Czechoslovakia into the Czech Republic and Slovakia. They have been two separate countries for some time now. I'm thinking about the worldhires map database in particular. -- Dean Sonneborn, MS Programmer Analyst Department of Public Health Sciences University of California, Davis (530) 754-9516 __ R-help@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
[R] using a value in a column to lookup data in a certian column of a dataset?
I have a dataset with 20 columns and ~600,000 rows. Column 1 has a number from 2-19. This number tells me, for each row, which column has the applicable data. (i.e. the data that I wish to use for each individual row) I want to create a vector that contains the data from the value in column 1. e.g. If column 1, row 1, has a value of 6, I want to obtain the value in column 6, row1. If column1, row 2, has value of 2, I want to obtain the value in column 2, row2. etc I have created a for next loop to do this, but am looking for a more efficient manner. Thanks. __ R-help@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
[R] MCMCpack Ordinal Probit Help
Hi everyone, I am running an ordinal probit using the Bayesian MCMCpack and I am getting an error saying attempt for find suitable starting values failed Here is my code: posterior - MCMCoprobit(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 +x9 + x10 + x11 + x12 +x13 , beta.start=c(-10, 0.05, 0.02, 0.04, 0.98, 0.61, -0.29, 0.91, -0.82, 1.34, 0.68, 0.57, 0.09, 0.5), mcmc=1) Here is the error: Error in polr(ordered(Y) ~ new.X) : attempt for find suitable starting values failed I don't understand why it cannot find suitable starting values if I have specified those in beta.start(). Thanks a lot, Nadya Toskova PhD Student in Marketing __ R-help@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
Re: [R] using a value in a column to lookup data in a certian column of a dataset?
From ?] note that: When indexing arrays by '[' a single argument 'i' can be a matrix with as many columns as there are dimensions of 'x'; the result is then a vector with elements corresponding to the sets of indices in each row of 'i'. so: mm - matrix(1:25,5) mm [,1] [,2] [,3] [,4] [,5] [1,]16 11 16 21 [2,]27 12 17 22 [3,]38 13 18 23 [4,]49 14 19 24 [5,]5 10 15 20 25 mm[cbind(1:5, mm[,1])] [1] 1 7 13 19 25 On 3/14/06, r user [EMAIL PROTECTED] wrote: I have a dataset with 20 columns and ~600,000 rows. Column 1 has a number from 2-19. This number tells me, for each row, which column has the applicable data. (i.e. the data that I wish to use for each individual row) I want to create a vector that contains the data from the value in column 1. e.g. If column 1, row 1, has a value of 6, I want to obtain the value in column 6, row1. If column1, row 2, has value of 2, I want to obtain the value in column 2, row2. etc I have created a for next loop to do this, but am looking for a more efficient manner. Thanks. __ R-help@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 __ R-help@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
[R] filtering in aggregate
Hello all, I have a data frame with year, month, species, fishing gear and catch (Y, M, S, F, C) and I want the sum of C by Y for species A and fishing gear trawl. I tried things like aggregate(C[S==A F==trawl], list (Year = Y[S==A F==trawl]), fun=sum), but it didn't worked. To overcome this problem I did a subset as a new data frame and then I used aggregate. But I'm sure there's a way to apply a filter in data frame. Thanks for any help. Best regards. Antonio Olinto __ R-help@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
[R] Regarding aov Error()
The following dummy data frame has factor Q (with 2 levels) nesting factor P (with levels p1 and p2 nested under q1, and p3 and p4 nested under q2), but both crossing the random variate s, which has 8 levels. The dependent measure is dv. # The data frame: testnest dv s P Q 1 1 s1 p1 q1 2 2 s2 p1 q1 3 1 s3 p1 q1 4 2 s4 p1 q1 5 1 s5 p1 q1 6 3 s6 p1 q1 7 3 s7 p1 q1 8 4 s8 p1 q1 9 2 s1 p2 q1 10 3 s2 p2 q1 11 3 s3 p2 q1 12 1 s4 p2 q1 13 1 s5 p2 q1 14 2 s6 p2 q1 15 2 s7 p2 q1 16 3 s8 p2 q1 17 3 s1 p3 q2 18 3 s2 p3 q2 19 4 s3 p3 q2 20 1 s4 p3 q2 21 1 s5 p3 q2 22 1 s6 p3 q2 23 2 s7 p3 q2 24 2 s8 p3 q2 25 4 s1 p4 q2 26 3 s2 p4 q2 27 1 s3 p4 q2 28 2 s4 p4 q2 29 4 s5 p4 q2 30 1 s6 p4 q2 31 3 s7 p4 q2 32 1 s8 p4 q2 # The following aov() call is structurally correct with respect # to the design, and appropriate error-terms, but, as can be seen, # returns an error: testnest.aov=aov(dv~Q+P%in%Q+Error(s+s:Q+s:P:Q),data=testnest) Warning message: Error() model is singular in: aov(dv ~ Q + P %in% Q + Error(s + s:Q + s:P:Q), data = testnest) # However, applying the summary() method to the aov output, produces the correct analysis: summary(testnest.aov) Error: s Df Sum Sq Mean Sq F value Pr(F) Residuals 7 5.8750 0.8393 Error: s:Q Df Sum Sq Mean Sq F value Pr(F) Q 1 0.1250 0.1250 0.068 0.8018 Residuals 7 12.8750 1.8393 Error: s:Q:P Df Sum Sq Mean Sq F value Pr(F) Q:P2 0.250 0.125 0. 0.8956 Residuals 14 15.750 1.125 I have tried many different ways of denoting the Error() partitioning, but can't find one that produces both the correct analysis *AND* no singularity error on the aov() call. Any suggestions? -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ R-help@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
[R] How to get correct proportions/bounding box for latex figure?
Hello, I recently posted a question about my troubles with importing a lattice/trellis figure into latex. To recap, The figure contains 3 scatterplots, so it should have roughly a 1:3 sort of aspect ratio, in order to make each of the scatterplots square. Instead, the whole figure comes out roughly square, so each scatterplot is badly stretched. I fixed this by adding aspect=1/1 to the individual xyplot() calls. However, the bounding box as seen from Latex is quite incorrect - it appears that R and latex think the figure has a square aspect ratio rather than the actual 1:3 ratio. (The original post title was postscript bounding box in trellis/lattice plot is wrong ?, and was around 1 march.) The recommended response appears to be to add the additional arguments width=3.0, height=1.0, horizontal=FALSE, onefile=FALSE, paper=special to the trellis.device(postscript...) call. (The width/height arguments are required: without them R gives an error Error in grid.Call.graphics(L_setviewport, pvp, TRUE) : Non-finite location and/or size for viewport) Fine, but how then do I know what width and height are, and why should I have to specify this? Unless I get them in exactly the right ratio, the figures are going to be stretched (including the fonts, which will not look professional)! So, I guess I could print out the figure and get out a ruler and measure (fortunately the scatterplots have boxes that I know should be square, so I could figure out the right ratio). But this seems so antiquated, and makes me think I must be overlooking something. R should be _telling me_ what the bounding box is (rather than making me estimate it). R knows the bounding box because it puts down the ink (metaphorically)... and if it did not know, it would display on-screen figures with incorrect centering and clipping. Thanks for any advice or insight. . Here is a sketch of the code: library(lattice) plt_hi[[1]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) # optionally add horizontal=FALSE, paper=special, etc. here trellis.device(postscript, file=thefile, color=F) print(plt_hi[[1]], split=c(1,1,3,1), more=T) print(plt_hi[[2]], split=c(2,1,3,1), more=T) print(plt_hi[[3]], split=c(3,1,3,1), more=F) dev.off() __ R-help@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
Re: [R] How to get correct proportions/bounding box for latex figure?
context grey wrote: Hello, I recently posted a question about my troubles with importing a lattice/trellis figure into latex. To recap, The figure contains 3 scatterplots, so it should have roughly a 1:3 sort of aspect ratio, in order to make each of the scatterplots square. Instead, the whole figure comes out roughly square, so each scatterplot is badly stretched. I fixed this by adding aspect=1/1 to the individual xyplot() calls. However, the bounding box as seen from Latex is quite incorrect - it appears that R and latex think the figure has a square aspect ratio rather than the actual 1:3 ratio. (The original post title was postscript bounding box in trellis/lattice plot is wrong ?, and was around 1 march.) The recommended response appears to be to add the additional arguments width=3.0, height=1.0, horizontal=FALSE, onefile=FALSE, paper=special to the trellis.device(postscript...) call. (The width/height arguments are required: without them R gives an error Error in grid.Call.graphics(L_setviewport, pvp, TRUE) : Non-finite location and/or size for viewport) Fine, but how then do I know what width and height are, and why should I have to specify this? Unless I get them in exactly the right ratio, the figures are going to be stretched (including the fonts, which will not look professional)! So, I guess I could print out the figure and get out a ruler and measure (fortunately the scatterplots have boxes that I know should be square, so I could figure out the right ratio). But this seems so antiquated, and makes me think I must be overlooking something. R should be _telling me_ what the bounding box is (rather than making me estimate it). R knows the bounding box because it puts down the ink (metaphorically)... and if it did not know, it would display on-screen figures with incorrect centering and clipping. You say you want a nonstandard layout, then you say you shouldn't have to tell R what you want. How else would it know? Regarding the stretching: that's being done by whatever software is importing the picture. Just tell it to preserve the aspect ratio, and things will be fine. R writes the bounding box into EPS files, and reasonable software should be able to read it from there. Duncan Murdoch Thanks for any advice or insight. . Here is a sketch of the code: library(lattice) plt_hi[[1]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) ... plt_hi[[2]] - xyplot(thedat[,ir] ~ thedat[,ic], aspect=1/1) # optionally add horizontal=FALSE, paper=special, etc. here trellis.device(postscript, file=thefile, color=F) print(plt_hi[[1]], split=c(1,1,3,1), more=T) print(plt_hi[[2]], split=c(2,1,3,1), more=T) print(plt_hi[[3]], split=c(3,1,3,1), more=F) dev.off() __ R-help@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 __ R-help@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
Re: [R] filtering in aggregate
Here is an example using the builtin data set, CO2, where we aggregate uptake over Treatment for Plant equal to Qn1 and Type equal to Quebec. with(subset(CO2, subset = Plant == Qn1 Type == Quebec), aggregate(list(uptake = uptake), list(Treatment = Treatment), sum)) or equivalently: with(CO2[CO2$Plant == Qn1 CO2$Type == Quebec,], aggregate(list(uptake = uptake), list(Treatment = Treatment), sum)) or CO2a - CO2[CO2$Plant == Qn1 CO2$Type == Quebec,] aggregate(CO2a[,uptake, drop=FALSE], CO2a[,Treatment, drop=FALSE], sum) On 3/14/06, Antonio Olinto [EMAIL PROTECTED] wrote: Hello all, I have a data frame with year, month, species, fishing gear and catch (Y, M, S, F, C) and I want the sum of C by Y for species A and fishing gear trawl. I tried things like aggregate(C[S==A F==trawl], list (Year = Y[S==A F==trawl]), fun=sum), but it didn't worked. To overcome this problem I did a subset as a new data frame and then I used aggregate. But I'm sure there's a way to apply a filter in data frame. Thanks for any help. Best regards. Antonio Olinto __ R-help@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 __ R-help@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
Re: [R] How to get correct proportions/bounding box for latex figure?
Thank you. However I don't think I understand the response here. In what sense do I want a nonstandard layout? Is because I am specify aspect=1/1 in the xyplot() ? If so, then is there some other way to cause the scatterplot to be rougly square? I took this out and looked at the result again. Rougly estimating, the aspect ratio of each scatterplot is about 7:1. When a normal distribution is stretched to this extent it looks like a linear trend. Very hard to read. Alternately, my nonstandard layout may be the specfication of width/height in the trellis.device() call? But without both of these R gives the error mentioned in my original post. (And this is the most puzzling point to me - I really don't understand why both of these are required -- specifying one of them would serve usefully to scale the plot without changing its aspect ratio, and R should be able to figure out the aspect ratio since it is drawing the plot.) The issue is not with Latex. I'm using graphicx/includegraphics, which does not stretch figures unless requested. I also verified this by opening the .eps in another program; it looks the same as in latex. Latex is correctly reading the bounding box, but the bounding box is quite wrong. (May need to clarify here, there are two situations: 1) aspect=1/1 is not specified in the xyplot() call. Then the scatter plots come out hugely stretched. The bounding box may be correct. 2) specify aspect=1/1. Now the scatterplots are sort of correct, provided I can either guess what width/height should be in trellis.device(), or else omit the paper=special. But the bounding box is quite wrong, it is roughly square, whereas the figure itself should be roughly 3:1 for 3 square scatterplots). Again, I think the problem is that I'm just overlooking something basic, but cannot figure out what it is. Here's an idea: maybe lattice/trellis doesn't handle putting several plots into a single figure (and same .eps file), i.e. it should have separate device/plot/dev.off() calls for each figure? And then I'd try to assemble the three into one using latex? --- Duncan Murdoch [EMAIL PROTECTED] wrote: You say you want a nonstandard layout, then you say you shouldn't have to tell R what you want. How else would it know? Regarding the stretching: that's being done by whatever software is importing the picture. Just tell it to preserve the aspect ratio, and things will be fine. R writes the bounding box into EPS files, and reasonable software should be able to read it from there. Duncan Murdoch __ R-help@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
Re: [R] How to get correct proportions/bounding box for latex figure?
On 3/14/2006 9:29 PM, context grey wrote: Thank you. However I don't think I understand the response here. In what sense do I want a nonstandard layout? You said you want something that is wide and short (3 squares, side by side). The standard layout would fit on a normal piece of paper, or a default window on screen. The R graphics model is that the drawing surface is established first, then the things you draw are adjusted to fit in it. R won't change the shape of the display because you are drawing more things on it. I don't think I understand exactly what you want to achieve; sample code that produces something close would be helpful (even if it comes out the wrong shape). Duncan Murdoch Is because I am specify aspect=1/1 in the xyplot() ? If so, then is there some other way to cause the scatterplot to be rougly square? I took this out and looked at the result again. Rougly estimating, the aspect ratio of each scatterplot is about 7:1. When a normal distribution is stretched to this extent it looks like a linear trend. Very hard to read. Alternately, my nonstandard layout may be the specfication of width/height in the trellis.device() call? But without both of these R gives the error mentioned in my original post. (And this is the most puzzling point to me - I really don't understand why both of these are required -- specifying one of them would serve usefully to scale the plot without changing its aspect ratio, and R should be able to figure out the aspect ratio since it is drawing the plot.) The issue is not with Latex. I'm using graphicx/includegraphics, which does not stretch figures unless requested. I also verified this by opening the .eps in another program; it looks the same as in latex. Latex is correctly reading the bounding box, but the bounding box is quite wrong. (May need to clarify here, there are two situations: 1) aspect=1/1 is not specified in the xyplot() call. Then the scatter plots come out hugely stretched. The bounding box may be correct. 2) specify aspect=1/1. Now the scatterplots are sort of correct, provided I can either guess what width/height should be in trellis.device(), or else omit the paper=special. But the bounding box is quite wrong, it is roughly square, whereas the figure itself should be roughly 3:1 for 3 square scatterplots). Again, I think the problem is that I'm just overlooking something basic, but cannot figure out what it is. Here's an idea: maybe lattice/trellis doesn't handle putting several plots into a single figure (and same .eps file), i.e. it should have separate device/plot/dev.off() calls for each figure? And then I'd try to assemble the three into one using latex? --- Duncan Murdoch [EMAIL PROTECTED] wrote: You say you want a nonstandard layout, then you say you shouldn't have to tell R what you want. How else would it know? Regarding the stretching: that's being done by whatever software is importing the picture. Just tell it to preserve the aspect ratio, and things will be fine. R writes the bounding box into EPS files, and reasonable software should be able to read it from there. Duncan Murdoch __ R-help@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 __ R-help@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
[R] comparing AIC values of models with transformed, untransformed, and weighted variables
Hi there, I have a question regarding model comparisons that seems simple enough but to which I cannot find an answer. I am interested in developing a predictive model relating some measure of a tree's stem to the total leaf area (TLA) of the tree. Predictor variables might include, for example, the total cross-sectional area of the tree (commonly referred to as basal area) or the amount of sapwood area (SA) (which represents the amount of wood involved in active transport of water up the tree to the leaves). A variety of people have developed these models for a variety of tree species in a variety of places around the world. Perhaps not surprisingly, different studies have used different model forms in analyzing their data. I am interested in comparing the range of models that have been previously used (some of which are theoretically derived, others of which are empirically driven) using a data set that I have collected (for yet another species in yet another place). To compare the different model forms I had intended to use the AIC. However, I have found, again perhaps not surprisingly, that when I use log-transformed data, the AIC is substantially lower for a given predictor variable. If I use a weighted glm the same issue arises. For example, using BA vs TLA the (rounded) AIC values are 275 for a linear model, 30 for a log-log model, and 8 for a glm weighted by 1/BA. I don't believe that these vast differences reflect a major improvement in the model, but rather the scaling of the variables by transformation or weighting. What I'd like to get some advice or insight on is whether there is an appropriate way to rescale the AIC values to permit comparisons across these models. Any suggestions would be very welcome. Cheers, Patrick Baker __ R-help@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
Re: [R] How to get correct proportions/bounding box for latex figure?
--- Duncan Murdoch [EMAIL PROTECTED] wrote: The R graphics model is that the drawing surface is established first, then the things you draw are adjusted to fit in it. R won't change the shape of the display because you are drawing more things on it. Thanks, this comment clarifies things somewhat. Though I find it an odd design choice for R, since it seems to entail then that the user has figure out the aspect ratio of the resulting plot, something that R could easily keep track of as it is drawing. Here's example code, producing 3 scatterplots side-by-side (here reusing the same plot for simplicity). What's desired is that the individual scatterplots have the natural aspect, e.g. square, with the axis units being the same for X, Y. And to do this while producing a correct bounding box in the .eps file. As it stands the example code produces a correct bounding box, but the scatterplots are too stretched to be usable. Inserting aspect=1/1 in the xyplot() seems to cause the bounding box to be incorrect. library(lattice) rand1 - rnorm(50) rand2 - rnorm(50) theplot - xyplot(rand1 ~ rand2, xlab=x axis, ylab=y axis) thefile - plotproblem.eps trellis.device(postscript, file=thefile, color=F, horizontal=FALSE) print(theplot, split=c(1,1,3,1), more=T) print(theplot, split=c(2,1,3,1), more=T) print(theplot, split=c(3,1,3,1), more=F) dev.off() --- I don't think I understand exactly what you want to achieve; sample code that produces something close would be helpful (even if it comes out the wrong shape). __ R-help@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
[R] Help on factanal.fit.mle
Hi Can anybody please suggest me about the documentation of factanal.fit.mle() (Not factanal()-- searching factanal.fit.mle() in R always leads to factanal()). Is there any function for doing principal component factor analysis in R. Regards Souvik Bandyopadhyay JRF, Dept Of Statistics Calcutta University [[alternative HTML version deleted]] __ R-help@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
[R] Applying nlmeODE
Dear R-users My problem is the following: 1) Suppose we have the data test.txt: Data has form: Subject age test (=binary variable) 1 0.6 0 2 2 1 3 0.9 1 ... 2) I would like solving the following differential equations: dA/dt = u*A + v*B dB/dt = -v*B -u*A in addition, the parameter u=k*t where k is a constant and t is the time. How could I implement that into nlmeODE? I tried the following procedure: a) Apply the nlmeODE function dataModel=groupedData(formula=test~age|Subject, data=read.table(E:/test.txt,header=T), labels=list(x=Age,y=testpositiv), units=list(x=(year),y=(+/-))) modelform - list(DiffEq=list( dSdt = ~ u*I-b*S, dIdt = ~ -u*I+b*S, dbdt = ~ -k ), ObsEq=list( c1 = ~ S, c2 = ~ 0, c3 = ~ 0), States=c(S,I,b), Parms=c(u,k,start), Init=list(start,0,0.3)) Modeleasy - nlmeODE(modelform,dataModel) b) as far as good, now the problem if I run an estimation Modeleasy.nlme - nlme(test ~ Modeleasy(u,k,start,age,Subject), data = dataModel, fixed=u+k+start~1, random = pdDiag(start+u~1), start=c(u=5.7,k=-2,start=-5.9), control=list(msVerbose=TRUE,tolerance=1e-1,pnlsTol=1e-1,msTol=1e-1), verbose=TRUE) plot(augPred(Modeleasy.nlme,level=0:1)) = I get always an error message leading Minor of degree 2 is not positiv definit Hope anybody can help me or propose an alternative method to solve that problem. Thanks a lot. Best regs... -- Dominik Heinzmann Master of Science in Mathematics, EPFL Ph.D. student in Biostatistics Institute of Mathematics University of Zurich __ R-help@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
[R] GAM using R tutorials?
Hi all, I am trying to use GAM to work on some data... Are there any resources providing hands-on tutorial/guide on how to do GAM on data in R? Specifically, I am not sure about which model to choose, and smooth models with which effective degree-of-freedom shall I use... I knew there is a book titled: GAM: an introduction using R. Unfornately our local library does not have it... so that's not an option given time constraint. Thanks a lot for your pointers! Michael. [[alternative HTML version deleted]] __ R-help@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