[R] Deviance function in regression trees
Hello all. I have heard over and over that CART and its various tree-like brethren are non-parametric techniques. When I read the chapter in Chambers and Hastie on tree-based models it states that tree-based models can be generalized (GTMs) in a manner similar to GLMs by specifying a different deviance function to distributions other than the gaussian error distribution ( section 9.4.3). I have an application in which the response variable is a continuous variable representing tree counts within a unit area and thus would be best described by a poisson distribution. The error distribution for this data is not gaussian. If this is the case, will the gaussian error distribution used in most regression tree packages, be appropriate? Are there ways to specify the error distribution in R or Should I log transform the response variable? If the specification of error distribution in regression trees is important, than are these techniques truly non-parametric. Thanks for your inputs. Solomon Dobrowski Tahoe Environmental Research Center (TERC) John Muir Institute of the Environment University of California, Davis 530 754 9354 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Legend box line thickness
I am making a plot and am merely trying to increase the line thickness, or width, of the box drawn around the legend. The help page on 'legend' was of no use. Does anyone have any ideas? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Type II and III sum of square in Anova (R, car package)
I cannot resist a very brief entry into this old and seemingly immortal issue, but I will be very brief, I promise! Amasco Miralisus suggests: As I understood form R FAQ, there is disagreement among Statisticians which SS to use (http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-the-output-from-a nova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f). To let this go is to concede way too much. The 'disagreement' is really over whether this is a sensible question to ask in the first place. One side of the debate suggests that the real question is what hypotheses does it make sense to test and within what outer hypotheses. Settle that question and no issue on types of sums of squares arises. This is often a hard question to get your head around, and the attraction of offering a variety of 'types of sums of squares' holds out the false hope that perhaps you don't need to do so. The bad news is that for good science and good decision making, you do. Bill Venables. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with Functions
Hi check out R-and-octave.txt on the contributed docs section of CRAN. HTH Robin On 28 Aug 2006, at 17:50, Lord Tyranus wrote: Hello wizards, I need to convert the following functions (prestd, poststd, prepca) of matlab to R. Does Somebody knows how to do it. A description of the functions is: prestd preprocesses the network training set by normalizing the inputs and targets so that they have means of zero and standard deviations of 1. poststd postprocesses the network training set which was preprocessed by prestd. It converts the data back into unnormalized units. prepca preprocesses the network input training set by applying a principal component analysis. This analysis transforms the input data so that the elements of the input vector set will be uncorrelated. In addition, the size of the input vectors may be reduced by retaining only those components which contribute more than a specified fraction (min_frac) of the total variation in the data set. Thanks in advance. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Deviance function in regression trees
The short answer is that a Poisson distribution is a discrete distribution: if that is appropriate to your data the rpart function (in the package of that name) has a suitable option. On Mon, 28 Aug 2006, Solomon Dobrowski wrote: Hello all. I have heard over and over that CART and its various tree-like brethren are non-parametric techniques. When I read the chapter in Chambers and Hastie on tree-based models it states that tree-based models can be generalized (GTMs) in a manner similar to GLMs by specifying a different deviance function to distributions other than the gaussian error distribution ( section 9.4.3). I have an application in which the response variable is a continuous variable representing tree counts within a unit area and thus would be best described by a poisson distribution. The error distribution for this data is not gaussian. If this is the case, will the gaussian error distribution used in most regression tree packages, be appropriate? Are there ways to specify the error distribution in R or Should I log transform the response variable? If the specification of error distribution in regression trees is important, than are these techniques truly non-parametric. Thanks for your inputs. Solomon Dobrowski Tahoe Environmental Research Center (TERC) John Muir Institute of the Environment University of California, Davis 530 754 9354 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Firefox extension fo R Site Search
ecatchpole a écrit : Romain Francois wrote on 08/28/2006 04:23 PM: = Search for your R routines directly from Firefox! http://addictedtor.free.fr/rsitesearch = When I try to search I get the Firefox error TypeError: document.getElementById(currentPackage + : + currentHelpPage) has no properties Help! (Screen shot emailed separately to Romain.) Ted Hi Ted, Good catch. I'll fix it today. Did you try to search for something ? BTW, I'll set up a page in the developers section of the wiki to discuss (problems with) this project. To appear soon. Cheers, Romain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] standardized partial regression coefficients
Yuval Sapir wrote: Hi all, I am relatively new to R, so let me know if I missed something trivial. I want to perform path-analysis with at least three levels of explaining variables (i.e., A affects B that affects C). I perform multiple regression for each set of variables, and get estimates for the partial coefficients and their SE. How can I translate it to standardized partial regression coefficients (beta in SPSS)? Thanks Yuval RSiteSearch(standardized coefficients) is helpful. For example: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/68367.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/6038.html You also might consider the sem package by John Fox with its standardized.coefficients function. http://cran.r-project.org/doc/packages/sem.pdf -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] EOF and CCA analysis
Hello! I would like to do Empirical Orthogonal functions and Canonical correlation analysis on satellite data. My matrices are going to be very big (more than 10,000 locations). Are there limitations in R regarding the size of the matrix? thanks a lot regards Isidora __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] AffyChip Background Analysis
Dear list, I want to analyse some HG133Plus2.0 Affymetrix chips. The first thing I intent to do, is just to perform a background correction (mas, rma, gcrma,...) with the cel files. Then I want to take a look at the files. How can I do this ? Gunther __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove empty list from list - remove only one row and make as matrix
Dear all, After I work around, I found in my list of data with only one row which need to remove or make it as matrix. Here I write again my other toy example: x - list(matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4)) y - list(c(1, -1, -1, 1, 1),c(1, -1, -1, -1, -1),c(1, 1, 1, 1, 1),c(1, 1, -1, 1, -1),c(-1, -1, -1, -1, -1)) ## Thanks to Gabor Grothendieck for this trick. ## SIMPLIFY? SIMPLIFY simplify xy.list - mapply(cbind, x, y, SIMPLIFY=FALSE) point.class - t(cbind(c(10,20,15,4,-1),c(21,10,15,34,-1),c(11,13,6,3,1),c(7,5,5,2,1),c(8,9,5,12,-1))) class.diffsame - points.neighb(as.matrix(point.class), xy.list, 5) pd.class - points.diff(class.diffsame,xy.list) nc.test - vector(list,length(pd.class)) for (i in 1:length(pd.class)) { nc.test[[i]] - pd.class[[i]]$point.diff } nc.test # delete null/empty entries in a list dff - delete.NULLs(nc.test) dff; str(dff) dff [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [1] 1 6 11 16 1 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 lapply(dff, nrow) lapply(dff, nrow) [[1]] [1] 3 [[2]] NULL [[3]] [1] 2 #I can use #dff[unlist(lapply(dff, nrow) == 1)] #2,3, etc I have two questions here: a. I need to remove dff[[2]] b. How to make it as matrix (in list). I mean the result something like [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [,1] [,2] [,3] [,4] [,5] [1]1611 161 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 Best, Muhammad Subianto points.neighb - function(p.class, list.nc, class.col) { ntuples - nrow(p.class) instvec - vector(list,length=ntuples) for (i in 1:ntuples) { # Thanks to Petr Pikal for this trick instvec[[i]]$class.diff - (p.class[i,class.col] - list.nc[[i]][,class.col])!=0 instvec[[i]]$class.same - (p.class[i,class.col] - list.nc[[i]][,class.col])==0 } instvec } points.diff - function(p.class, list.nc) { ntuples - length(list.nc) instvec - vector(list,ntuples) for (i in 1:ntuples) { instvec[[i]]$point.diff - list.nc[[i]][p.class[[i]]$class.diff,] instvec[[i]]$point.same - list.nc[[i]][p.class[[i]]$class.same,] } instvec } # Thanks to Jim Holtman for this trick delete.NULLs - function(x.list){ x.list[unlist(lapply(x.list, length) != 0)] } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Type II and III sum of square in Anova (R, car package)
Amasco, In general it is dangerous to attempt to interpret a main effect that is included in an interaction, regardless of wether or not the interaction is significant. If you want to make a valid inference about a main effect it is safest to do so after dropping any interaction that contains the main effect. Since you would not want to drop a significant interaction, you should not try to interpret a main effect in the presence of a significant interaction that contains the main effect. If the interaction is not significant drop the interaction, re-run the model and then look at the main effect. John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC, University of Maryland School of Medicine Claude D. Pepper OAIC, University of Maryland Clinical Nutrition Research Unit, and Baltimore VA Center Stroke of Excellence University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) [EMAIL PROTECTED] Amasco Miralisus [EMAIL PROTECTED] 8/28/2006 3:20 PM Hello, First of all, I would like to thank everybody who answered my question. Every post has added something to my knowledge of the topic. I now know why Type III SS are so questionable. As I understood form R FAQ, there is disagreement among Statisticians which SS to use (http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f). However, most commercial statistical packages use Type III as the default (with orthogonal contrasts), just as STATISTICA, from which I am currently trying to migrate to R. This was probably was done for the convenience of end-users who are not very experienced in theoretical statistics. I am aware that the same result could be produced using the standard anova() function with Type I sequential SS, supplemented by drop1() function, but this approach will look quite complicated for persons without any substantial background in statistics, like no-math students. I would prefer easier way, possibly more universal, though also probably more for dummies :) If am not mistaken, car package by John Fox with his nice Anova() function is the reasonable alternative for any, who wish to simply perform quick statistical analysis, without afraid to mess something with model fitting. Of course orthogonal contrasts have to be specified (for example contr.sum) in case of Type III SS. Therefore, I would like to reformulate my questions, to make it easier for you to answer: 1. The first question related to answer by Professor Brian Ripley: Did I understood correctly from the advised paper (Bill Venables' 'exegeses' paper) that there is not much sense to test main effects if the interaction is significant? 2. If I understood the post by John Fox correctly, I could safely use Anova(.,type=III) function from car for ANOVA analyses in R, both for balanced and unbalanced designs? Of course providing the model was fitted with orthogonal contrasts. Something like below: mod - aov(response ~ factor1 * factor2, data=mydata, contrasts=list(factor1=contr.sum, factor2=contr.sum)) Anova(mod, type=III) It was also said in most of your posts that the decision of which of Type of SS to use has to be done on the basis of the hypothesis we want to test. Therefore, let's assume that I would like to test the significance of both factors, and if some of them significant, I plan to use post-hoc tests to explore difference(s) between levels of this significant factor(s). Thank you in advance, Amasco On 8/27/06, John Fox [EMAIL PROTECTED] wrote: Dear Amasco, A complete explanation of the issues that you raise is awkward in an email, so I'll address your questions briefly. Section 8.2 of my text, Applied Regression Analysis, Linear Models, and Related Methods (Sage, 1997) has a detailed discussion. (1) In balanced designs, so-called Type I, II, and III sums of squares are identical. If the STATA manual says that Type II tests are only appropriate in balanced designs, then that doesn't make a whole lot of sense (unless one believes that Type-II tests are nonsense, which is not the case). (2) One should concentrate not directly on different types of sums of squares, but on the hypotheses to be tested. Sums of squares and F-tests should follow from the hypotheses. Type-II and Type-III tests (if the latter are properly formulated) test hypotheses that are reasonably construed as tests of main effects and interactions in unbalanced designs. In unbalanced designs, Type-I sums of squares usually test hypotheses of interest only by accident. (3) Type-II sums of squares are constructed obeying the principle of marginality, so the kinds of contrasts employed to represent factors are irrelevant to the sums of squares produced.
Re: [R] screen resolution effects on graphics
In thinking about this some more Romain's idea of using the browser to get this information can be done like this. This solution only works with Internet Explorer: library(RDCOMClient) ie - COMCreate(InternetExplorer.Application) ie$Navigate(about:blank) width - ie[[document]][[ParentWindow]][[screen]][[width]] height - ie[[document]][[ParentWindow]][[screen]][[height]] ie$Quit() On 8/28/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: I think there are problems with browseURL on Windows XP with IE. Put the file in screen.htm and then run: shell.exec(screen.htm) it will come up -- it will block it and you will have to click to unblock it; however, that will interfere with any automatic procedure. On 8/28/06, Charles Annis, P.E. [EMAIL PROTECTED] wrote: Romain: a - tempfile() cat('htmlscript type=text/javascript document.write(screen.width) ; /script/html', file=a) browseURL(a) The object a was created, but no browser opened. ls() [1] a a [1] C:\\DOCUME~1\\CHARLE~1\\LOCALS~1\\Temp\\RtmpRgWrqb\\file678418be Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Romain Francois Sent: Monday, August 28, 2006 2:30 PM To: Prof Brian Ripley Cc: Charles Annis, P.E.; r-help@stat.math.ethz.ch Subject: Re: [R] screen resolution effects on graphics Prof Brian Ripley a écrit : On Mon, 28 Aug 2006, Charles Annis, P.E. wrote: Greetings, R-Citizens: I have the good fortune of working with a 19 1280 X 1024 pixel monitor. My (Similar to our student lab has used for many years.) R-code produces nice-looking graphics on this machine but the same code results in crowded plots on an older machine with 800 X 600 resolution. In hindsight this seems obvious, but I didn't anticipate it. It is not obvious to me: I have never experienced it. What OS and graphics device is this? Almost all of R's graphics is independent of the screen resolution (the exception being the bitmapped devices such as jpeg), with things sized in inches or points. My machines are 1600x1200 (apart from 1280x800 on my laptop), so I meet a considerable reduction when using a computer projector, and my plots do not look crowded. However, one issue is when the OS has a seriously incorrect setting for the screen resolution and so does not give the sizes asked for by R. We have seen that on both Linux and Windows, and the windows() device has arguments to set the correct values. (On X11 you should be able to set this in Xconfig files.) If this is Windows, check carefully the description of the initial screen size in ?windows. That can have unexpected effects on physically small screens. At one time the X11() device was set up to assume 75dpi unless the reported resolution was 100+/-0.5dpi. My then monitor reported 99.2 dpi and so things came out at 3/4 of the intended size. We fixed that quite a while back. My code will be used on machines with varying graphics (and memory) capacity. Is there a way I can check the native resolution of the machine so that I can make adjustments to my code for the possible limitations of the machine running it? Only via C code, which is how R does it. Hi, Javascript knows, can we ask him ? I mean, if I do that in R : a - tempfile() cat('htmlscript type=text/javascript document.write(screen.width) ; /script/html', file=a) browseURL(a) I get 1920 in my browser's window. Can R read it ? Romain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove empty list from list - remove only one row and make as matrix
try the following: # a dff[sapply(dff, is.matrix)] # b lapply(dff, function(x) if(!is.matrix(x)) rbind(x) else x) 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/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Muhammad Subianto [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, August 29, 2006 1:22 PM Subject: Re: [R] Remove empty list from list - remove only one row and make as matrix Dear all, After I work around, I found in my list of data with only one row which need to remove or make it as matrix. Here I write again my other toy example: x - list(matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4)) y - list(c(1, -1, -1, 1, 1),c(1, -1, -1, -1, -1),c(1, 1, 1, 1, 1),c(1, 1, -1, 1, -1),c(-1, -1, -1, -1, -1)) ## Thanks to Gabor Grothendieck for this trick. ## SIMPLIFY? SIMPLIFY simplify xy.list - mapply(cbind, x, y, SIMPLIFY=FALSE) point.class - t(cbind(c(10,20,15,4,-1),c(21,10,15,34,-1),c(11,13,6,3,1),c(7,5,5,2,1),c(8,9,5,12,-1))) class.diffsame - points.neighb(as.matrix(point.class), xy.list, 5) pd.class - points.diff(class.diffsame,xy.list) nc.test - vector(list,length(pd.class)) for (i in 1:length(pd.class)) { nc.test[[i]] - pd.class[[i]]$point.diff } nc.test # delete null/empty entries in a list dff - delete.NULLs(nc.test) dff; str(dff) dff [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [1] 1 6 11 16 1 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 lapply(dff, nrow) lapply(dff, nrow) [[1]] [1] 3 [[2]] NULL [[3]] [1] 2 #I can use #dff[unlist(lapply(dff, nrow) == 1)] #2,3, etc I have two questions here: a. I need to remove dff[[2]] b. How to make it as matrix (in list). I mean the result something like [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [,1] [,2] [,3] [,4] [,5] [1]1611 161 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 Best, Muhammad Subianto points.neighb - function(p.class, list.nc, class.col) { ntuples - nrow(p.class) instvec - vector(list,length=ntuples) for (i in 1:ntuples) { # Thanks to Petr Pikal for this trick instvec[[i]]$class.diff - (p.class[i,class.col] - list.nc[[i]][,class.col])!=0 instvec[[i]]$class.same - (p.class[i,class.col] - list.nc[[i]][,class.col])==0 } instvec } points.diff - function(p.class, list.nc) { ntuples - length(list.nc) instvec - vector(list,ntuples) for (i in 1:ntuples) { instvec[[i]]$point.diff - list.nc[[i]][p.class[[i]]$class.diff,] instvec[[i]]$point.same - list.nc[[i]][p.class[[i]]$class.same,] } instvec } # Thanks to Jim Holtman for this trick delete.NULLs - function(x.list){ x.list[unlist(lapply(x.list, length) != 0)] } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] EOF and CCA analysis
More than 10,000 locations but how many variables? Like all computer programs there are limitations, but they are largely imposed by your environment, so what OS and how much RAM do you have? On Tue, 29 Aug 2006, isidora k wrote: Hello! I would like to do Empirical Orthogonal functions and Canonical correlation analysis on satellite data. My matrices are going to be very big (more than 10,000 locations). Are there limitations in R regarding the size of the matrix? thanks a lot regards Isidora __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove empty list from list - remove only one row and make as matrix
Dear all, Dimitris, thanks for your great help and quick response. Best, Muhammad Subianto dff[sapply(dff, is.matrix)] [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 lapply(dff, function(x) if(!is.matrix(x)) rbind(x) else x) [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [,1] [,2] [,3] [,4] [,5] x16 11 161 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 On this day 29/08/2006 13:34, Dimitris Rizopoulos wrote: try the following: # a dff[sapply(dff, is.matrix)] # b lapply(dff, function(x) if(!is.matrix(x)) rbind(x) else x) 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/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Muhammad Subianto [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Tuesday, August 29, 2006 1:22 PM Subject: Re: [R] Remove empty list from list - remove only one row and make as matrix Dear all, After I work around, I found in my list of data with only one row which need to remove or make it as matrix. Here I write again my other toy example: x - list(matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4),matrix(1:20, 5, 4)) y - list(c(1, -1, -1, 1, 1),c(1, -1, -1, -1, -1),c(1, 1, 1, 1, 1),c(1, 1, -1, 1, -1),c(-1, -1, -1, -1, -1)) ## Thanks to Gabor Grothendieck for this trick. ## SIMPLIFY? SIMPLIFY simplify xy.list - mapply(cbind, x, y, SIMPLIFY=FALSE) point.class - t(cbind(c(10,20,15,4,-1),c(21,10,15,34,-1),c(11,13,6,3,1),c(7,5,5,2,1),c(8,9,5,12,-1))) class.diffsame - points.neighb(as.matrix(point.class), xy.list, 5) pd.class - points.diff(class.diffsame,xy.list) nc.test - vector(list,length(pd.class)) for (i in 1:length(pd.class)) { nc.test[[i]] - pd.class[[i]]$point.diff } nc.test # delete null/empty entries in a list dff - delete.NULLs(nc.test) dff; str(dff) dff [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [1] 1 6 11 16 1 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 lapply(dff, nrow) lapply(dff, nrow) [[1]] [1] 3 [[2]] NULL [[3]] [1] 2 #I can use #dff[unlist(lapply(dff, nrow) == 1)] #2,3, etc I have two questions here: a. I need to remove dff[[2]] b. How to make it as matrix (in list). I mean the result something like [[1]] [,1] [,2] [,3] [,4] [,5] [1,]16 11 161 [2,]49 14 191 [3,]5 10 15 201 [[2]] [,1] [,2] [,3] [,4] [,5] [1]1611 161 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]38 13 18 -1 [2,]5 10 15 20 -1 Best, Muhammad Subianto points.neighb - function(p.class, list.nc, class.col) { ntuples - nrow(p.class) instvec - vector(list,length=ntuples) for (i in 1:ntuples) { # Thanks to Petr Pikal for this trick instvec[[i]]$class.diff - (p.class[i,class.col] - list.nc[[i]][,class.col])!=0 instvec[[i]]$class.same - (p.class[i,class.col] - list.nc[[i]][,class.col])==0 } instvec } points.diff - function(p.class, list.nc) { ntuples - length(list.nc) instvec - vector(list,ntuples) for (i in 1:ntuples) { instvec[[i]]$point.diff - list.nc[[i]][p.class[[i]]$class.diff,] instvec[[i]]$point.same - list.nc[[i]][p.class[[i]]$class.same,] } instvec } # Thanks to Jim Holtman for this trick delete.NULLs - function(x.list){ x.list[unlist(lapply(x.list, length) != 0)] } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] EOF and CCA analysis
I have got windows and 1Gb ram. my matrices are monthly data for 10 years for sometimes more than 10,000 locations. I am going to perform the EOF on one variable at a time and then the CCA on the principal components that I will get from EOF. Do you think I could do that in R?I could also find a macintosh I could work with or get more RAM if you think this will cause problems, but I am more concerned with the software limitations if any! thank you so much for your help. Kind Regards Isidora __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] MODWT exceeds sample size
Hello, I get the following message when I try to load a time series of 128 stock returns. Error in modwt(stock, wf = la8, n.levels = 8, boundary = periodic) : wavelet transform exceeds sample size in modwt I thought that MODWT had no restrictions on the sample size? Any help? -- View this message in context: http://www.nabble.com/MODWT-exceeds-sample-size-tf2183217.html#a6037934 Sent from the R help forum at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] EOF and CCA analysis
That's a 10,000 x 120 matrix, if I understand you right. That is quite modest. The key issue is to be able to do an SVD: A - matrix(rnorm(1e4*120), 1e4, 120) dim(A) [1] 1 120 system.time(svd(A)) [1] 2.79 0.13 2.93 NA NA on a similar machine to yours, using 50Mb. It would be worth considering downloading a suitable ATLAS-based Rblas.dll if you are doing much of this. On Tue, 29 Aug 2006, isidora k wrote: I have got windows and 1Gb ram. my matrices are monthly data for 10 years for sometimes more than 10,000 locations. I am going to perform the EOF on one variable at a time and then the CCA on the principal components that I will get from EOF. Do you think I could do that in R?I could also find a macintosh I could work with or get more RAM if you think this will cause problems, but I am more concerned with the software limitations if any! thank you so much for your help. Kind Regards Isidora __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] AffyChip Background Analysis
Gunther Höning [EMAIL PROTECTED] writes: Dear list, I want to analyse some HG133Plus2.0 Affymetrix chips. The first thing I intent to do, is just to perform a background correction (mas, rma, gcrma,...) with the cel files. Then I want to take a look at the files. How can I do this ? You might want to take a look at some of the packages in the Bioconductor project. Here is a link to the BioC packages that deal with visualization: http://www.bioconductor.org/packages/release/Visualization.html + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] First elements of a list.
Suppose I have the following list: a - strsplit(c(John;Smith, Jane;Doe, koda, gunner), ;) I want to get to these two vectors without looping... firstNames:c(John, Jane, koda, gunner) lastNames:c(Jane, Doe, NA, NA) Thanks cn [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] First elements of a list.
sapply(a, [, 1) [1] John Jane koda gunner sapply(a, [, 2) [1] Smith Doe NA NA --- Jacques VESLOT CNRS UMR 8090 I.B.L (2ème étage) 1 rue du Professeur Calmette B.P. 245 59019 Lille Cedex Tel : 33 (0)3.20.87.10.44 Fax : 33 (0)3.20.87.10.31 http://www-good.ibl.fr --- cory a écrit : Suppose I have the following list: a - strsplit(c(John;Smith, Jane;Doe, koda, gunner), ;) I want to get to these two vectors without looping... firstNames:c(John, Jane, koda, gunner) lastNames:c(Jane, Doe, NA, NA) Thanks cn [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] symbols in coplots
Kind folks, I have a data frame of mean values for 14 levels and 5 factors. I'd like to use a coplot to illustrate how the mean values change. Can anyone provide an example of how I can specify different ploting symbols in this plot. I'd like to use either use a five different colors (col) for the plotting symbol repeatedly in each of 14 panels, or 14 different symbols (pch) for the different levels. Either approach will work Thank you. -- Steve [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Bioconductor installation errors
Hello, I follow the Bioconductor instruction (http://www.bioconductor.org/download http://www.bioconductor.org/download ) to install Biocoductor, there have some errors: /usr/lib/R/bin/SHLIB: line 115: make: command not found chmod: cannot access `/usr/local/lib/R/site-library/affyio/libs/*': No such file or directory ERROR: compilation failed for package 'affyio' ** Removing '/usr/local/lib/R/site-library/affyio' * Installing *source* package 'survival' ... ** libs /usr/lib/R/bin/SHLIB: line 115: make: command not found ERROR: compilation failed for package 'survival' ** Removing '/usr/local/lib/R/site-library/survival' * Installing *source* package 'KernSmooth' ... ** libs /usr/lib/R/bin/SHLIB: line 115: make: command not found ERROR: compilation failed for package 'KernSmooth' ** Removing '/usr/local/lib/R/site-library/KernSmooth' * Installing *source* package 'RColorBrewer' ... ** R ** inst ** preparing package for lazy loading ** help Building/Updating help pages for package 'RColorBrewer' Formats: text html latex example ColorBrewer texthtmllatex example ** building package indices ... * DONE (RColorBrewer) * Installing *source* package 'Biobase' ... ** libs /usr/lib/R/bin/SHLIB: line 115: make: command not found ERROR: compilation failed for package 'Biobase' ** Removing '/usr/local/lib/R/site-library/Biobase' * Installing *source* package 'Biostrings' ... ** libs /usr/lib/R/bin/SHLIB: line 115: make: command not found ERROR: compilation failed for package 'Biostrings' ** Removing '/usr/local/lib/R/site-library/Biostrings' .. .. Could you give me some advice about how to fix the errors? Thanks. Weigong Ge [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Bioconductor installation errors
Ge, Weigong* [EMAIL PROTECTED] writes: Hello, I follow the Bioconductor instruction (http://www.bioconductor.org/download http://www.bioconductor.org/download ) to install Biocoductor, there have some errors: Please post questions about Bioconductor to the bioconductor mailing list: http://www.bioconductor.org/docs/mailList.html /usr/lib/R/bin/SHLIB: line 115: make: command not found Your system (Linux?) is missing very basic development tools. It seems you have no make program installed. Such a program, among many others, is required to build R packages from source. Try to install system packages for software development (C complier, etc). + seth __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Bioconductor installation errors
Hi, You don't say, but the errors make me think you are using Linux. (Please specify your OS when you have problems). It sounds like you are missing some of the Essential programs under Unix - they really are essential. I think you need to reread the R admin manual, as instructed on the bioconductor download page http://cran.r-project.org/doc/manuals/R-admin.html and in particular this part: http://cran.r-project.org/doc/manuals/R-admin.html#Essential-and-useful-other-programs-under-Unix Sarah On 8/29/06, Ge, Weigong* [EMAIL PROTECTED] wrote: Hello, I follow the Bioconductor instruction (http://www.bioconductor.org/download http://www.bioconductor.org/download ) to install Biocoductor, there have some errors: /usr/lib/R/bin/SHLIB: line 115: make: command not found -- Sarah Goslee http://www.stringpage.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] spectral clustering
Is there a function in R that does spectral clustering? Thanks ../Murli [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] spectral clustering
Nair, Murlidharan T a écrit : Is there a function in R that does spectral clustering? Thanks ../Murli ** PLEASE do read the posting guide http://www.R-project.org/posting-guide.html ** Hi, You would get a faster answer asking to RSiteSearch rather than this list. Romain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] passing namees
R 2.3.1 I wrote a little script to do some cross correlations. The symbols are in a text file like so: symbols.txt ibm dd csco require(tseries) symbols - scan(symbols.txt, what = 'character') for(line in 1:(length(symbols)-1)) { assign(symbols[line], get.hist.quote(instrument = symbols[line], start = 2005-09-01, quote = Close)) } # this results in objects ibm, dd... with the last symbol skipped mat - cbind(symbols) # this is the problem (cor_mat - cor(mat)) symnum(cor_mat) How can I pass a list of the objects to cbind()? As written cbind gets only the names of the objects and binds the names not the objects. Thanks in advance, jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to contrast with factorial experiment
Hello, R experts, If I understand Ted's anwser correctly, then I can not contrast the mean yields between sections 1-8 and 9-11 under Trt but I can contrast mean yields for sections 1-3 and 6-11 because there exists significant interaction between two factors (Trt:section4, Trt:section5). Could I use the commands below to test the difference between sections 1-3 and 6-11 ? contrasts(section)-c(-2,-2,-2,0,0,1,1,1,1,1,1) newobj-lm(log2(yield)~treat*section) How can I infer that there is significant difference between sections 1-3 and sections 6-11 for the Trt from the output below? summary(newobj) Call: lm(formula = log2(yield) ~ treat * section) Residuals: Min 1Q Median 3Q Max -0.49647 -0.14913 -0.01521 0.17471 0.51105 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 6.288400.05003 125.682 2e-16 *** treatTrt1.221220.07076 17.259 2e-16 *** section10.178310.03911 4.559 4.08e-05 *** section2 -0.231020.16595 -1.392 0.17087 section32.381700.16595 14.352 2e-16 *** section43.368340.16595 20.298 2e-16 *** section5 -1.568730.16595 -9.453 3.67e-12 *** section6 -0.415220.16595 -2.502 0.01613 * section7 -0.899430.16595 -5.420 2.38e-06 *** section80.095220.16595 0.574 0.56901 section9 -0.787840.16595 -4.748 2.21e-05 *** section10 0.748210.16595 4.509 4.79e-05 *** treatTrt:section1 0.101010.05532 1.826 0.07461 . treatTrt:section2 0.272700.23468 1.162 0.25151 treatTrt:section3 -1.222100.23468 -5.207 4.85e-06 *** treatTrt:section4 -1.391870.23468 -5.931 4.26e-07 *** treatTrt:section5 -0.761370.23468 -3.244 0.00225 ** treatTrt:section6 0.073200.23468 0.312 0.75658 treatTrt:section7 0.331080.23468 1.411 0.16535 treatTrt:section8 -0.136860.23468 -0.583 0.56276 treatTrt:section9 0.220860.23468 0.941 0.35180 treatTrt:section10 -0.144760.23468 -0.617 0.54054 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.2874 on 44 degrees of freedom Multiple R-Squared: 0.973, Adjusted R-squared: 0.9601 F-statistic: 75.55 on 21 and 44 DF, p-value: 2.2e-16 Joshua Quoting (Ted Harding) [EMAIL PROTECTED]: On 24-Aug-06 [EMAIL PROTECTED] wrote: Hello, R users, I have two factors (treat, section) anova design experiment where there are 3 replicates. The objective of the experiment is to test if there is significant difference of yield between top (section 9 to 11) and bottom (section 9 to 11) [I think you mean sections 1 to 8] of the fruit tree under treatment. I found that there are interaction between two factors. I wonder if I can contrast means from levels of one factor (section) under another factor (treat)? if so, how to do it in R and how to interpret the output? I think you would be well advised to look at a plot of the data. For example, let Y stand for yield, R for replicate, T for treat and S for section. ix-(T==Trt);plot(S[ix],Y[ix],col=red,ylim=c(0,1000)) ix-(T==Ctl);points(S[ix],Y[ix],col=blue) From this it is clear that sections 4 and 5 are in a class of their own. Also, in sections 1-3 and 6-11 the Ctl yields are not only lower, but have smaller (in some cases hardly any) variance, compared with the Trt yields. The variances for sections 7,8,9,10,11 are greater than for 1,2,3,6 without great change in mean value. While there is an evident difference between Trt yields and Ctrl yields for sections 1-3 and 6-11, this is not so for sections 4 and 5. This sort of behaviour no doubt provides some reasons for the interaction you observed. You seem to have a quite complex phenomenon here! To some extent the problems with variance can be diminished by working with logarithms. Compare the previous plot with ix-(T==Trt);plot(S[ix],log10(Y[ix]),col=red,ylim=c(0,3)) ix-(T==Ctl);points(S[ix],log10(Y[ix]),col=blue) (you have used log2() in your commands). The above observations can be seen reflected in R if you look at the output of summary(obj) where in particular: treatTrt:section2 -1.116910.33189 -3.365 0.001595 ** treatTrt:section3 -0.456340.33189 -1.375 0.176099 treatTrt:section4 -1.566270.33189 -4.719 2.42e-05 *** treatTrt:section5 -1.736040.33189 -5.231 4.48e-06 *** treatTrt:section6 -0.913110.33189 -2.751 0.008588 ** treatTrt:section7 -0.078530.33189 -0.237 0.814055 treatTrt:section8 0.179350.33189 0.540 0.591654 treatTrt:section9 -0.288590.33189 -0.870 0.389277 treatTrt:section10 0.069130.33189 0.208 0.835972 treatTrt:section11 -0.296490.33189 -0.893 0.376543 which, precisely, contrasts means from levels of one factor (section) under another factor (treat), and shows that most of the interaction arises
[R] [R-pkgs] The rpanel package
The rpanel package builds on the tcltk package to provide simple interactive controls for R functions, in particular to provide simple forms of dynamic graphics. The intention is to make this form of control particularly easy for R users to implement, with full documentation. The necessary tcltk variables are managed behind the scenes so that users need not be concerned with any technicalities. A descriptive paper and some simple example scripts are available at www.stats.gla.ac.uk/~adrian/rpanel/ The package is now available from CRAN. Best wishes, Adrian Bowman (on behalf of the authors: Bowman, Crawford, Alexander Bowman) ___ Prof. Adrian Bowman Tel: +44-141-330-4046 Dept. of Statistics Fax: +44-141-330-4814 The University of Glasgow E-mail:[EMAIL PROTECTED] Glasgow G12 8QQ, U.K. Web: www.stats.gla.ac.uk/~adrian ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] passing namees
Put the data into a list, not into individual variables. Something like this (untested): L - sapply(symbols[-length(symbols)], get.hist.quote, start = 2005-01-09, quote = Close, simplify = FALSE) mat - do.call(cbind, L) cor.mat - cor(mat, use = complete) symnum(cor.mat) On 8/29/06, BBands [EMAIL PROTECTED] wrote: R 2.3.1 I wrote a little script to do some cross correlations. The symbols are in a text file like so: symbols.txt ibm dd csco require(tseries) symbols - scan(symbols.txt, what = 'character') for(line in 1:(length(symbols)-1)) { assign(symbols[line], get.hist.quote(instrument = symbols[line], start = 2005-09-01, quote = Close)) } # this results in objects ibm, dd... with the last symbol skipped mat - cbind(symbols) # this is the problem (cor_mat - cor(mat)) symnum(cor_mat) How can I pass a list of the objects to cbind()? As written cbind gets only the names of the objects and binds the names not the objects. Thanks in advance, jab -- John Bollinger, CFA, CMT www.BollingerBands.com If you advance far enough, you arrive at the beginning. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Write signed short into a binary file (follow up and conclusion)(for real)
Somebody pointed me to the right spot in the documentation, and kindly and humorously 'suggested' to me to do the following: My Apologies, everybody! I should have read docs a bit better, actually... ...will do better next time! luca - Original Message - From: [EMAIL PROTECTED] To: Sent: Monday, August 28, 2006 4:52 PM Subject: Write signed short into a binary file (follow up and conclusion) I've solved my problem using: (purpose: write the signed integer -19 as a two byte integer into a binary file) writeBin(as.integer(-19),myconnection, size=2) There is no need to coerce. Thanks anyway! Luca NanettiUniversity Medical Center Groningen BCN-NeuroImagingCenter A.Deusinglaan 2 9713AW Groningen The Nethterlands l dot nanetti at med dot rug dot nl __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] forestplot fucntion in rmeta package
Dear R users, I would like to adjust the x axis the way I wanted using forestplot(labeltext, mean, lower, upper, align = NULL, xlab = , zero = 0, graphwidth = unit(2, inches), col = meta.colors(), xlog = FALSE). I tried using xaxt=n and then redefine the axis using axis(1, at=c(0,0.5,1.0 ,1.5,2.0,2.5),label=c(0,0.5,1.0,1.5,2.0,2.5)), but it doesn't work at all. Seems the forestplot function itself does not allow some basic plot option like xaxt=n? Anybody porvides some hints to solve this problem? Many thanks! Shirley [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dendrogram troubles
Hi, I am making a dendrogram with 180 terminal values. Whether I keep it horizontal or vertical, it gives a 'squished' graph that refuses to be stretched beyond the window size and I cannot read the labels. (I'm using hclust and then plot to make the tree.) Is there a way to stretch the graph in R, or by exporting it somehow, so that I can read the 180 values and see what the results are? Please help. Thank you very much. -DS. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Key() and par(mfrow)
Hi Folks, I want to use key() to position the legend on top of the page in the following example. Prefer not to use locator() par(mfrow = c(2,2)) plot(1:4, title=Plot Number1) plot(rnorm(10), title=Plot Number2) plot(1:10, title=Plot Number3) key(x,y, text=list(c(Alpha,Beta)), text=list(c(1,2))) x,y should indicate the position of the legend which is top left of the page. The lists here are oversimplified but we have to use key(). Thank you for your help! _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lattice/xyplot: plotting 4 variables in two panels - can this be done?
Hi, I would like to create a plot of y1,y2,y3,y4 against x for several subjects such that y1 and y2 are plotted against x in one panel and y3 and y4 against x in another panel. Thus if there are 3 subjects I should end up with 6 panels. Is there a simple way of doing so (i.e. without calling xyplot() several times, and then padding the results together)?? Regards Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] subset by two variables
I'm using this syntax to create data subsets for plots: subset=source==Both. Now I would like to create a subset defined by two different variables like this: subset=source==Both subset=site==home but this syntax is not correct. The documents in the manual for subset seem to be creating whole new data files not just selecting rows based on the contents of the variables. How do I subset based on two variables. -- Dean Sonneborn, MS Programmer Analyst Department of Public Health Sciences University of California, Davis (530) 754-9516 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lattice and several groups
Dear R-list, I would like to use the lattice library to show several groups on the same graph. Here's my example : ## the data f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3)) f1 - rep(f1,3) f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3)) df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2) # library(lattice) para.liste - trellis.par.get() superpose.symbol - para.liste$superpose.symbol superpose.symbol$pch - c(1,2,3) trellis.par.set(superpose.symbol,superpose.symbol) # Now I can see the group according to the f1 factor (with a different symbol for every modality) xyplot( val~x, data=df, group=f1, auto.key=list(space=right) ) # or I can see the group according to the f2 factor xyplot( val~x, data=df, type=l, group=f2, auto.key=list(space=right,points=FALSE,lines=TRUE) ) How can I do to highlight both the f1 and f2 factors on one panel with the legends, using the lattice function ? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Producing R demos
Hello! I have found terrific demo or R package functionality at http://had.co.nz/reshape/french-fries-demo.html Author has told me off-list that he is using SnapzProX (on mac), and ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing. Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how such a demo (video + automated typing of a script) could be produced under either Windows or Linux OS? I would like to create such a demo for presentation as I will not be able to install R on the machine, but I could play a movie. Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] my email: jonathan gheyssens (université de Montreal)
Jonathan Gheyssens M.Sc Economie Appliquée IEA - HEC Montréal [EMAIL PROTECTED] 514-581-8009 514-678-5231 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice and several groups
I would like to use the lattice library to show several groups on the same graph. Here's my example : ## the data f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3)) f1 - rep(f1,3) f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3)) df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2) It's pretty easy to do this with ggplot: install.packages(ggplot, repos=http://ggobi.org/r/;) library(ggplot) qplot(x, val, data=df, shape=f2, colour=f1) Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Substring and strsplit
Dear R People: I am trying to split a character vector into a set of individual letters: Ideal: x3 - c(dog) d o g I tried the following: strsplit(x3) Error in strsplit(x3) : argument split is missing, with no default strsplit(x3,1) [[1]] [1] dog I know that this is incredibly simple, but what am I doing wrong? Either Windows or Linux 2.3.1 Thanks in advance! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Substring and strsplit
On Tue, 29 Aug 2006, Erin Hodgess wrote: Dear R People: I am trying to split a character vector into a set of individual letters: Ideal: x3 - c(dog) d o g I tried the following: strsplit(x3) Error in strsplit(x3) : argument split is missing, with no default strsplit(x3,1) [[1]] [1] dog I know that this is incredibly simple, but what am I doing wrong? This is the first example on the help page for strsplit. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Substring and strsplit
Use '' as parameter to strsplit x3 - 'dog' strsplit(x3, '') [[1]] [1] d o g On 8/29/06, Erin Hodgess [EMAIL PROTECTED] wrote: Dear R People: I am trying to split a character vector into a set of individual letters: Ideal: x3 - c(dog) d o g I tried the following: strsplit(x3) Error in strsplit(x3) : argument split is missing, with no default strsplit(x3,1) [[1]] [1] dog I know that this is incredibly simple, but what am I doing wrong? Either Windows or Linux 2.3.1 Thanks in advance! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice/xyplot: plotting 4 variables in two panels - can this be done?
On 8/29/06, Søren Højsgaard [EMAIL PROTECTED] wrote: Hi, I would like to create a plot of y1,y2,y3,y4 against x for several subjects such that y1 and y2 are plotted against x in one panel and y3 and y4 against x in another panel. Thus if there are 3 subjects I should end up with 6 panels. Is there a simple way of doing so (i.e. without calling xyplot() several times, and then padding the results together)?? You need to transform your data into a suitable form. See ?reshape and ?make.groups. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Handling realisations in geoRglm
Dear R users: I want to model mosquito count data based on landcover attributes and meteorological variables using a Poisson GLSM in the geoRglm package. I have monthly mosquito counts over more than 20 years with repeated observations from individual trap sites over time. I have used as.geodata() to successfully read my dataset into the geodata format utilized by geoR and geoRglm, including specification of the realisations. (I know the realisations have been specified correctly because I can get data summaries by realisation from the geodata object.) However, after reading the packages' documentation and searching the mailing lists and other sources, it seems that the functions in geoRglm do not acknowledge the existence of multiple realisations per site. I see that the likfit() function in geoR has an argument for realisations, but I cannot find anything similar in geoRglm. Is it possible to model data with repeated realisations from the same sites using geoRglm? If so, how can this be done and is there a way to model dependence among the realisations over time? Thank you, Chris Barker Ph.D. Candidate University of California, Davis [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help on apply() function
Respected Sir/Madam, I have a problem with apply function. I have to two matrices of dimension of one column but n rows. I have to check whether one matrix is greater than other by going thru each row (ie) using if condition to check one matrix with another matrix. I like to use apply() function to this approach. That is apply function between two matrices. I searched for examples online but I couldn't find any. I don't know how to loop thru the matrices. Please help with this problem. Any help is appreciated. My mailid is [EMAIL PROTECTED] Thanks, Anusha. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice and several groups
Try this: xyplot(val ~ x, data = df, type = p, col = as.numeric(df$f1), pch = as.numeric(df$f2)) key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)), points = list(pch = 1:nlevels(df$f1)) ) key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)), points = list(pch = 20, col = 1:nlevels(df$f2)) ) trellis.focus(panel, 1, 1) draw.key(key1, draw = TRUE, vp = viewport(.9, .9)) draw.key(key2, draw = TRUE, vp = viewport(.75, .9)) trellis.unfocus() On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote: Dear R-list, I would like to use the lattice library to show several groups on the same graph. Here's my example : ## the data f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3)) f1 - rep(f1,3) f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3)) df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2) # library(lattice) para.liste - trellis.par.get() superpose.symbol - para.liste$superpose.symbol superpose.symbol$pch - c(1,2,3) trellis.par.set(superpose.symbol,superpose.symbol) # Now I can see the group according to the f1 factor (with a different symbol for every modality) xyplot( val~x, data=df, group=f1, auto.key=list(space=right) ) # or I can see the group according to the f2 factor xyplot( val~x, data=df, type=l, group=f2, auto.key=list(space=right,points=FALSE,lines=TRUE) ) How can I do to highlight both the f1 and f2 factors on one panel with the legends, using the lattice function ? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Producing R demos
I have not used this but wink is a free demo-maker for Windows available at: http://www.debugmode.com/wink/ Click the red on green arrow on that page to a (very short) demo. On 8/29/06, Gregor Gorjanc [EMAIL PROTECTED] wrote: Hello! I have found terrific demo or R package functionality at http://had.co.nz/reshape/french-fries-demo.html Author has told me off-list that he is using SnapzProX (on mac), and ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing. Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how such a demo (video + automated typing of a script) could be produced under either Windows or Linux OS? I would like to create such a demo for presentation as I will not be able to install R on the machine, but I could play a movie. Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Producing R demos
Gabor Grothendieck wrote: I have not used this but wink is a free demo-maker for Windows available at: http://www.debugmode.com/wink/ Click the red on green arrow on that page to a (very short) demo. Thanks! Do you perhaps also know equivalent of ghostwriter (link is bellow) for windows/linux? On 8/29/06, Gregor Gorjanc [EMAIL PROTECTED] wrote: Hello! I have found terrific demo or R package functionality at http://had.co.nz/reshape/french-fries-demo.html Author has told me off-list that he is using SnapzProX (on mac), and ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing. Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how such a demo (video + automated typing of a script) could be produced under either Windows or Linux OS? I would like to create such a demo for presentation as I will not be able to install R on the machine, but I could play a movie. Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] C compile problem on Ubuntu linux
On 20 August 2006 at 15:29, Frank E Harrell Jr wrote: | Manuel Castejón Limas wrote: | Hello, | I've just compiled Hmisc ok under dapper. | I think you need to further install some packages. | Have you installed libc6-dev? | I would start installing the build-essential package. | Best wishes | Manuel | | Thanks Manuel, apt-get install build-essential solved the problem. FWIW r-base-dev also depends on build-essential, so problem-solving tip number one (if on Debian and building things for R, install r-base-dev) still applies. Cheers, Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Producing R demos
Don't know. I would check whether the functionality is included in wink. On 8/29/06, Gregor Gorjanc [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: I have not used this but wink is a free demo-maker for Windows available at: http://www.debugmode.com/wink/ Click the red on green arrow on that page to a (very short) demo. Thanks! Do you perhaps also know equivalent of ghostwriter (link is bellow) for windows/linux? On 8/29/06, Gregor Gorjanc [EMAIL PROTECTED] wrote: Hello! I have found terrific demo or R package functionality at http://had.co.nz/reshape/french-fries-demo.html Author has told me off-list that he is using SnapzProX (on mac), and ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing. Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how such a demo (video + automated typing of a script) could be produced under either Windows or Linux OS? I would like to create such a demo for presentation as I will not be able to install R on the machine, but I could play a movie. Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem in install on ubuntu
On 24 August 2006 at 11:35, Ryan Austin wrote: | Hi Bruno, | | Your missing the Basic Linear Algebra Subroutines 3.0 package. | | apt-get install refblas3 | | should fix the problem. (At least in Debian, should be the same for Ubuntu) The 'empty' package r-base-dev depends on 'refblas3-dev | atlas3-base-dev' so installing r-base-dev on Debian or Ubuntu provides what most if not all packages require. Hth, Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice/xyplot: plotting 4 variables in two panels - can this be done?
Try xyplot.zoo in the zoo package (be sure you have the latest zoo version). One caveat is that xyplot.zoo is under development and could change. Here we use the builtin data set anscombe as an example: # display the anscombe data set anscombe library(lattice) library(zoo) # create zoo object using column 1 as x/times and columns 5:8 as the y's z - zoo(data.matrix(anscombe[,5:8]), anscombe[,1]) xyplot(z, screens = c(1, 1, 2, 2), col = 1:4, pch = 1:4, type = b) On 8/29/06, Søren Højsgaard [EMAIL PROTECTED] wrote: Hi, I would like to create a plot of y1,y2,y3,y4 against x for several subjects such that y1 and y2 are plotted against x in one panel and y3 and y4 against x in another panel. Thus if there are 3 subjects I should end up with 6 panels. Is there a simple way of doing so (i.e. without calling xyplot() several times, and then padding the results together)?? Regards Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice and several groups
Note that before entering this you need: library(lattice) library(grid) # to access the viewport function On 8/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: xyplot(val ~ x, data = df, type = p, col = as.numeric(df$f1), pch = as.numeric(df$f2)) key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)), points = list(pch = 1:nlevels(df$f1)) ) key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)), points = list(pch = 20, col = 1:nlevels(df$f2)) ) trellis.focus(panel, 1, 1) draw.key(key1, draw = TRUE, vp = viewport(.9, .9)) draw.key(key2, draw = TRUE, vp = viewport(.75, .9)) trellis.unfocus() On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote: Dear R-list, I would like to use the lattice library to show several groups on the same graph. Here's my example : ## the data f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3)) f1 - rep(f1,3) f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3)) df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2) # library(lattice) para.liste - trellis.par.get() superpose.symbol - para.liste$superpose.symbol superpose.symbol$pch - c(1,2,3) trellis.par.set(superpose.symbol,superpose.symbol) # Now I can see the group according to the f1 factor (with a different symbol for every modality) xyplot( val~x, data=df, group=f1, auto.key=list(space=right) ) # or I can see the group according to the f2 factor xyplot( val~x, data=df, type=l, group=f2, auto.key=list(space=right,points=FALSE,lines=TRUE) ) How can I do to highlight both the f1 and f2 factors on one panel with the legends, using the lattice function ? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem plotting with xyplot
This is in regard to Dan Norlund's post from December 2003 (available at https://stat.ethz.ch/pipermail/r-help/attachments/20031225/1bce02b8/attachment.pl ) While I agree with Prof. Ripley's warning against fitting so few observations per panel, this is not actually what causes the error. Instead, the culprit is the fact that panel.loess uses family='symmetric' by default; since the first iteration of fitting interpolates the data, the residuals are zero, hence the robustness weights are not defined for the next iteration. In the example Dan gave, a change to xyplot(tolerance~age | factor(id), data=tolerance.pp, type=c(p,smooth), family=gaussian) avoids this. As family='gaussian' is the default outside of panel.loess, it is easy to forget this detail. Ben __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help on apply() function
Anusha anu1978 at hotmail.com writes: Respected Sir/Madam, I have a problem with apply function. I have to two matrices of dimension of one column but n rows. I have to check whether one matrix is greater than other by going thru each row (ie) using if condition to check one matrix with another matrix. I like to use apply() function to this approach. That is apply function between two matrices. I searched for examples online but I couldn't find any. I don't know how to loop thru the matrices. Please help with this problem. Any help is appreciated. My mailid is monkponu at yahoo.com. Thanks, Anusha. You can use the functions all.equal with the function isTRUE (see ?all.equal) to check if two objects are nearly equal (within a certain tolerance). Or you can use identical (see ?identical) to check if they are exactly the same. See the examples in the help for identical. Mark Lyman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Need help to estimate the Coef matrices in mAr
Dear R users, I am using mAr package to fit a Vector autoregressive model to my data. But here I want to put some predetermined values for some elements in coefficient matrix that mAr.est going to estimate. For example if p=3 then I want to put A3[1,3] = 0 and keep rest of the elements of coefficient matrices to be determined by mAr.est. Can anyone please tell me how can I do that? Sincerely yours, Arun [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cross-correlation between two time series data
Hi all, I have two time series data (say x and y). I am interested to calculate the correlation between them and its confidence interval (or to test no correlation). Function cor.test(x,y) does the test of no correlation. But this test probably is wrong because of autocorrelated data. ccf() calculates the correlation between two series data. But it does not provide the confidence intervals of cross correlation. Is there any function that calculates the confidence interval of correlation between two time series data or performs the test of no correlation between two time series data. Thanks. Jun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.