Re: [R] Signs of loadings from princomp on Windows
Tony Plate [EMAIL PROTECTED] writes: difference? (The fact that various people chimed in to say they could reproduce the behavior that bothered you, but didn't bother dig deeper suggests it didn't bother them that much, which further suggests that you are the person most motivated by this and thus the best candidate for investigating it further...) It could be well worth finding though. It's most likely a reliance on uninitialized memory (the only other explanation I can think of is if something is tampering with the FPU control word). That may be mostly harmless if the algorithm converges - the sign is not well defined anyway - but we have recently fixed a couple of bugs where the occasional injection of NaN or Inf values caused real trouble. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] BUGS and OS X
On Wed, 2004-09-15 at 21:29, Tamas K Papp wrote: On Wed, Sep 15, 2004 at 02:21:18PM -0400, Liaw, Andy wrote: That's more of a question for the BUGS developers. BUGS is not open source, so whatever binary is provided, that's all you can use. If I'm not mistaken, WinBUGS is the only version under development. I found something called JAGS, and I am still exploring it. It appears to be an open-source BUGS replacement, thought with limitations. MacOS X is a kind of unix (where the emphasis is on the kind of), so you can get and compile any source code developed for unix -- with some luck. One alternative is Bassist available at http://www.cs.helsinki.fi/research/fdk/bassist/. I just tried and found out that you can compile and install it in MacOS X in the usual way (./configure make sudo make install). That's all I can say about it. It may not be easiest to use. The current version seems to be a bit oldish and not quite complete, but somebody claimed that they may start developing Bassist again. Actually, Bob O'Hara (who usually calls himself Anon. in this list) should know more, and hopefully this message will prompt him to tell us, too. I was asking what software people would recommend for the same functionality, not a drop-in replacement. I am just baffled by the bewildering array of R packages, and would be so happy if somebody told me what THEY use for Bayesian analysis, so I could read the docs and get started. MCMC? Boa? etc. Suggestions on how experienced users do bayesian analysis in R would be welcome. You need a guru to guide you. That's the holy tradition in Bayesianism. cheers, jari oksanen -- Jari Oksanen [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Signs of loadings from princomp on Windows
On Thu, 2004-09-16 at 02:38, Tony Plate wrote: You could investigate this yourself by looking at the code of princomp (try getAnywhere(princomp.default)). I'd suggest making a file that in-lines the body of princomp.default into the commands you had below. See if you still get the difference. (I'd be surprised if you didn't). Then try commenting out lines the second pass through the commands produces the same results as the first. The very last thing you commented out might help to answer your question What would be causing the difference? (The fact that various people chimed in to say they could reproduce the behavior that bothered you, but didn't bother dig deeper suggests it didn't bother them that much, which further suggests that you are the person most motivated by this and thus the best candidate for investigating it further...) People were not too bothered, since the sign of the eigenvector is not well defined in PCA: vectors x and -x are equal. Have you compared absolute values? Do they differ much (more than, say 1e-6)? If they differ too much for you, this could be a symptom of some other problems, so it may be worth investigating in machines where you get this thing (others can do nothing). Since the princomp.default is difficult to find (either getAnywhere(princomp.default) or stats:::princomp -- I hate this information hiding), and its code is winding, I'd suggest you concentrate studying line: sol - eigen(cv, symmetric=TRUE) where you get the cv with cv - cov.wt(x)$cov * (1 - 1/nrow(x)) and x is your data matrix. If cv remains unchanged from time to time, but there is a change in signs of sol$vectors, then you have localised your problem. If it's not there, then the rest of the princomp.default code is worth investigating. If it's in the eigen, then it dives deep into Fortran, and that may be all you can say. (If your covariance matrices change with repeated calculations, then the problem is deeper). However, sign doesn't matter if there are -- Jari Oksanen [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Signs of loadings from princomp on Windows
On 16 Sep 2004, Peter Dalgaard wrote: Tony Plate [EMAIL PROTECTED] writes: difference? (The fact that various people chimed in to say they could reproduce the behavior that bothered you, but didn't bother dig deeper suggests it didn't bother them that much, which further suggests that you are the person most motivated by this and thus the best candidate for investigating it further...) It could be well worth finding though. It's most likely a reliance on uninitialized memory (the only other explanation I can think of is if something is tampering with the FPU control word). That may be mostly harmless if the algorithm converges - the sign is not well defined anyway - but we have recently fixed a couple of bugs where the occasional injection of NaN or Inf values caused real trouble. valgrind found nothing, though, so the uninitialized memory is probably not in R. I suspect a problem with the version of msvcrt.dll in use (and probably related to use of the full FPU precision in R). And I do think the OP is making a very big deal out of something that is documented on the help page. -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Use of R libraries in C or C++
Hi all, is it possible to use R libraries in a software built on C or C++? Hope someone can help me, Valeria This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Use of R libraries in C or C++
On Thu, 16 Sep 2004, De Palma, Valeria (IT - Milano) wrote: Hi all, is it possible to use R libraries in a software built on C or C++? Hope someone can help me, Valeria Look in src/nmath/standalone/README for details of how to use the libRmath library. Or did you mean R *packages*? -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] efficient submatrix extraction
there are two main ideas to improve the efficiency: 1. the comparison with the limit can be done at first 2. a matrix with boxsize*boxsize rows can be defined so that you can apply function apply without using inner loops *= # parameters size-1024; limit-0.7 # some data set.seed(17); data-runif(size^2) m-matrix(data,size,size) bcount.vec-NULL m-mlimit for (boxsize in 2^(1:8)) { # inner loop: m-array(m,c(boxsize,size/boxsize,size)) m-aperm(m,c(1,3,2)) m-matrix(m,nrow=boxsize*boxsize) bcount.vec-c(bcount.vec,sum(apply(m,2,max))) } bcount-sum(bcount.vec) print(bcount.vec) print(bcount) @ output-start [1] 199099 65306 16384 4096 1024256 64 16 [1] 286245 output-end Some remarks on your code: The first expression in your outer loop is setting bcount to 0. In the inner loops bcount is incremented. But the outer loop sets bcount to the value 0 again!? What do you want to count? Peter Rajarshi Guha wrote: Hi, I have a matrix of say 1024x1024 and I want to look at it in chunks. That is I'd like to divide into a series of submatrices of order 2x2. | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | ... So the first submatrix would be | 1 2 | | 1 2 | the second one would be | 3 4 | | 3 4 | and so on. That is I want the matrix to be evenly divided into 2x2 submatrices. Now I'm also doing this subdivision into 4x4, 8x8 ... 256x256 submatrices. Currently I'm using loops and I'm sure there is a mroe efficient way to do it: m - matrix(runif(1024*1024), nrow=1024) boxsize - 2^(1:8) for (b in boxsize) { bcount - 0 bstart - seq(1,1024, by=b) for (x in bstart) { for (y in bstart) { xend - x + b - 1 yend - y + b - 1 if (length(which( m[ x:xend, y:yend ] 0.7)) 0) { bcount - bcount + 1 } } } } Is there any way to vectorize the two inner loops? Thanks, --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- The way to love anything is to realize that it might be lost. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] newbie needs help using R as solver
Greetings I'm a total newbie in R and I'm trying to make a comparisson of Excel and R in the fields of: - optimisation modeling (using solver) - decision trees - simulation modeling as described in Winston, Wayne L.: Practical Management Science. for optimisation modeling in Excel I would normaly use solver. In R however I can't seem to be able to find the solution. I've narrowed it down to optim, optimize functions (I might be totaly wrong), but I can't figure out how to set the conditions. I've read something about nlm model but I can't find the anwser (examples are not easy enough for me). what I wanna do is solve this simple task: a+b = 50 c+d = 50 g = 0,25*c+d a+b+c+d+g = 100 a, b, c, d, g = 0 I would very much appreciate any help in this matter. I need to locate the appropriate function for the task and figure out how to write this formulas. I'd also be very thankfull for any help (links) to simple examples of decision trees and/or simulation. Andrej Udu __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] newbie needs help using R as solver
This is a linear programming problem. Although I am not sure what your objective function is!! Check out the R package linprog -Original Message- From: Andrej Uduc [mailto:[EMAIL PROTECTED] Sent: 16 September 2004 10:29 To: [EMAIL PROTECTED] Subject: [R] newbie needs help using R as solver Greetings I'm a total newbie in R and I'm trying to make a comparisson of Excel and R in the fields of: - optimisation modeling (using solver) - decision trees - simulation modeling as described in Winston, Wayne L.: Practical Management Science. for optimisation modeling in Excel I would normaly use solver. In R however I can't seem to be able to find the solution. I've narrowed it down to optim, optimize functions (I might be totaly wrong), but I can't figure out how to set the conditions. I've read something about nlm model but I can't find the anwser (examples are not easy enough for me). what I wanna do is solve this simple task: a+b = 50 c+d = 50 g = 0,25*c+d a+b+c+d+g = 100 a, b, c, d, g = 0 I would very much appreciate any help in this matter. I need to locate the appropriate function for the task and figure out how to write this formulas. I'd also be very thankfull for any help (links) to simple examples of decision trees and/or simulation. Andrej Uduè __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305 mailto:[EMAIL PROTECTED]http://www.kssg.com The information in this Internet email is confidential and m...{{dropped}} __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] newbie needs help using R as solver
The problem you describe is usually called `linear programming'. On my system I get help.search(linear programming) Help files with alias or concept or title matching 'linear programming' using fuzzy matching: solveLP(linprog)solve Linear Programming / Optimization problems lp.object(lpSolve) LP (linear programming) object print.simplex(boot) Print Solution to Linear Programming Problem simplex(boot) Simplex Method for Linear Programming Problems simplex.object(boot)Linear Programming Solution Objects so that's three packages to look into. On Thu, 16 Sep 2004, [ISO-8859-2] Andrej Uduè wrote: Greetings I'm a total newbie in R and I'm trying to make a comparisson of Excel and R in the fields of: Unless you are a `total newbie' in Excel, is that not inevitably an unfair comparison? I suspect almost all readers of this list would never have guessed to use `solver' for linear programming. - optimisation modeling (using solver) - decision trees - simulation modeling as described in Winston, Wayne L.: Practical Management Science. for optimisation modeling in Excel I would normaly use solver. In R however I can't seem to be able to find the solution. I've narrowed it down to optim, optimize functions (I might be totaly wrong), but I can't figure out how to set the conditions. I've read something about nlm model but I can't find the anwser (examples are not easy enough for me). what I wanna do is solve this simple task: a+b = 50 c+d = 50 g = 0,25*c+d a+b+c+d+g = 100 a, b, c, d, g = 0 I would very much appreciate any help in this matter. I need to locate the appropriate function for the task and figure out how to write this formulas. I'd also be very thankfull for any help (links) to simple examples of decision trees and/or simulation. Simple examples of decision trees: many of the R/S books listed in the FAQ. `Simulation' has several different meanings, so you need to be more explicit. -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] BUGS and OS X
Jari Oksanen wrote: On Wed, 2004-09-15 at 21:29, Tamas K Papp wrote: On Wed, Sep 15, 2004 at 02:21:18PM -0400, Liaw, Andy wrote: That's more of a question for the BUGS developers. BUGS is not open source, so whatever binary is provided, that's all you can use. If I'm not mistaken, WinBUGS is the only version under development. I found something called JAGS, and I am still exploring it. It appears to be an open-source BUGS replacement, thought with limitations. MacOS X is a kind of unix (where the emphasis is on the kind of), so you can get and compile any source code developed for unix -- with some luck. One alternative is Bassist available at http://www.cs.helsinki.fi/research/fdk/bassist/. I just tried and found out that you can compile and install it in MacOS X in the usual way (./configure make sudo make install). That's all I can say about it. It may not be easiest to use. The current version seems to be a bit oldish and not quite complete, but somebody claimed that they may start developing Bassist again. Actually, Bob O'Hara (who usually calls himself Anon. in this list) should know more, and hopefully this message will prompt him to tell us, too. I don't think Andrew has even tried installing WinBUGS it on a Mac (first problem: find a Mac). I haven't heard about any plans to develop BASSIST further, but as it's open source, someone else could take it up. The BASSIST language is very BUGS-like, so shouldn't be a big problem to learn. To answer Ramon about BUGS and R, be patient: I think an announcement will come soon, and I'd rather not pre-empt that. We're drifting away from R, so can I suggest either ending this, sticking to R, or shifting it to the WinBUGS list? That's probably a better forum for getting feedback on Bayesian stuff anyway. Oh, and Jari, are you likely to submit your R: opas ekologielle to CRAN at any time? Hint, hint. Bob -- Bob O'Hara Department of Mathematics and Statistics P.O. Box 68 (Gustaf Hällströmin katu 2b) FIN-00014 University of Helsinki Finland Telephone: +358-9-191 51479 Mobile: +358 50 599 0540 Fax: +358-9-191 51400 WWW: http://www.RNI.Helsinki.FI/~boh/ Journal of Negative Results - EEB: www.jnr-eeb.org __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] newbie needs help using R as solver
Hi, it a LP problem. It's not just a function to optimize (in this way optim() and optimize() are not usefull), but a linear system grouping sever equations/dis-equations. See package linprog and boot. See these link about LP: http://www.ece.northwestern.edu/OTC/ http://www.isye.gatech.edu/~spyros/LP/LP.html http://www.faqs.org/faqs/linear-programming-faq/ best Vito Greetings I'm a total newbie in R and I'm trying to make a comparisson of Excel and R in the fields of: - optimisation modeling (using solver) - decision trees - simulation modeling as described in Winston, Wayne L.: Practical Management Science. for optimisation modeling in Excel I would normaly use solver. In R however I can't seem to be able to find the solution. I've narrowed it down to optim, optimize functions (I might be totaly wrong), but I can't figure out how to set the conditions. I've read something about nlm model but I can't find the anwser (examples are not easy enough for me). what I wanna do is solve this simple task: a+b = 50 c+d = 50 g = 0,25*c+d a+b+c+d+g = 100 a, b, c, d, g = 0 I would very much appreciate any help in this matter. I need to locate the appropriate function for the task and figure out how to write this formulas. I'd also be very thankfull for any help (links) to simple examples of decision trees and/or simulation. Andrej Udu#269; = Diventare costruttori di soluzioni Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml ___ http://it.seriea.fantasysports.yahoo.com/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] getting started on Bayesian analysis
On Wed, 2004-09-15 at 02:19, Tamas K Papp wrote: I am an economist who decided it's high time that I learned some Bayesian statistics. I am following An Introduction to Modern Bayesian Econometrics by T. Lancaster. The book recommends using BUGS, but I wonder if there are any alternatives which are free software and fully integrated to R (which I have been using for more than two years for numerical computations.) I would like to learn what R packages (or other software) statisticians use for Bayesian analysis to R, if there are viable alternatives to BUGS, etc. Bayesian analysis in R is relatively underdeveloped. However, Greg Warnes recently decided to get everyone involved with MCMC in R talking to each other. The current state of the art can be seen here: http://research.warnes.net/Members/warnes/R-MCMC/ All I can say is watch this space for future developments. Martyn __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] BUGS and OS X
On Wed, 2004-09-15 at 20:29, Tamas K Papp wrote: On Wed, Sep 15, 2004 at 02:21:18PM -0400, Liaw, Andy wrote: That's more of a question for the BUGS developers. BUGS is not open source, so whatever binary is provided, that's all you can use. If I'm not mistaken, WinBUGS is the only version under development. I found something called JAGS, and I am still exploring it. It appears to be an open-source BUGS replacement, thought with limitations. Version 0.65 of JAGS runs on MacOs X, thanks to Christopher Jackson. The new manual contains instructions on compilation. Martyn __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Indexing lists
DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. --- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Indexing lists
Maybe not the best solution, but something like: lapply(mylist,function(x) {return(list(FirstCol=mylist[,1],FirstRow=mylist[1,]))}) In any case, look at ?lapply Sean On Sep 16, 2004, at 7:33 AM, Perez Martin, Agustin wrote: DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. --- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Indexing lists
Perez Martin, Agustin [EMAIL PROTECTED] writes: DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. Possibly (if I catch your drift...) lapply(yourlist,[,1,1) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Indexing lists
Sean Davis [EMAIL PROTECTED] writes: Maybe not the best solution, but something like: lapply(mylist,function(x) {return(list(FirstCol=mylist[,1],FirstRow=mylist[1,]))}) ITYM list(FirstCol=x[,1],FirstRow=x[1,]) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Indexing lists
On Sep 16, 2004, at 7:57 AM, Peter Dalgaard wrote: Sean Davis [EMAIL PROTECTED] writes: Maybe not the best solution, but something like: lapply(mylist,function(x) {return(list(FirstCol=mylist[,1],FirstRow=mylist[1,]))}) ITYM list(FirstCol=x[,1],FirstRow=x[1,]) Uh, Duh! Thanks. Some help I am __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Indexing lists
Perez Martin, Agustin agustin.perez at umh.es writes: : I have a list with 500 elements, in each other there are data.frames and I : want to take the first row and the first column of each elements of my list : since the first to the 500-th. Here are some variations depending on what you want. Also try all these with lapply replaced by sapply. # test data data(iris) iris - head(iris) L - list(iris, iris) # various possibilities lapply(L, [, 1, 1) # column 1, row 1 lapply(L, [[, 1) # column 1 lapply(L, [, 1) # column 1 as data frame lapply(L, function(x) x[1,]) # row 1 lapply(L, function(x) list(x[1,],x[,1])) # 2 el list with row 1 and column 1 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Conditionally swap two columns of a data.frame?
I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). I would just like to swap the values in the data frame (to put the bigest first for example), then use the above plot to get what I want. Should I use the DB backend to the data to make the dump in this way? (involves some hacky sql) Considering I am interested in the range of the ratio between V1 and V2, should I be looking at doing a different analysis? I am so dumb, any help is appreciated, Dan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Indexing lists
m - matrix(1:9, nc=3) a - list(m, m+10, m+100, m+1000) sapply(a, function(mat) mat[1,1]) [1]1 11 101 1001 On Thu, 2004-09-16 at 12:33, Perez Martin, Agustin wrote: DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. --- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
R: [R] Indexing lists
Hi, Probably it should be useful to obtain two results which you can combine according to what you need. Here a possible solution: a-b-data.frame(matrix(runif(30),10,3)) d-list(a,b) #your list #extract the 1st column. The output is a nrow(a)-by-length(d) matrix sapply(d,function(x)x[,1]) #extract the 1st row. The output is a ncol(a)-by-length(d) matrix sapply(d,function(x)x[1,]) #a ncol(a)-by-length(d) matrix Note if the dimensions of dataframes are different you will get lists. Anyway, if you prefer lists rather than matrices use lapply() best, vito - Original Message - From: Perez Martin, Agustin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 1:33 PM Subject: [R] Indexing lists DeaR useRs: I have a list with 500 elements, in each other there are data.frames and I want to take the first row and the first column of each elements of my list since the first to the 500-th. Thanks and excuse my bad English. --- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How do I insert a newline in my title in a plot?
Hello, I want to help me with a simple I think question: How do I insert a newline into the title of a plot I have made? Is it only done with hershey fonts? vfont = ??? and so on? I do not understand Hershey fonts, and I am afraid to use them, since I use greek fonts (iso8859-7). I need propably something like: title(This is a title\nIn 2 lines); any help? __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
Hi Dan, do you need something like that, dat - data.frame(V1=rnorm(4, 10), V2=rnorm(4, 10)) ratioV1V2 - ifelse(dat$V1dat$V2, dat$V1/dat$V2, dat$V2/dat$V1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). I would just like to swap the values in the data frame (to put the bigest first for example), then use the above plot to get what I want. Should I use the DB backend to the data to make the dump in this way? (involves some hacky sql) Considering I am interested in the range of the ratio between V1 and V2, should I be looking at doing a different analysis? I am so dumb, any help is appreciated, Dan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
On Thu, 16 Sep 2004, Dan Bolser wrote: I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } data$ratioV1V2 - ifelse(V1V2, V1/V2, V2/V1) # or pmax(V1,V2)/pmin(V1, V2) and either attach(data) or use inside with(data, ). This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). You appear to be doing a single calculation 40,000 times. Did you not get a warning there? (Maybe 40,000 warnings?) -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
Minter! Is there an R cookbook? which lists this kind of common problem and common solution? On Thu, 16 Sep 2004, Dimitris Rizopoulos wrote: Hi Dan, do you need something like that, dat - data.frame(V1=rnorm(4, 10), V2=rnorm(4, 10)) ratioV1V2 - ifelse(dat$V1dat$V2, dat$V1/dat$V2, dat$V2/dat$V1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). I would just like to swap the values in the data frame (to put the bigest first for example), then use the above plot to get what I want. Should I use the DB backend to the data to make the dump in this way? (involves some hacky sql) Considering I am interested in the range of the ratio between V1 and V2, should I be looking at doing a different analysis? I am so dumb, any help is appreciated, Dan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Conditionally swap two columns of a data.frame?
ifelse accomplishes this pretty easily (at least I think it does what you want) Look at ?apply too. HTH, Andy ## Try this foo.dat - data.frame(Var1 = rnorm(4, 1, 1), Var2 = (rnorm(4, 1, 1) * 0.25)) plot(density(foo.dat$Var1 / foo.dat$Var2)) RatioOne - ifelse(foo.dat$Var1 foo.dat$Var2, foo.dat$Var1 / foo.dat$Var2, foo.dat$Var2 / foo.dat$Var1) RatioTwo - numeric() for (i in 1:nrow(foo.dat)) { RatioTwo[i] - if(foo.dat$Var1[i] foo.dat$Var2[i]) foo.dat$Var1[i] / foo.dat$Var2[i] else foo.dat$Var2[i] / foo.dat$Var1[i] } cor(RatioOne, RatioTwo) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
type help.start() in the R console or open manually the C:\Program Files\R\rw1091\doc\html\rwin.html file and you will get all the available on-line documentation that ships with each R installation. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: Dimitris Rizopoulos [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:55 PM Subject: Re: [R] Conditionally swap two columns of a data.frame? Minter! Is there an R cookbook? which lists this kind of common problem and common solution? On Thu, 16 Sep 2004, Dimitris Rizopoulos wrote: Hi Dan, do you need something like that, dat - data.frame(V1=rnorm(4, 10), V2=rnorm(4, 10)) ratioV1V2 - ifelse(dat$V1dat$V2, dat$V1/dat$V2, dat$V2/dat$V1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). I would just like to swap the values in the data frame (to put the bigest first for example), then use the above plot to get what I want. Should I use the DB backend to the data to make the dump in this way? (involves some hacky sql) Considering I am interested in the range of the ratio between V1 and V2, should I be looking at doing a different analysis? I am so dumb, any help is appreciated, Dan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
FW: [R] How do I insert a newline in my title in a plot?
yes I have tries, and nothing. It just shows the strings with the slashn, just like i typed it. -Original Message- From: Rashid Nassar [mailto:[EMAIL PROTECTED] Sent: , 16 2004 15:44 To: Christos Rodopoulos Subject: Re: [R] How do I insert a newline in my title in a plot? Have you not tried what you have already suggested: title(this is a title\nIn 2 lines) ? On Thu, 16 Sep 2004, Christos Rodopoulos wrote: Hello, I want to help me with a simple I think question: How do I insert a newline into the title of a plot I have made? Is it only done with hershey fonts? vfont = ??? and so on? I do not understand Hershey fonts, and I am afraid to use them, since I use greek fonts (iso8859-7). I need propably something like: title(This is a title\nIn 2 lines); any help? __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] How do I insert a newline in my title in a plot?
You had it. plot(1:5, main = This is a title\nIn 2 lines) HTH, Andy __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
On Thu, 16 Sep 2004, Dimitris Rizopoulos wrote: type help.start() in the R console or open manually the C:\Program Files\R\rw1091\doc\html\rwin.html file and you will get all the available on-line documentation that ships with each R installation. That is the problem, you get it all ;) Thanks though, Dan. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: Dimitris Rizopoulos [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:55 PM Subject: Re: [R] Conditionally swap two columns of a data.frame? Minter! Is there an R cookbook? which lists this kind of common problem and common solution? On Thu, 16 Sep 2004, Dimitris Rizopoulos wrote: Hi Dan, do you need something like that, dat - data.frame(V1=rnorm(4, 10), V2=rnorm(4, 10)) ratioV1V2 - ifelse(dat$V1dat$V2, dat$V1/dat$V2, dat$V2/dat$V1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). I would just like to swap the values in the data frame (to put the bigest first for example), then use the above plot to get what I want. Should I use the DB backend to the data to make the dump in this way? (involves some hacky sql) Considering I am interested in the range of the ratio between V1 and V2, should I be looking at doing a different analysis? I am so dumb, any help is appreciated, Dan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
Hoi Dan, --On donderdag 16 september 2004 13:55 +0100 Dan Bolser [EMAIL PROTECTED] wrote: Is there an R cookbook? Yes there is (sort of): StatsRus http://www.ku.edu/~pauljohn/R/Rtips.html kind regards, Paul -- Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /\ Montessorilaan 3 (B.01.05)Against HTML Mail \ / NL-6525 HR Nijmegen X The Netherlands / \ Phonenumber+31-24-3612648 Fax+31-24-3616066 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Conditionally swap two columns of a data.frame?
Hi! Better then a cookbook. http://www.ku.edu/~pauljohn/R/Rtips.html /E Ps. *** REPLY SEPARATOR *** On 9/16/2004 at 1:55 PM Dan Bolser wrote: Minter! Is there an R cookbook? which lists this kind of common problem and common solution? On Thu, 16 Sep 2004, Dimitris Rizopoulos wrote: Hi Dan, do you need something like that, dat - data.frame(V1=rnorm(4, 10), V2=rnorm(4, 10)) ratioV1V2 - ifelse(dat$V1dat$V2, dat$V1/dat$V2, dat$V2/dat$V1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Dan Bolser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM Subject: [R] Conditionally swap two columns of a data.frame? I am doing this a kinda dumb way, and it is apparetnly taking forever. I have a data frame with two numeric columns. I want to look at their correlation, and I am looking at the size ratio between the two. i.e. plot(density(data$V1/data$V2)) This kinda gives me a normal curve showing something about the distribution of the two values. I want to make sure that V1/V2 is always 1 ... for (i in 1:length(row.names(data)) ){ ratioV1V2 - if(V1V2) V1/V2 else V2/V1 } This is a bit of a hack, and is taking forever for some reson (about 40,000 rows in my data.frame). I would just like to swap the values in the data frame (to put the bigest first for example), then use the above plot to get what I want. Should I use the DB backend to the data to make the dump in this way? (involves some hacky sql) Considering I am interested in the range of the ratio between V1 and V2, should I be looking at doing a different analysis? I am so dumb, any help is appreciated, Dan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Dipl. bio-chem. Witold Eryk Wolski @ MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin'v' tel: 0049-30-83875219/ \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] How do I insert a newline in my title in a plot?
Dear Christos, This works for me, and has many times in the past. Is it possible that you used a forward-slash (/), rather than a back-slash (\)? Alternatively, perhaps this has something to do with using Greek fonts. I hope this helps, John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Rodopoulos Sent: Thursday, September 16, 2004 8:00 AM To: '[EMAIL PROTECTED]' Subject: FW: [R] How do I insert a newline in my title in a plot? yes I have tries, and nothing. It just shows the strings with the slashn, just like i typed it. -Original Message- From: Rashid Nassar [mailto:[EMAIL PROTECTED] Sent: , 16 2004 15:44 To: Christos Rodopoulos Subject: Re: [R] How do I insert a newline in my title in a plot? Have you not tried what you have already suggested: title(this is a title\nIn 2 lines) ? On Thu, 16 Sep 2004, Christos Rodopoulos wrote: Hello, I want to help me with a simple I think question: How do I insert a newline into the title of a plot I have made? Is it only done with hershey fonts? vfont = ??? and so on? I do not understand Hershey fonts, and I am afraid to use them, since I use greek fonts (iso8859-7). I need propably something like: title(This is a title\nIn 2 lines); any help? __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: FW: [R] How do I insert a newline in my title in a plot?
On Thu, 16 Sep 2004, Christos Rodopoulos wrote: yes I have tries, and nothing. It just shows the strings with the slashn, just like i typed it. Please consult the R posting guide and give us some basic information such as version of R, platform, graphics device and so on. plot(1:10) title(this is a title\nIn 2 lines) should work, and does for me on Windows and Linux. I dimly remember it did not on a Mac at one point. -Original Message- From: Rashid Nassar [mailto:[EMAIL PROTECTED] Sent: ÐÝìðôç, 16 Óåðôåìâñßïõ 2004 15:44 To: Christos Rodopoulos Subject: Re: [R] How do I insert a newline in my title in a plot? Have you not tried what you have already suggested: title(this is a title\nIn 2 lines) ? On Thu, 16 Sep 2004, Christos Rodopoulos wrote: Hello, I want to help me with a simple I think question: How do I insert a newline into the title of a plot I have made? Is it only done with hershey fonts? vfont = ??? and so on? I do not understand Hershey fonts, and I am afraid to use them, since I use greek fonts (iso8859-7). I need propably something like: title(This is a title\nIn 2 lines); any help? __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
FW: FW: [R] How do I insert a newline in my title in a plot?
platform: Linux Mandrake 10.0 AMD processor, X11 graphics with XFree latest, R version 1.9.1 home-compiled. -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: ??, 16 ??? 2004 16:27 To: Christos Rodopoulos Cc: '[EMAIL PROTECTED]' Subject: Re: FW: [R] How do I insert a newline in my title in a plot? On Thu, 16 Sep 2004, Christos Rodopoulos wrote: yes I have tries, and nothing. It just shows the strings with the slashn, just like i typed it. Please consult the R posting guide and give us some basic information such as version of R, platform, graphics device and so on. plot(1:10) title(this is a title\nIn 2 lines) should work, and does for me on Windows and Linux. I dimly remember it did not on a Mac at one point. -Original Message- From: Rashid Nassar [mailto:[EMAIL PROTECTED] Sent: ÐÝìðôç, 16 Óåðôåìâñßïõ 2004 15:44 To: Christos Rodopoulos Subject: Re: [R] How do I insert a newline in my title in a plot? Have you not tried what you have already suggested: title(this is a title\nIn 2 lines) ? On Thu, 16 Sep 2004, Christos Rodopoulos wrote: Hello, I want to help me with a simple I think question: How do I insert a newline into the title of a plot I have made? Is it only done with hershey fonts? vfont = ??? and so on? I do not understand Hershey fonts, and I am afraid to use them, since I use greek fonts (iso8859-7). I need propably something like: title(This is a title\nIn 2 lines); any help? __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
FW: [R] How do I insert a newline in my title in a plot?
Thank you very much! I should have known... well, to inform you, this is the case: The problem was of a friend of mine, told to me me by phone. From the begining I was telling my friend BYPHONE to do this: title(This is a title\nIn 2 lines) but my friend understood and did all the time this: title(This is a title/nIn 2 lines). but it is my problem too: the problem is that I say slash and I mean backslash, or vice cersa (!) So the phone-confusion occured, and I was reporting a problem which does not exist! thank you all for your help. Thanks from my friend too, and sorry for the confusion I created. -Original Message- From: John Fox [mailto:[EMAIL PROTECTED] Sent: , 16 2004 16:25 To: 'Christos Rodopoulos' Cc: [EMAIL PROTECTED] Subject: RE: [R] How do I insert a newline in my title in a plot? Dear Christos, This works for me, and has many times in the past. Is it possible that you used a forward-slash (/), rather than a back-slash (\)? Alternatively, perhaps this has something to do with using Greek fonts. I hope this helps, John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Rodopoulos Sent: Thursday, September 16, 2004 8:00 AM To: '[EMAIL PROTECTED]' Subject: FW: [R] How do I insert a newline in my title in a plot? yes I have tries, and nothing. It just shows the strings with the slashn, just like i typed it. -Original Message- From: Rashid Nassar [mailto:[EMAIL PROTECTED] Sent: , 16 2004 15:44 To: Christos Rodopoulos Subject: Re: [R] How do I insert a newline in my title in a plot? Have you not tried what you have already suggested: title(this is a title\nIn 2 lines) ? On Thu, 16 Sep 2004, Christos Rodopoulos wrote: Hello, I want to help me with a simple I think question: How do I insert a newline into the title of a plot I have made? Is it only done with hershey fonts? vfont = ??? and so on? I do not understand Hershey fonts, and I am afraid to use them, since I use greek fonts (iso8859-7). I need propably something like: title(This is a title\nIn 2 lines); any help? __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: FW: [R] How do I insert a newline in my title in a plot?
On Thu, 16 Sep 2004, Paul Lemmens wrote: Hoi Christos, --On donderdag 16 september 2004 16:00 +0300 Christos Rodopoulos [EMAIL PROTECTED] wrote: yes I have tries, and nothing. It just shows the strings with the slashn, just like i typed it. -Original Message- From: Rashid Nassar [mailto:[EMAIL PROTECTED] Sent: ÐÝìðôç, 16 Óåðôåìâñßïõ 2004 15:44 To: Christos Rodopoulos Subject: Re: [R] How do I insert a newline in my title in a plot? Have you not tried what you have already suggested: title(this is a title\nIn 2 lines) ? I've tried it out and you should use single quotes, then it'll work. At least inside R single and double quotes are equivalent. So it's an interpretation matter. Unfortunately I cannot figure out the help page dealing with this :-/ That's because it's in R-lang: String constants are delimited by a pair of single (@samp{'}) or double (@samp{}) quotes and can contain all other printable characters. Quotes and other special characters within strings are specified using @emph{escape sequences}: A single quote may also be embedded directly in a double-quote delimited string and vice versa. It is possible that a front-end processor is interfering here, and so what is typed is not reaching R unchanged. -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] date library and notched boxplots
I'm having problems using the date library with notched boxplots. I have separate month, day, and year columns and would like to plot the columns as a date against other variables. I have used the mdy.date(month,day,year) command before with plot(), but it doesn't seem to work with boxplot(). Instead of the dates along the x-axis, I get a list of numbers. Maybe I have the code wrong? I have used the help() menu in R, but with no success. Can somebody please help? Thanks, Stephanie __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Multi-dimensional scaling
R-help, Is there any package/function in R which can perform multi-dimensional scaling? Thank you in advance __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multi-dimensional scaling
As recently discussed on this list, it's useful to search for functionality using the help.search() function. help.search(multidimensional scaling) Luis Rideau Cruz wrote: R-help, Is there any package/function in R which can perform multi-dimensional scaling? Thank you in advance __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multi-dimensional scaling
Luis Rideau Cruz wrote: R-help, Is there any package/function in R which can perform multi-dimensional scaling? I'd look at the results given by help.search(multi-dimensional scaling) Uwe Ligges Thank you in advance __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multi-dimensional scaling
see ?cmdscale Sean On Sep 16, 2004, at 10:28 AM, Luis Rideau Cruz wrote: R-help, Is there any package/function in R which can perform multi-dimensional scaling? Thank you in advance __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multi-dimensional scaling
See: www.r-project.org - Documentation-Newsletter-Volume 3/3, December 2003 There is an artikle by Jonathan Edwards and Paul Oman Dimensional Reduction for Data Mapping /E *** REPLY SEPARATOR *** On 9/16/2004 at 3:28 PM Luis Rideau Cruz wrote: R-help, Is there any package/function in R which can perform multi-dimensional scaling? Thank you in advance __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Dipl. bio-chem. Witold Eryk Wolski @ MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin'v' tel: 0049-30-83875219/ \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multi-dimensional scaling
On Thu, 2004-09-16 at 17:28, Luis Rideau Cruz wrote: Is there any package/function in R which can perform multi-dimensional scaling? Yes. Ripley's MASS package has isoMDS for non-metric multidimensional scaling. Moreover, the same package has function sammon for another variant. Some people regard SOM as a crude form of multidimensional scalling, and that is -- surprise -- in MASS, too (but there are other implementations). Vasic R (or its stats component) has principal co-ordinates analysis, a.k.a. as metric multidimensional scaling. Finally, R has a utility help.search which would show you most of these and something else, too (perhaps xgvis in the xgobi, if that's installed in your system). Try help.search(multidimensional scaling). cheers, jari oksane -- Jari Oksanen [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] date library and notched boxplots
smestrella at juno.com smestrella at juno.com writes: : : I'm having problems using the date library with notched boxplots. I have separate month, day, and year : columns and would like to plot the columns as a date against other variables. I have used the : mdy.date(month,day,year) command before with plot(), but it doesn't seem to work with boxplot(). : Instead of the dates along the x-axis, I get a list of numbers. Maybe I have the code wrong? I have used the : help() menu in R, but with no success. : : Can somebody please help? I think the reason no one is responding to your posts is that (1) not many people use the date class (try using the Date class instead) and (2) you are not providing a small reproduceable example of your code together with the associated data so no one really knows the specifics of your problem. There is a link to the posting guide at the bottom of each post. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] There were 50 or more warnings (use warnings() to see the first 50)
I employ R in the Slave-Mode. The slave returns me the following feedback: There were 50 or more warnings (use warnings() to see the first 50) I have found no way so far to get the warnings viewed. Which command would be appropriate? warnings() (without an argument) returns NULL. Thank you in advance. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] date library and notched boxplots
Try formatting the dates as character strings, and supplying those to boxplot(). At 2:16 PM + 9/16/04, [EMAIL PROTECTED] wrote: I'm having problems using the date library with notched boxplots. I have separate month, day, and year columns and would like to plot the columns as a date against other variables. I have used the mdy.date(month,day,year) command before with plot(), but it doesn't seem to work with boxplot(). Instead of the dates along the x-axis, I get a list of numbers. Maybe I have the code wrong? I have used the help() menu in R, but with no success. Can somebody please help? Thanks, Stephanie __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Estimating parameters for a bimodal distribution
For several years, I have been using Splus to analyze an ongoing series of datasets that have a bimodal distribution. I have used the following functions, in particular the ms() function, to estimate the parameters: two means, two standard deviations, and one proportion. Here is the code I've been using in S: btmp.bi - function(vec, p, m1, m2, sd1, sd2) { (exp(p)/(1+exp(p)))*dnorm(vec,mean=m1,sd=abs(sd1))+ (1-(exp(p)/(1+exp(p*dnorm(vec,mean=m2,sd=abs(sd2)) } btmp11 - ms( ~ - sum(log((btmp.bi(btmp1$Temp, p, m1, m2, s1, s2, start = list(p = 0.4, m1 = 38, m2 = 40, s1 = 1, s2 = 1), control = list(maxiter = 200)) I have looked in the archives and tried various alternatives, especially optim(), but so far have had nothing but frustration. I've been running this in a semi-automated program on several hundred datasets a few times each month for several years now. I would like to figure out how to move this to R. Thank you for any help you might offer. == George W. GilchristEmail #1: [EMAIL PROTECTED] Department of Biology, Box 8795 Email #2: [EMAIL PROTECTED] College of William MaryPhone: (757) 221-7751 Williamsburg, VA 23187-8795Fax: (757) 221-6483 http://gwgilc.people.wm.edu/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] newbie needs help using R as solver
On Thursday 16 September 2004 11:44, Wayne Jones wrote: This is a linear programming problem. Although I am not sure what your objective function is!! Check out the R package linprog Please use the package lpSolve, it's much better and _faster_ than linprog. I started writing linprog before lpSolve was published. After lpSolve was on cran, I mainly used this package and worked only very little on linprog. Thus, linprog is still an alpha version. There are only few cases when linprog might be prefered (e.g. dual values). I hope that the next version of lpSolve will include these cases (then I will ask to remove linprog from cran). Best wishes, Arne -Original Message- From: Andrej Uduc [mailto:[EMAIL PROTECTED] Sent: 16 September 2004 10:29 To: [EMAIL PROTECTED] Subject: [R] newbie needs help using R as solver Greetings I'm a total newbie in R and I'm trying to make a comparisson of Excel and R in the fields of: - optimisation modeling (using solver) - decision trees - simulation modeling as described in Winston, Wayne L.: Practical Management Science. for optimisation modeling in Excel I would normaly use solver. In R however I can't seem to be able to find the solution. I've narrowed it down to optim, optimize functions (I might be totaly wrong), but I can't figure out how to set the conditions. I've read something about nlm model but I can't find the anwser (examples are not easy enough for me). what I wanna do is solve this simple task: a+b = 50 c+d = 50 g = 0,25*c+d a+b+c+d+g = 100 a, b, c, d, g = 0 I would very much appreciate any help in this matter. I need to locate the appropriate function for the task and figure out how to write this formulas. I'd also be very thankfull for any help (links) to simple examples of decision trees and/or simulation. Andrej Uduè __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305 mailto:[EMAIL PROTECTED] http://www.kssg.com The information in this Internet email is confidential and m...{{dropped}} __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 [EMAIL PROTECTED] http://www.uni-kiel.de/agrarpol/ahenningsen/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] getting started on Bayesian analysis
As far as I understand, WinBUGS is currently free (it might not stay free for ever though) and has an output analysis suite for R called CODA, translated from S-Plus by Martyn Plummer. You can read more about it at http://www-fis.iarc.fr/coda/ Good luck! Francisco From: Martyn Plummer [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: R-help mailing list [EMAIL PROTECTED] Subject: Re: [R] getting started on Bayesian analysis Date: Thu, 16 Sep 2004 13:00:15 +0200 On Wed, 2004-09-15 at 02:19, Tamas K Papp wrote: I am an economist who decided it's high time that I learned some Bayesian statistics. I am following An Introduction to Modern Bayesian Econometrics by T. Lancaster. The book recommends using BUGS, but I wonder if there are any alternatives which are free software and fully integrated to R (which I have been using for more than two years for numerical computations.) I would like to learn what R packages (or other software) statisticians use for Bayesian analysis to R, if there are viable alternatives to BUGS, etc. Bayesian analysis in R is relatively underdeveloped. However, Greg Warnes recently decided to get everyone involved with MCMC in R talking to each other. The current state of the art can be seen here: http://research.warnes.net/Members/warnes/R-MCMC/ All I can say is watch this space for future developments. Martyn __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] There were 50 or more warnings (use warnings() to see the first 50)
Try putting options(warn=1) at the start of your R code. This should cause the warnings to be printed as they occur, instead of the default of being saved up until the top-level command terminates. See ?warning and ?option. -- Tony Plate At Thursday 08:52 AM 9/16/2004, Mag. Ferri Leberl wrote: I employ R in the Slave-Mode. The slave returns me the following feedback: There were 50 or more warnings (use warnings() to see the first 50) I have found no way so far to get the warnings viewed. Which command would be appropriate? warnings() (without an argument) returns NULL. Thank you in advance. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Estimating parameters for a bimodal distribution
Hi George, I tried the following and it worked for me, btmp.bi - function(par., vec){ p - par.[1] mu1 - par.[2] mu2 - par.[3] sigma1 - par.[4] sigma2 - par.[5] -sum(log( plogis(p)*dnorm(vec, mu1, abs(sigma1)) + (1-plogis(p))*dnorm(vec, mu2, abs(sigma2)) )) } vec - ifelse(runif(500).4, rnorm(1, 38, 1), rnorm(1, 40, 1)) optim(par=c(p=0.4, mu1=38, mu2=40, sigma1=1, sigma2=1), btmp.bi, method=CG, vec=vec) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: George W. Gilchrist [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, September 16, 2004 4:59 PM Subject: [R] Estimating parameters for a bimodal distribution For several years, I have been using Splus to analyze an ongoing series of datasets that have a bimodal distribution. I have used the following functions, in particular the ms() function, to estimate the parameters: two means, two standard deviations, and one proportion. Here is the code I've been using in S: btmp.bi - function(vec, p, m1, m2, sd1, sd2) { (exp(p)/(1+exp(p)))*dnorm(vec,mean=m1,sd=abs(sd1))+ (1-(exp(p)/(1+exp(p*dnorm(vec,mean=m2,sd=abs(sd2)) } btmp11 - ms( ~ - sum(log((btmp.bi(btmp1$Temp, p, m1, m2, s1, s2, start = list(p = 0.4, m1 = 38, m2 = 40, s1 = 1, s2 = 1), control = list(maxiter = 200)) I have looked in the archives and tried various alternatives, especially optim(), but so far have had nothing but frustration. I've been running this in a semi-automated program on several hundred datasets a few times each month for several years now. I would like to figure out how to move this to R. Thank you for any help you might offer. == George W. GilchristEmail #1: [EMAIL PROTECTED] Department of Biology, Box 8795 Email #2: [EMAIL PROTECTED] College of William MaryPhone: (757) 221-7751 Williamsburg, VA 23187-8795Fax: (757) 221-6483 http://gwgilc.people.wm.edu/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Estimating parameters for a bimodal distribution
George, Venables Ripley: Modern Applied Statistics with S, Springer 2002, Chapter 16 (An example: fitting a mixture model) may be helpful. Hannu Kahra -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of George W. Gilchrist Sent: Thursday, September 16, 2004 5:00 PM To: [EMAIL PROTECTED] Subject: [R] Estimating parameters for a bimodal distribution For several years, I have been using Splus to analyze an ongoing series of datasets that have a bimodal distribution. I have used the following functions, in particular the ms() function, to estimate the parameters: two means, two standard deviations, and one proportion. Here is the code I've been using in S: btmp.bi - function(vec, p, m1, m2, sd1, sd2) { (exp(p)/(1+exp(p)))*dnorm(vec,mean=m1,sd=abs(sd1))+ (1-(exp(p)/(1+exp(p*dnorm(vec,mean=m2,sd=abs(sd2)) } btmp11 - ms( ~ - sum(log((btmp.bi(btmp1$Temp, p, m1, m2, s1, s2, start = list(p = 0.4, m1 = 38, m2 = 40, s1 = 1, s2 = 1), control = list(maxiter = 200)) I have looked in the archives and tried various alternatives, especially optim(), but so far have had nothing but frustration. I've been running this in a semi-automated program on several hundred datasets a few times each month for several years now. I would like to figure out how to move this to R. Thank you for any help you might offer. == George W. GilchristEmail #1: [EMAIL PROTECTED] Department of Biology, Box 8795 Email #2: [EMAIL PROTECTED] College of William MaryPhone: (757) 221-7751 Williamsburg, VA 23187-8795Fax: (757) 221-6483 http://gwgilc.people.wm.edu/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Estimating parameters for a bimodal distribution
MASS4, chapter 16 has examples of a mixture of two normals by various methods, very like this one, in both S-PLUS and R. On Thu, 16 Sep 2004, George W. Gilchrist wrote: For several years, I have been using Splus to analyze an ongoing series of datasets that have a bimodal distribution. I have used the following functions, in particular the ms() function, to estimate the parameters: two means, two standard deviations, and one proportion. Here is the code I've been using in S: btmp.bi - function(vec, p, m1, m2, sd1, sd2) { (exp(p)/(1+exp(p)))*dnorm(vec,mean=m1,sd=abs(sd1))+ (1-(exp(p)/(1+exp(p*dnorm(vec,mean=m2,sd=abs(sd2)) } btmp11 - ms( ~ - sum(log((btmp.bi(btmp1$Temp, p, m1, m2, s1, s2, start = list(p = 0.4, m1 = 38, m2 = 40, s1 = 1, s2 = 1), control = list(maxiter = 200)) I have looked in the archives and tried various alternatives, especially optim(), but so far have had nothing but frustration. I've been running this in a semi-automated program on several hundred datasets a few times each month for several years now. I would like to figure out how to move this to R. Thank you for any help you might offer. == George W. GilchristEmail #1: [EMAIL PROTECTED] Department of Biology, Box 8795 Email #2: [EMAIL PROTECTED] College of William MaryPhone: (757) 221-7751 Williamsburg, VA 23187-8795Fax: (757) 221-6483 http://gwgilc.people.wm.edu/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] linear regression: evaluating the result Q
On Thu, 16 Sep 2004, RenE J.V. Bertin wrote: Dear all, A few quick questions about interpreting and evaluating the results of linear regressions, to which I hope equally quick answers are possible. 1) The summary.lm method prints the R and R^2 correlation coefficients (something reviewers like to see). It works on glm objects and (after tweaking it to initialise z$df.residual with rdf) also on rlm objects. Are the R, R^2 and also the p values reported reliable for these fit results? If not, how do I calculate them best? Well, for rlm no, as it is not least-squares fitting and R^2 is very suseptible to outliers. For glm, not really unless it is a Gaussian model. 2) For a simple 1st order linear fit, what is the best way to calculate the (95%) confidence interval on/of the slope? Use confint. (MASS chapter 7 has examples.) 3) The p values reported for the calculated coefficients and intercept indicate to what extent these values are significantly different from zero (right?). Yes. Aside from question 2), what is the best way to compare the calculated slope with another slope (say of the unity line)? Use offset, as in y ~ x + offset(x) and test for the coefficient of x to be zero. (That's R only, BTW.) -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] SJava, Client X11
tony == A J Rossini [EMAIL PROTECTED] on Mon, 13 Sep 2004 11:06:07 -0700 writes: tony Prof Brian Ripley [EMAIL PROTECTED] writes: In theory Omegahat has its own mailing lists. tony Possibly not in practice. I can't remember which machine (ETH or tony UWisc) they were once located on, either. not at ETH (or they would have continued to work ;-) tony I'm sure someone will let me know, preferably in tony public, so that we can know where to direct folks. I tony unsubscribed from them a while back because of the tony level of spam originating from them at the point. tony http://www.omegahat.org/mailman/listinfo tony reports: tony Mailman CGI error!!! ... A host lookup of 'www.omegahat.org' points to the location of the most active Omegahat developer (to whom this msg is BCC'ed). Regards, Martin Maechler __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] barplot with vcd library
Tatsuki Koyama Tatsuki.Koyama at Vanderbilt.edu writes: : : 'barplot' doesn't seem to work with vcd library. : Am I supposed to detach vcd when I want to use barplot? : Here's an example. : Say I have the following matrix, : : m - matrix(c(1,2,3, 4,5,6, 3,4,5, 2,3,4), ncol=4) : m : [,1] [,2] [,3] [,4] : [1,]1432 : [2,]2543 : [3,]3654 : : Then : barplot(m) : gives a barplot of the data. : : However, when I attach 'vcd' library, the same command does not seem : to work. graphics::barplot(m) will tell R you want the version in graphics rather than the one in vcd. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] linear regression: evaluating the result Q
On Thu, 16 Sep 2004, RenE J.V. Bertin wrote: On Thu, 16 Sep 2004 17:03:09 +0100 (BST), Prof Brian Ripley [EMAIL PROTECTED] wrote regarding Re: [R] linear regression: evaluating the result Q Thank you, that should get me going into the right direction! 8-) Well, for rlm no, as it is not least-squares fitting and R^2 is very 8-) suseptible to outliers. For glm, not really unless it is a Gaussian 8-) model. This is what I feared. How then would one evaluate the goodness of an rlm fit, on a comparable 0-1 scale? Via the estimated robust scales. 8-) Aside from question 2), what is the best way to compare 8-) the calculated slope with another slope (say of the unity line)? 8-) 8-) Use offset, as in y ~ x + offset(x) and test for the coefficient of x to 8-) be zero. (That's R only, BTW.) offset seems to be ignored by rlm(), is that correct? (Which isn't too much of a problem as long as confint operates correctly on rlm objects.) Yes -- rlm was written before R existed. -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] geoR/variog4() not returning all directions
Mac OS 10.3.5, R 2.0.0 latest version of geoR I have an incomplete 5 x 20 spatial array of samples (60 out of 100 possible locations) for which I would like to calculate directional variograms using variog4(). Unfortunately, I can't get it to return all 4 directions. It returns variograms for 45, 90, and 135 degrees, omitting 0 degrees (pi/4, pi/2, 3pi/4, omitting 0). If I specify 0 degrees, it returns a variogram with (binned) distances of 1, 2, 3, and 4. Any ideas what I am doing wrong, or what other information I could provide to better elucidate my problem? Many thanks, as usual. Hank Stevens Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] geoR/variog4() not returning all directions
Hi Martin The only pssible explanation I can find from your description is that the code may not be fiuding pairs in one of the directions. however...I never discard the possibility of a bug :) Could you please send me the data and the piec of relevant code such that i can rteproduce the error here? Thanks P.J, On Thu, 16 Sep 2004, Martin Henry H. Stevens wrote: Mac OS 10.3.5, R 2.0.0 latest version of geoR I have an incomplete 5 x 20 spatial array of samples (60 out of 100 possible locations) for which I would like to calculate directional variograms using variog4(). Unfortunately, I can't get it to return all 4 directions. It returns variograms for 45, 90, and 135 degrees, omitting 0 degrees (pi/4, pi/2, 3pi/4, omitting 0). If I specify 0 degrees, it returns a variogram with (binned) distances of 1, 2, 3, and 4. Any ideas what I am doing wrong, or what other information I could provide to better elucidate my problem? Many thanks, as usual. Hank Stevens Dr. Martin Henry H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/botany/bot/henry.html http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Paulo Justiniano Ribeiro Jr Departamento de Estatística Universidade Federal do Paraná Caixa Postal 19.081 CEP 81.531-990 Curitiba, PR - Brasil Tel: (+55) 41 361 3573 Fax: (+55) 41 361 3141 e-mail: [EMAIL PROTECTED] http://www.est.ufpr.br/~paulojus /\ \ / Campanha da fita ASCII - contra mail html X ASCII ribbon campaign - against html mail / \ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problem with R-1.9.1 under Solaris 2.6
Hi I have installed R-1.9.1 on an 6 year old Sun running Solaris 2.6. After some initial failures to compile I used the : gcc 2.7.2.3 f77 compilers with gnu make. [could not get gcc 3.4.1 to compile] All but one of the .c programs compiled [that being src/main/connections.c which I manually compiled using cc] and the make check tests all worked [apart from the internet]. However I get the following, where weight is a column vector : np - sum(weight) n - nrow(weight) weight - as.single((n*weight)/np) Error in structure(.Internal(as.vector(x, double)), Csingle = TRUE) : (list) object cannot be coerced to double dim(weight) [1] 38 1 version _ platform sparc-sun-solaris2.6 arch sparc os solaris2.6 system sparc, solaris2.6 status major1 minor9.1 year 2004 month06 day 21 language R I have searched the R-help and R-devel archives but not seen anything directly relevant. Any help would be much appreciated. Thanks Ray Lindsay Senior Statistician Natural Resources Branch ABARE Canberra Australia +61-2-6272 2215 -- IMPORTANT - This message has been issued by The Department of Agriculture, Fisheries and Forestry (DAFF). The information transmitted is for the use of the intended recipient only and may contain confidential and/or legally privileged material. It is your responsibility to check any attachments for viruses and defects before opening or sending them on. Any reproduction, publication, communication, re-transmission, disclosure, dissemination or other use of the information contained in this e-mail by persons or entities other than the intended recipient is prohibited. The taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error please notify the sender and delete all copies of this transmission together with any attachments. If you have received this e-mail as part of a valid mailing list and no longer want to receive a message such as this one advise the sender by return e-mail accordingly. Only e-mail correspondence which includes this footer, has been authorised by DAFF __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help with numerical solution for two simultaneous nonlinear equations in 2 variables
Hi, I am relatively new to R and am trying to solve two simultaneous nonlinear equations in two variables numerically, and was wondering if anyone knew if any of the packages could do that. An alternative is writing my own code using Newton-Raphson; I did that but was not able to get good convergence. Any ideas please? Thanks Yogesh [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] help with numerical solution for two simultaneous nonlinearequations in 2 variables
?optim will be helpful. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 503-217-5849 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joshi, Yogesh Sent: Thursday, September 16, 2004 10:54 PM To: [EMAIL PROTECTED] Subject: [R] help with numerical solution for two simultaneous nonlinearequations in 2 variables Hi, I am relatively new to R and am trying to solve two simultaneous nonlinear equations in two variables numerically, and was wondering if anyone knew if any of the packages could do that. An alternative is writing my own code using Newton-Raphson; I did that but was not able to get good convergence. Any ideas please? Thanks Yogesh [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problem with R-1.9.1 under Solaris 2.6
On Fri, 17 Sep 2004 [EMAIL PROTECTED] wrote: Hi I have installed R-1.9.1 on an 6 year old Sun running Solaris 2.6. After some initial failures to compile I used the : gcc 2.7.2.3 f77 compilers with gnu make. [could not get gcc 3.4.1 to compile] All but one of the .c programs compiled [that being src/main/connections.c which I manually compiled using cc] and the Out of curiosity, what was the error with ancient gcc? make check tests all worked [apart from the internet]. However I get the following, where weight is a column vector : There is no such thing in R (only vectors and 1D arrays). What does str(weight) say? Here's my guess: weight - data.frame(x=rnorm(38)) reproduces your error. So I think you have a one-column data frame, and you meant weight[[1]] (or weight[, 1] or weight[1]). Next, why are you calling as.single? This is not in the context which the help page says is the *only* place it should be used. np - sum(weight) n - nrow(weight) weight - as.single((n*weight)/np) Error in structure(.Internal(as.vector(x, double)), Csingle = TRUE) : (list) object cannot be coerced to double dim(weight) [1] 38 1 -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] thickness of tick marks
Hi, I am unable to get the tick marks to appear thicker in plot. I have tried things like par(lw=2) but this only seems to affect other line thicknesses. The use of axes directly fixes the problem because lw = 2 applies to both the axis and the ticks. Is there is way of feeding a single parameter to plot or setting a par parameter to do this? I am using R 1.9.0 on a windows 2000 platform. Thanks, David __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] thickness of tick marks
It is par(lwd) ^ The device's current setting of par(lwd) does not affect that used by axis() (as called by some plot methods). So you have to call axis() yourself. ?axis would have told you the default was 1. There was a wishlist item on R-bugs (PR#7223) to change this recently, and some counter-arguments -- search on the R-devel list archives for more details. On Fri, 17 Sep 2004, David J. Netherway wrote: I am unable to get the tick marks to appear thicker in plot. I have tried things like par(lw=2) but this only seems to affect other line thicknesses. The use of axes directly fixes the problem because lw = 2 applies to both the axis and the ticks. Is there is way of feeding a single parameter to plot or setting a par parameter to do this? I am using R 1.9.0 on a windows 2000 platform. -- 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html