Re: [R] Friendly way to link R - MySQL and non-(R and Mysql) users ?
Dear Gabor, Thanks for the links. I found a a tcl script (see below ; from http://wiki.tcl.tk/15977) which could be a good starting point but I'm not able to translate it into R. Could you help me ? In particularly, what is the command corresponding to append_float_dialog_item ? I looked in ?tcltk but I haven't found append command. Thanks in advance, Have a nice week-end, Ptit Bleu - # Simple sphere demo with UI for Shade # Variables: radius, center coordinates, RGB color set r 600 set X 0 set Y 0 set Z 0 set R 1.0 set G 0.1 set B 0.1 # The UI starts here begin_dialog # Create a dialog box with 7 typed entries append_float_dialog_item Radius append_float_dialog_item X center append_float_dialog_item Y center append_float_dialog_item Z center append_float_dialog_item Red value (0..1) append_float_dialog_item Green value (0..1) append_float_dialog_item Blue value (0..1) # Initial values for items set_float_property_value 0 to $r set_float_property_value 1 to $X set_float_property_value 2 to $Y set_float_property_value 3 to $Z set_float_property_value 4 to $R set_float_property_value 5 to $G set_float_property_value 6 to $B # ask_dialog is true if we hit on OK button if [ask_dialog] { set r [get_float_property_value 0] set X [get_float_property_value 1] set Y [get_float_property_value 2] set Z [get_float_property_value 3] set R [get_float_property_value 4] set G [get_float_property_value 5] set B [get_float_property_value 6] if {$R 1.0} {set R 1.0} if {$G 1.0} {set G 1.0} if {$B 1.0} {set B 1.0} end_dialog } else { end_dialog error cancel_dialog } # End of UI # Create a tagged sphere with radius r at X,Y,Z coordinates create_sphere at [list $X $Y $Z] r $r sphere_1 # set color to sphere_1 set base_color [list $R $G $B] # Render the result render -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13908847 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Packages - a great resource, but hard to find the right one
Johannes Hüsing wrote Above all there are lots of packages. As the software editor of the Journal of Statistical Software I suggested we should review R packages. You mean: prior to submission? No. No one has shown any enthusiasm for this suggestion, but I think it would help. Any volunteers? Thing is, I may like to volunteer, but not in the here's a package for you to review by week 32 way. Rather in the way that I search a package which fits my problem. That's what I was hoping for. One package lets me down and I'd like to know other users and the maintainer about it. The other one works black magic and I'd like to drop a raving review about it. This needs an infrastructure with a low barrier to entry. A wiki is not the worst idea if the initial infrastructure is geared at addressing problems rather than packages. We should differentiate between rave reviews of features that just happened to be very useful to someone and reviews of a package as a whole. Both have their place and at the moment we don't have either. If you are willing to review an R package or aspects of R for JSS please let me know. Antony Unwin Professor of Computer-Oriented Statistics and Data Analysis, Mathematics Institute, University of Augsburg, Germany [[alternative HTML version deleted]] __ R-help@r-project.org 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] bootstrap for nlme
Dear All, Is there any bootstrap function in nlme for a non linear mixed model. Either a non-parametric or parametric one. Thanks Bernard - [[alternative HTML version deleted]] __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
Ptit_Bleu wrote: Dear Gabor, Thanks for the links. I found a a tcl script (see below ; from http://wiki.tcl.tk/15977) which could be a good starting point but I'm not able to translate it into R. Could you help me ? In particularly, what is the command corresponding to append_float_dialog_item ? I looked in ?tcltk but I haven't found append command. I think you don't want to go there. That is a commercial raytracing program, Shade, which embeds Tcl and extends it with some new commands. For you to use this with R, you'd need to obtain Shade and figure out how to embed it in R (or R in Shade, or R in Tcl in Shade...). If all you need is how to code simple dialogs look for the Wettenhall demos at http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ Thanks in advance, Have a nice week-end, Ptit Bleu - # Simple sphere demo with UI for Shade # Variables: radius, center coordinates, RGB color set r 600 set X 0 set Y 0 set Z 0 set R 1.0 set G 0.1 set B 0.1 # The UI starts here begin_dialog # Create a dialog box with 7 typed entries append_float_dialog_item Radius append_float_dialog_item X center append_float_dialog_item Y center append_float_dialog_item Z center append_float_dialog_item Red value (0..1) append_float_dialog_item Green value (0..1) append_float_dialog_item Blue value (0..1) # Initial values for items set_float_property_value 0 to $r set_float_property_value 1 to $X set_float_property_value 2 to $Y set_float_property_value 3 to $Z set_float_property_value 4 to $R set_float_property_value 5 to $G set_float_property_value 6 to $B # ask_dialog is true if we hit on OK button if [ask_dialog] { set r [get_float_property_value 0] set X [get_float_property_value 1] set Y [get_float_property_value 2] set Z [get_float_property_value 3] set R [get_float_property_value 4] set G [get_float_property_value 5] set B [get_float_property_value 6] if {$R 1.0} {set R 1.0} if {$G 1.0} {set G 1.0} if {$B 1.0} {set B 1.0} end_dialog } else { end_dialog error cancel_dialog } # End of UI # Create a tagged sphere with radius r at X,Y,Z coordinates create_sphere at [list $X $Y $Z] r $r sphere_1 # set color to sphere_1 set base_color [list $R $G $B] # Render the result render -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org 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] Summary: Process multiple columns of data.frame
Thompson, David (MNR David.John.Thompson at ontario.ca writes: Thank you Jim Holtman and Mark Leeds for your help. Original question: How do I do the following more concisely? Bout[is.na(Bout$bd.n), 'bd.n'] - 0 Bout[is.na(Bout$ht.n), 'ht.n'] - 0 Bout[is.na(Bout$dbh.n), 'dbh.n'] - 0 . . . Solution: for (i in c('bd.n', 'ht.n', 'dbh.n')) Bout[is.na(Bout[[i]]), i] - 0 ABove solution is completely OK, but can be cumbersome. I wrote functions NAToUnknown() and unknownToNA() with exactly the same problem in mind. Take a look in gdata package. I also described the function in RNews G. Gorjanc. Working with unknown values: the gdata package. R News, 7(1):24–26, 2007. http://CRAN.R-project.org/doc/Rnews/Rnews_2007-1.pdf. For your example try the following: library(gdata) df.0 - as.data.frame( cbind( c1=c(NA, NA, 10, NA, 15, 11, 12, 14, 14, 11), c2=c(13, NA, 16, 16, NA, 12, 14, 19, 18, NA), c3=c(NA, NA, 11, 19, 17, NA, 11, 16, 20, 13), c4=c(20, NA, 15, 11, NA, 15, NA, 13, 14, 15), c5=c(14, NA, 13, 16, 17, 17, 16, NA, 15, NA), c6=c(NA, NA, 13, 11, NA, 16, 15, 12, NA, 20)) ) df.0 c1 c2 c3 c4 c5 c6 1 NA 13 NA 20 14 NA 2 NA NA NA NA NA NA 3 10 16 11 15 13 13 4 NA 16 19 11 16 11 5 15 NA 17 NA 17 NA 6 11 12 NA 15 17 16 7 12 14 11 NA 16 15 8 14 19 16 13 NA 12 9 14 18 20 14 15 NA 10 11 NA 13 15 NA 20 NAToUnknown(df.0, unknown=0) c1 c2 c3 c4 c5 c6 1 0 13 0 20 14 0 2 0 0 0 0 0 0 3 10 16 11 15 13 13 4 0 16 19 11 16 11 5 15 0 17 0 17 0 6 11 12 0 15 17 16 7 12 14 11 0 16 15 8 14 19 16 13 0 12 9 14 18 20 14 15 0 10 11 0 13 15 0 20 __ R-help@r-project.org 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] [R-wiki] Packages - a great resource, but hard to find the right one
Martin Maechler wrote: JH == Johannes Huesing [EMAIL PROTECTED] on Thu, 22 Nov 2007 22:14:57 +0100 writes: JH Antony Unwin [EMAIL PROTECTED] [Thu, Nov 22, JH 2007 at 12:43:07PM CET]: There have been several constructive responses to John Sorkin's comment, but none of them are fully satisfactory. Of course, if you know the name of the function you are looking for, there are lots of ways to search ? provided that everyone calls the function by a name that matches your search. JH I follow the suggestion to Google (mostly restricted by JH site:cran.r-project.org) which gets me quite far. If you think there might be a function, but you don't know the name, then you have to be lucky in how you search. R is a language and the suggestions so far seem to me like dictionary suggestions, whereas maybe what John is looking for is something more like a thesarus. JH This is hard to do in a collaborative effort. One JH analogue is the HOWTOs vs the man pages which I see in JH Linux. Some of the HOWTOs are outstanding, the only JH problem they are facing is that they tend to be out of JH date. R packages are a strange collection, as befits a growing language. There are large packages, small packages, good packages (and not so good packages), personal mixtures of tools in packages, packages to accompany books, superceded packages, unusual packages, everything. Above all there are lots of packages. As the software editor of the Journal of Statistical Software I suggested we should review R packages. JH You mean: prior to submission? No one has shown any enthusiasm for this suggestion, but I think it would help. Any volunteers? JH I am still putting some hope into the R Wiki. To my JH dismay it is also package oriented, JH not method-oriented. I don't think this is true; at least it's not at all intended. I'll *exceptionally* am crossposting this to the R-Wiki Special Interest Group. The R-SIG-Wiki is there to discuss problems related to the Wiki. The Wiki itself, not the SIG, is the place where the information should go. Indeed, the R Wiki goal is NOT to help finding which package to use (at least, not directly), but it's primary goal is to collect together additional documentation around R and R packages contributed by the users. So, the question about how to efficiently find the right function and documentation is still open (CRAN Task Views associated with Googling R stuff is probably the way to go here). Although I am sure it is difficult to do, I also think that a review mechanism for packages would be nice. Another interesting approach is the test unit. It is already implemented, but should be used more intensively. The question is: could we maintain (and grow) a database of use cases, with examples datasets and typical results expected that we can use to test functions in R packages more intensively? Best, Philippe JH I tend to think that there is a chance JH of controlled documentation if somebody set out an JH infrastructure going beyond the current one. Anything JH like a classification of methods. JH Thing is, I may like to volunteer, but not in the JH here's a package for you to review by week 32 JH way. Rather in the way that I search a package which JH fits my problem. One package lets me down and I'd like JH to know other users and the maintainer about it. The JH other one works black magic and I'd like to drop a JH raving review about it. This needs an infrastructure JH with a low barrier to entry. A wiki is not the worst JH idea if the initial infrastructure is geared at JH addressing problems rather than packages. JH -- Johannes H�sing ___ R-sig-wiki mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-sig-wiki __ R-help@r-project.org 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] Packages - a great resource, but hard to find the right one
I'm coming late to this thread, so I don't know if anyone mentioned RSiteSearch. See http://finzi.psych.upenn.edu/R/library/utils/html/RSiteSearch.html You can also do this directly through a browser (which is how I usually do it). In the RSiteSearch() function use restrict=functions. In the web page at http://finzi.psych.upenn.edu/, in the search page uncheck the boxes except for Functions. True, this doesn't get everything because people use different words for the same thing (especially economists), but I find that it usually works when I'm looking for a function. When you find the function, there is a header at the top that says what package it is in. Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ R-help@r-project.org 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] anova planned comparisons/contrasts
On 2007-11-22, Peter Alspach [EMAIL PROTECTED] wrote: Tyler For balanced data like this you might find aov() gives an output which is more comparable to Sokal and Rohlf (which I don't have): trtCont - C(sugars$treatment, matrix(c(-4,1,1,1,1, 0,-1,3,-1,-1), 5, 2)) sugarsAov - aov(length ~ trtCont, sugars) summary(sugarsAov, split=list(trtCont=list('control vs rest'=1, 'gf vs others'=2))) model.tables(sugarsAov, type='mean', se=T) Thank you Peter, that's a big help! To confirm that I understand correctly, aov is identical to lm, but provides better summary information for balanced anova designs. As such, it is preferred to lm for balanced anova designs, but should be avoided otherwise. Is that correct? Also, it appears that C and contrasts serve pretty much the same purpose. Is there a context in which one is preferable to the other? Cheers, Tyler __ R-help@r-project.org 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] PCA with NA
Birgit Lemcke wrote: Dear all, (Mac OS X 10.4.11, R 2.6.0) I have a quantitative dataset with a lot of Na´s in it. So many, that it is not possible to delete all rows with NA´s and also not possible, to delete all variables with NA´s. Is there a function for a principal component analysis, that can deal with so many NA´s. Thanks in advance Birgit Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org 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. Hi, in centred PCA, missing data should be replaced by the mean of available data. Let X be your analyzed matrix (variables in columns). ## X = matrix(runif(300),ncol=10) idx = sample(1:nrow(X),5) X[idx,] = NA sum(is.na(X)) [1] 95 library(ade4) dudi.pca(X,center=TRUE,scale=FALSE) Erreur dans dudi.pca(X, center = TRUE, scale = FALSE) : na entries in table ## Now we replace missing values : ## f1 - function(vec) { m - mean(vec, na.rm = TRUE) vec[is.na(vec)] - m return(vec) } Y = apply(X,2,f1) pcaY = dudi.pca(Y,center=TRUE,scale=FALSE,nf=2,scannf=FALSE) s.label(pcaY$li) sunflowerplot(pcaY$li[idx,1:2], add=TRUE) ## All missing values are placed at the non-informative point, i.e. at the origin. Regards, Thibaut. -- ## Thibaut JOMBART CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive Universite Lyon 1 43 bd du 11 novembre 1918 69622 Villeurbanne Cedex Tél. : 04.72.43.29.35 Fax : 04.72.43.13.88 [EMAIL PROTECTED] http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en http://pbil.univ-lyon1.fr/software/adegenet/ __ R-help@r-project.org 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] PCA with NA
Dear Birgit, You need to think about why you have that many NA's. In case of vegetation data, it is very common to have only a few species present in a site. So how would you record the abundance of a species that is absent? NA or 0 (zero)? One could argument that it needs to be NA because you can't measure the abundance of the species that is absent. But others could argument that a missing species has by definition zero abundance. In my opinion it's best to use 0 (zero) for absent species and NA for present species but with missing information on the abundance. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Birgit Lemcke Verzonden: vrijdag 23 november 2007 16:43 Aan: R Hilfe Onderwerp: [R] PCA with NA Dear all, (Mac OS X 10.4.11, R 2.6.0) I have a quantitative dataset with a lot of Na´s in it. So many, that it is not possible to delete all rows with NA´s and also not possible, to delete all variables with NA´s. Is there a function for a principal component analysis, that can deal with so many NA´s. Thanks in advance Birgit Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org 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@r-project.org 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] Packages - a great resource, but hard to find the right one
Above all there are lots of packages. As the software editor of the Journal of Statistical Software I suggested we should review R packages. No one has shown any enthusiasm for this suggestion, but I think it would help. Any volunteers? There are two common types of review. When reviewing a paper, you are helping the author to make a better paper (and it's initiated by the author). When reviewing a book, you are providing advise on whether someone should make an expensive purchase (and it's initiated by an third party). Reviewing an R package seems somewhat in between. How would you deal with new version of an R package? It seems like there is the potential for reviews to become stale very quickly. Another model to look at would be that of an encyclopedia, something like the existing task views. To me, it would be of more benefit if JSS provided support, peer review, and regular review, for these. Entries would be more of a survey, and could provide links to the literature, much like a chapter of MASS. Hadley -- http://had.co.nz/ __ R-help@r-project.org 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] matrix (column-wise) multiple regression
Perhaps something like this: idx - 1:2 lm(as.matrix(iris[idx]) ~., iris[-idx]) Call: lm(formula = as.matrix(iris[idx]) ~ ., data = iris[-idx]) Coefficients: Sepal.Length Sepal.Width (Intercept) 3.682982 3.048497 Petal.Length0.905946 0.154676 Petal.Width-0.005995 0.623446 Speciesversicolor -1.598362 -1.764104 Speciesvirginica -2.112647 -2.196357 On Nov 23, 2007 10:09 AM, Morgan Hough [EMAIL PROTECTED] wrote: Hi there, I am analyzing a table of brain volume measures where each brain area (183 of them) is a column with a label and volume values. I have another table of explanatory variables (age, gender, diagnosis and IntraCranialVol) that I have been using to model the brain volume differences. I have been doing this for single volume measures with no difficulties but I have been unable to apply this across the whole set of brain areas. If I try: lm(y.df, x.df) Error in eval(expr, envir, enclos) : object Left_Lateral_Ventricle not found Left_Lateral_Ventricle happens to be the first column label. Does this not work with tables? I have been unable to find any examples. Would you recommend another approach if I was doing this again. The number of columns (brain areas) depends on the parcellation strategy we use so I will probably be reforming these tables again and again. I would like the simplest way to analyze all the brain areas and find where there are significant differences driven mainly by the diagnosis factor. Thanks in advance for your time. Cheers, -Morgan --- Morgan Hough, D.Phil. Student, Oxford University FMRIB Centre FMRIB, JR Hospital, Headington, Oxford OX3 9DU, UK +44 (0) 1865 222466 (fax 222717) [EMAIL PROTECTED]http://www.fmrib.ox.ac.uk/~mhough __ R-help@r-project.org 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@r-project.org 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] PCA with NA
Thanks to all for your help. Only to complete this: The NA´s in my case mean that I have no information for this character in this species. These are not ecological data, so I have to deal somehow with the NA´s without replacing by zero. I think Thibauts help is very useful. Thanks a lot Birgit Am 23.11.2007 um 17:26 schrieb Thibaut Jombart: Birgit Lemcke wrote: Dear all, (Mac OS X 10.4.11, R 2.6.0) I have a quantitative dataset with a lot of Na´s in it. So many, that it is not possible to delete all rows with NA´s and also not possible, to delete all variables with NA´s. Is there a function for a principal component analysis, that can deal with so many NA´s. Thanks in advance Birgit Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org 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. Hi, in centred PCA, missing data should be replaced by the mean of available data. Let X be your analyzed matrix (variables in columns). ## X = matrix(runif(300),ncol=10) idx = sample(1:nrow(X),5) X[idx,] = NA sum(is.na(X)) [1] 95 library(ade4) dudi.pca(X,center=TRUE,scale=FALSE) Erreur dans dudi.pca(X, center = TRUE, scale = FALSE) : na entries in table ## Now we replace missing values : ## f1 - function(vec) { m - mean(vec, na.rm = TRUE) vec[is.na(vec)] - m return(vec) } Y = apply(X,2,f1) pcaY = dudi.pca(Y,center=TRUE,scale=FALSE,nf=2,scannf=FALSE) s.label(pcaY$li) sunflowerplot(pcaY$li[idx,1:2], add=TRUE) ## All missing values are placed at the non-informative point, i.e. at the origin. Regards, Thibaut. -- ## Thibaut JOMBART CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive Universite Lyon 1 43 bd du 11 novembre 1918 69622 Villeurbanne Cedex Tél. : 04.72.43.29.35 Fax : 04.72.43.13.88 [EMAIL PROTECTED] http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en http://pbil.univ-lyon1.fr/software/adegenet/ Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org 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] Packages - a great resource, but hard to find the right one
Antony Unwin [EMAIL PROTECTED] and Johannes Huesing [EMAIL PROTECTED] discussed ways to assist navigation of the universe of R packages. AU: ...R is a language and the suggestions so far seem to me like dictionary suggestions, whereas maybe what John is looking for is something more like a thesarus. JH: This is hard to do in a collaborative effort. One analogue is the HOWTOs vs the man pages which I see in Linux. Some of the HOWTOs are outstanding, the only problem they are facing is that they tend to be out of date. ... I am still putting some hope into the R Wiki. To my dismay it is also package oriented, not method-oriented. I tend to think that there is a chance of controlled documentation if somebody set out an infrastructure going beyond the current one. Anything like a classification of methods. What about Views? http://cran.r-project.org/src/contrib/Views/ Is this effort alive? Views allow easy downloading of packages grouped by methodology, with an accompanying overview. But Views would seem to be at risk of going out of date. Or what about what an approach seen on many commercial sites? What if CRAN package download pages had a mechanism for submitting reviews and for reading reviews of others? I notice such reviews of books and software often mention competing products. For those interfacing with CRAN via download.packages() and update.packages() commands, or via 'packages' menu items, could these be amended to invite users to submit/read reviews? Or this 'amazon.com' idea: if the community were not resistant to a login mechanism, what if CRAN pages named 10 packages, related to the featured one by how frequently recent downloaders also downloaded them? AU: As the software editor of the Journal of Statistical Software I suggested we should review R packages. No one has shown any enthusiasm for this suggestion but I think it would help. Any volunteers? JH: Thing is, I may like to volunteer, but not in the here's a package for you to review by week 32 way. Rather in the way that I search a package which fits my problem. AU: That's what I was hoping for. JH: One package lets me down and I'd like to know other users and the maintainer about it. The other one works black magic and I'd like to drop a raving review about it. This needs an infrastructure with a low barrier to entry. A wiki is not the worst idea if the initial infrastructure is geared at addressing problems rather than packages. AU: We should differentiate between rave reviews of features that just happened to be very useful to someone and reviews of a package as a whole. Both have their place and at the moment we don't have either. If you are willing to review an R package or aspects of R for JSS please let me know. On the face of it, JSS reviews sound like a good idea. But is there something wrong with the www.jstatsoft.com site? Today, at least, I cannot connect. Would a Google search on site:r-projects.org be likely to find a JSS review? Would the review be freely downloadable? Would it too become out- dated? I'll contact you, Antony, about a review I may be qualified to write. -John Thaden Research Assistant Professor of Geriatrics College of Medicine University of Arkansas for Medical Sciences Little Rock, Arkansas USA Confidentiality Notice: This e-mail message, including a...{{dropped:8}} __ R-help@r-project.org 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] multiple comparisons/tukey kramer
Tyler Smith a écrit : Hi, I'm trying to make sense of the options for multiple comparisons options in R. I've found the following options: [ Snip ... ] As I understand it, there is no universal consensus as to which test is best. There is no such thing. Each of the procedures is aimed at some subset of the possible contrasts you may want to test. From my limited knowledge, with some(I hope not too gross) simplifications : - Tukey HSD will enable you to test the p(p-1)/2 pair differences one can create with p groups ; - Dunnett's procedure is made to compare (p-1) treatments to a common control ; - Scheffé's procedure is applicable to *any* (reasonable) set of contrasts you can form ; - Newman-Keuls : aims to create separate subset of groups (but has serious conceptual and technical flaws ! Don't do that nunless you know what you're doing...). - etc ... Those procedures have the same hypothesis as the base ANOVA : homoscedasticity, normality of residuals, etc ... Their robustness to a small departure friom these conditions vary. As a last resort, a set of non-parametric comparisons with the (overly conservative) Bonferroni adjustment may help (but less power !). You'll have to refer to the subject matter to make a choice. TukeyHSD appears to be appropriate for balanced designs. I have an unbalanced design to analyze. Therefore, no aov(..) (hence no TukeyHSD(aov(...))) for you... I can use glht, but can someone tell me what each option is actually calculating? A reference to a paper that describes the procedures would be great, but I'm afraid I the one offered in ?glht[1] is beyond me. Google (multiple comparisons) will offer you some dubious and quite a few good references... HTH Emmanuel Charpentier __ R-help@r-project.org 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 pleaseeeeeeeee
When I tried it on my Windows system, I executed the script at least 4 times in succession before I got the error: # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- + 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) res.ar-ar(x,aic=TRUE,demean=F) res.ar Call: ar(x = x, aic = TRUE, demean = F) Order selected 0 sigma^2 estimated as 1.482 # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- + 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used # call ar again and res.ar-ar(x,aic=TRUE,demean=F) res.ar-ar(x,aic=TRUE,demean=F) res.ar Call: ar(x = x, aic = TRUE, demean = F) Order selected 0 sigma^2 estimated as 1.482 Maybe it has something to do with random numbers that might be used in the computation. On Nov 23, 2007 4:13 PM, Steven McKinney [EMAIL PROTECTED] wrote: Hi Clara, Your example works fine on my Apple Mac running R 2.6.0. You should include the output of sessionInfo() so others will know what platorm you are working on. # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- + 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) res.ar-ar(x,aic=TRUE,demean=F) res.ar Call: ar(x = x, aic = TRUE, demean = F) Order selected 0 sigma^2 estimated as 1.482 res.ar-ar(x,aic=TRUE,demean=F) res.ar Call: ar(x = x, aic = TRUE, demean = F) Order selected 0 sigma^2 estimated as 1.482 summary(res.ar) Length Class Mode order 1 -none- numeric ar 0 -none- numeric var.pred1 -none- numeric x.mean 1 -none- numeric aic10 -none- numeric n.used 1 -none- numeric order.max 1 -none- numeric partialacf 9 -none- numeric resid 9 ts numeric method 1 -none- character series 1 -none- character frequency 1 -none- numeric call4 -none- call sessionInfo() R version 2.6.0 (2007-10-03) powerpc-apple-darwin8.10.1 locale: en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] survival_2.34 loaded via a namespace (and not attached): [1] tools_2.6.0 Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: smckinney +at+ bccrc +dot+ ca tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: [EMAIL PROTECTED] on behalf of Clara Cordeiro Sent: Fri 11/23/2007 7:38 AM To: [EMAIL PROTECTED] Subject: [R] help please Dears Sirs During my computational work I encountered unexpected behavior when calling ar function, namely # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used For me it is mysterious why sometimes it works and others it does not, perhaps I am doing something wrong and stupid :-( If anyone had already had this problem could you please tell me how you have solved it? Thank you for your time. Best Regards, Clara Cordeiro [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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
[R] missing values: a question
Dear all, Is there a best way to do the following task? x = rep(c(A,B),5)y = rnorm(10)data = data.frame(x,y)data$y[1:2] = c(NA,NA)means = ave(data$y,as.character(data$x),FUN=function(x)mean(x,na.rm=T))aux = which(is.na(data$y))data[aux,y] = means[aux] Encontre o que você procura com mais eficiência! Instale já a Barra de Ferramentas com Windows Desktop Search! É GRÁTIS! _ Veja mapas e encontre as melhores rotas para fugir do trânsito com o Live Search Maps! [[alternative HTML version deleted]] __ R-help@r-project.org 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] looking for function like rollmean()
Hi, i have some data, that has 1-5 % noise. I want to smooth this data without loosing rows. rollmean() would be great, but it returns a vector of different size as the initial vector. -- kind regards, Jonas Stein [EMAIL PROTECTED] __ R-help@r-project.org 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] looking for function like rollmean()
If you are referring to rollmean in the zoo package then na.pad = TRUE will cause the output to be the same length as the input: library(zoo) rollmean(zoo(1:10), 3, na.pad = TRUE) 1 2 3 4 5 6 7 8 9 10 NA 2 3 4 5 6 7 8 9 NA rollmean(zoo(matrix(1:10, 5)), 3, na.pad = TRUE) 1 NA NA 2 2 7 3 3 8 4 4 9 5 NA NA On Nov 23, 2007 4:02 PM, Jonas Stein [EMAIL PROTECTED] wrote: Hi, i have some data, that has 1-5 % noise. I want to smooth this data without loosing rows. rollmean() would be great, but it returns a vector of different size as the initial vector. -- kind regards, Jonas Stein [EMAIL PROTECTED] __ R-help@r-project.org 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@r-project.org 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] grDevices
Dear Sir I am using R 2.6.0. In R console grDevices are not giving results like png, postcript, xlim, etc. I think they are not activated? I request you to please provide guidance in this regard. Regards -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. [[alternative HTML version deleted]] __ R-help@r-project.org 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] multiple comparisons/tukey kramer
However, I don't know what exactly glht does, and the help file is extremely terse. It offers the following options (in contrMat()): contrMat(n, type=c(Dunnett, Tukey, Sequen, AVE, Changepoint, Williams, Marcus, McDermott), base = 1) The only reference to the source of these tests is: Frank Bretz, Alan Genz and Ludwig A. Hothorn (2001), On the numerical availability of multiple comparison procedures. _Biometrical Journal_, *43*(5), 645-656. This is a very technical paper, which as far as I can follow, is primarily a discussion of the numerical methods involved in calculating these contrasts, rather than the contrasts themselves. I can't decide which one is appropriate without knowing what the differences are. Dunnett seems pretty straightforward. Tukey, I think, may refer to what is referred to as the Tukey-Kramer test in other sources? Are any of them related to Scheffe? I have no idea. None of them are related to Newman-Keuls, as several archive messages make very clear that this is not a valid comparison to use, so R doesn't implement it. What I need is a reference to the tests implemented in glht, so I can decide which one is appropriate for my data. Sequen, Changepoint et al. may be common terms in some fields, but not in the references I'm working from. Have you read the vignette: http://cran.r-project.org/doc/vignettes/multcomp/multcomp.pdf ? You can also see exactly what set of contrasts are used by each type with the contrMat function, see the help examples for more details. Hadley -- http://had.co.nz/ __ R-help@r-project.org 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 updating packages on Ubuntu 7.10
-Original Message- From: Vincent Goulet [mailto:[EMAIL PROTECTED] Sent: Friday, November 23, 2007 7:47 AM To: Daniel Nordlund Cc: [EMAIL PROTECTED] Subject: Re: [R] problem updating packages on Ubuntu 7.10 Le jeu. 22 nov. à 14:19, Daniel Nordlund a écrit : I am running Ubuntu 7.10 and R-2.6.0, and I am having trouble updating packages. There appears to be a problem involving gfortran. For example, here is the output of an attempt to update the Hmisc package. * Installing *source* package 'Hmisc' ... ** libs gfortran -fpic -g -O2 -c cidxcn.f -o cidxcn.o gfortran -fpic -g -O2 -c cidxcp.f -o cidxcp.o gfortran -fpic -g -O2 -c hoeffd.f -o hoeffd.o gfortran -fpic -g -O2 -c jacklins.f -o jacklins.o gfortran -fpic -g -O2 -c largrec.f -o largrec.o gcc -std=gnu99 -I/usr/share/R/include -I/usr/share/R/include - fpic -g -O2 -c ranksort.c -o ranksort.o gfortran -fpic -g -O2 -c rcorr.f -o rcorr.o gfortran -fpic -g -O2 -c wclosest.f -o wclosest.o gcc -std=gnu99 -shared -o Hmisc.so cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o ranksort.o rcorr.o wclosest.o -lgfortran -lm - lgcc_s -L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -lgfortran collect2: ld returned 1 exit status make: *** [Hmisc.so] Error 1 ERROR: compilation failed for package 'Hmisc' ** Removing '/usr/local/lib/R/site-library/Hmisc' ** Restoring previous '/usr/local/lib/R/site-library/Hmisc' The downloaded packages are in /tmp/RtmpkaH0Db/downloaded_packages Warning message: In install.packages(update[instlib == l, Package], l, contriburl = contriburl, : installation of package 'Hmisc' had non-zero exit status Hi Daniel, The package built and installed flawlessly here in the Gutsy chroot where the Ubuntu packages are built. Did you install the r-base-dev package? This package will install all the tools you need to install source packages. Best, --- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca Vincent, Thanks for your suggestion, it led to finding the solution to my problem. I thought I had r-base-dev installed but checked anyway. I had r-base-dev installed under Feisty, but it turns out that I had failed to add the CRAN repository for Gutsy to my third party repositories and the Feisty R install had not been updated. I have done that and packages now install just fine. I apologize for taking up band-width on R-help for a non-R problem (but I am thankful that the list did provide a solution :-). Dan Daniel Nordlund Bothell, WA __ R-help@r-project.org 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] multiple comparisons/tukey kramer
Thank you for your response. I think you have misunderstood what I'm asking, though. On 2007-11-23, Emmanuel Charpentier [EMAIL PROTECTED] wrote: - Tukey HSD will enable you to test the p(p-1)/2 pair differences one can create with p groups ; - Dunnett's procedure is made to compare (p-1) treatments to a common control ; - Scheffé's procedure is applicable to *any* (reasonable) set of contrasts you can form ; - Newman-Keuls : aims to create separate subset of groups (but has serious conceptual and technical flaws ! Don't do that nunless you know what you're doing...). - etc ... You'll have to refer to the subject matter to make a choice. Of course. I also have to know which function in R corresponds to which test, which is my main question. Google (multiple comparisons) will offer you some dubious and quite a few good references... I have indeed found many dubious and a few good references to multiple comparisons, both from google and r-site-search. Many posts in the archive, including one made today in response to another question of mine, point to glht as the appropriate function to use in R. However, I don't know what exactly glht does, and the help file is extremely terse. It offers the following options (in contrMat()): contrMat(n, type=c(Dunnett, Tukey, Sequen, AVE, Changepoint, Williams, Marcus, McDermott), base = 1) The only reference to the source of these tests is: Frank Bretz, Alan Genz and Ludwig A. Hothorn (2001), On the numerical availability of multiple comparison procedures. _Biometrical Journal_, *43*(5), 645-656. This is a very technical paper, which as far as I can follow, is primarily a discussion of the numerical methods involved in calculating these contrasts, rather than the contrasts themselves. I can't decide which one is appropriate without knowing what the differences are. Dunnett seems pretty straightforward. Tukey, I think, may refer to what is referred to as the Tukey-Kramer test in other sources? Are any of them related to Scheffe? I have no idea. None of them are related to Newman-Keuls, as several archive messages make very clear that this is not a valid comparison to use, so R doesn't implement it. What I need is a reference to the tests implemented in glht, so I can decide which one is appropriate for my data. Sequen, Changepoint et al. may be common terms in some fields, but not in the references I'm working from. Thanks, Tyler __ R-help@r-project.org 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] updating matrix from a dataframe
Dear all, I have a matrix which values varying from 1 to 5. I also have a table with a column that match with matrix values (=my.id). my.matrix-matrix(sample(1:5,100,replace=T),nc=10) image(my.matrix) my.df-data.frame(cbind(my.id=1:5,my.value=c(0.1,0.3,0.2,0.9,1))) my.df How can I create a new matrix, where the values of this matrix is my.value when the value of my.matrix match with my.df$my.id I can do it in a for() looping, but my matrix are so big (2000 x 2000) and I need to it about 1,000 times. Thanks in advance, Miltinho para armazenamento! [[alternative HTML version deleted]] __ R-help@r-project.org 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] Packages - a great resource, but hard to find the right one
On 23 Nov 2007, at 4:51 pm, hadley wickham wrote: There are two common types of review. When reviewing a paper, you are helping the author to make a better paper (and it's initiated by the author). When reviewing a book, you are providing advise on whether someone should make an expensive purchase (and it's initiated by an third party). Reviewing an R package seems somewhat in between. How would you deal with new version of an R package? It seems like there is the potential for reviews to become stale very quickly. This is a strange argument. A good package will get a good review, which may help it to become better. A review of a weak package can point out how it can be fixed. Reviews will not become stale, just because packages are frequently updated by their authors (like some that could be mentioned). These are generally smaller changes. A constructive review will not just be concerned with details, but more with the overall aims of the package and how they are achieved (or not achieved). Another model to look at would be that of an encyclopedia, something like the existing task views. To me, it would be of more benefit if JSS provided support, peer review, and regular review, for these. Why should JSS, one of the few journals for statistical software, review texts? Task views are a good idea, but are general. They give only a brief and subjective overview (and can hardly be expected to do more). Entries would be more of a survey, and could provide links to the literature, much like a chapter of MASS. If you were not an enthusiastic author of many R packages I would start to think that you are afraid of being reviewed, Hadley! What have you against someone studying a package, a group of packages or some other aspect of R in detail? Maybe I had better start reviewers on your packages first... Thanks to several people who have contacted me independently and offered to review packages, I'll keep the list informed about how that goes. Apologies for JSS's webpage being down to-day, Jan de Leuw tells me it's something to do with Thanksgiving weekend. Antony Unwin Professor of Computer-Oriented Statistics and Data Analysis, Mathematics Institute, University of Augsburg, Germany [[alternative HTML version deleted]] __ R-help@r-project.org 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] missing values
Dear all, there is a best way to do the following task? x = rep(c(A,B),5) y = rnorm(10) data = data.frame(x,y) data$y[1:2] = c(NA,NA) means = ave(data$y,as.character(data$x),FUN=function(x)mean(x,na.rm=T)) aux = which(is.na(data$y)) data[aux,y] = means[aux] _ Encontre o que procura com mais eficiência! Instale já a Barra de Ferra[[replacing trailing spam]] [[alternative HTML version deleted]] __ R-help@r-project.org 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] ggplo2: fixed extent greater than data?
Hi everyone! I'm digging into ggplot for some while now, I must say it's great! But - as some others have posted before, and hadley knows very well himself - the documentation is lacking some bits... So I have to pose that question directly: I'd like to produce a series of maps with different data on, but exactly the same extent in each plot. Is there a way of switching the automatic extent (to the data of the last layer added) OFF? I'm trying something like: drawOverviewMap-function(){ p2-ggplot(xlimits=c(2,20),ylimits=c(43,50))+coord_map(project=azequalarea) p2-p2+geom_path(data=wa,mapping=aes(x=x,y=y)) p2-p2+geom_point(data=spts,mapping=aes(x=Lon,y=Lat)) return(p2) } If I plot this in cartesian coordinates, it will zoom to the extent of the country boundaries wa, plus some extra space around it (since this is the dataset with the widest range). This extent can be fixed with the limits=... parameter. If I plot it in a map projection, as shown above, it zooms to the extent of the sample localities spts (plus extra space). ;-( Additional question: is there a way of eliminating the extra spacing in a map projection? The expand=c(0,0) parameter seems not to work... Thanks very much! -- View this message in context: http://www.nabble.com/ggplo2%3A-fixed-extent-greater-than-data--tf4863198.html#a13916848 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] matrix (column-wise) multiple regression
You can look at the components of the output using str and pick out what you want using $ and attr. idx - 1:2 z - lm(as.matrix(iris[idx]) ~., iris[-idx]) str(z) str(summary(z)) On Nov 23, 2007 1:10 PM, Morgan Hough [EMAIL PROTECTED] wrote: Hi Gabor, Thanks for your reply. I have it working now. A couple of follow-ups if I may. I have a shell script parsing the output to find the brain areas where there is a significant effect of diagnosis but its a bit of a hack. I was wondering whether there are R specific tools for parsing/summarizing this kind of output. Can I apply multiple comparison corrections via lm() or do I need to apply something on the model output from lm() after? Thanks again for your time. Cheers, -Morgan Gabor Grothendieck wrote: Perhaps something like this: idx - 1:2 lm(as.matrix(iris[idx]) ~., iris[-idx]) Call: lm(formula = as.matrix(iris[idx]) ~ ., data = iris[-idx]) Coefficients: Sepal.Length Sepal.Width (Intercept) 3.682982 3.048497 Petal.Length0.905946 0.154676 Petal.Width-0.005995 0.623446 Speciesversicolor -1.598362 -1.764104 Speciesvirginica -2.112647 -2.196357 On Nov 23, 2007 10:09 AM, Morgan Hough [EMAIL PROTECTED] wrote: Hi there, I am analyzing a table of brain volume measures where each brain area (183 of them) is a column with a label and volume values. I have another table of explanatory variables (age, gender, diagnosis and IntraCranialVol) that I have been using to model the brain volume differences. I have been doing this for single volume measures with no difficulties but I have been unable to apply this across the whole set of brain areas. If I try: lm(y.df, x.df) Error in eval(expr, envir, enclos) : object Left_Lateral_Ventricle not found Left_Lateral_Ventricle happens to be the first column label. Does this not work with tables? I have been unable to find any examples. Would you recommend another approach if I was doing this again. The number of columns (brain areas) depends on the parcellation strategy we use so I will probably be reforming these tables again and again. I would like the simplest way to analyze all the brain areas and find where there are significant differences driven mainly by the diagnosis factor. Thanks in advance for your time. Cheers, -Morgan --- Morgan Hough, D.Phil. Student, Oxford University FMRIB Centre FMRIB, JR Hospital, Headington, Oxford OX3 9DU, UK +44 (0) 1865 222466 (fax 222717) [EMAIL PROTECTED]http://www.fmrib.ox.ac.uk/~mhough __ R-help@r-project.org 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@r-project.org 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] anova planned comparisons/contrasts
Tyler Smith tyler.smith at mail.mcgill.ca writes: I'm trying to figure out how anova works in R by translating the examples in Sokal And Rohlf's (1995 3rd edition) Biometry. I've hit a snag with planned comparisons, their box 9.4 and section 9.6. It's a basic anova design: how to do contrast It's easier to use function estimable in package gmodels, or glht in package multcomp. Dieter __ R-help@r-project.org 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] PCA with NA
Dear all, (Mac OS X 10.4.11, R 2.6.0) I have a quantitative dataset with a lot of Na´s in it. So many, that it is not possible to delete all rows with NA´s and also not possible, to delete all variables with NA´s. Is there a function for a principal component analysis, that can deal with so many NA´s. Thanks in advance Birgit Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org 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] intercept in lars fit
I am trying to extract coefficients from lars fit and can't find how to get intercept. E.g. y = rnorm(10) x = matrix(runif(50),nrow=10) X = data.frame(y,x) fit1 = lars(as.matrix(X[,2:6]),as.matrix(X[,1])) fit2 = lm(y~.,data=X) Then, if I do: predict(fit1,s=1,mode='fraction',type='coefficients')$coef X1 X2 X3 X4 X5 0.3447570 0.7715479 -1.1224714 1.0841587 -1.6259571 coef(fit2) (Intercept) X1 X2 X3 X4 X5 0.3979150 0.3447570 0.7715479 -1.1224714 1.0841587 -1.6259571 I expect them to be the same but can't find the intercept. How to extract intercept from lars fit object? Also, if I do: mean(X$y) [1] 0.2596246 This is not intercept from lm fit. what am I missing here? Thanks so much. Young [[alternative HTML version deleted]] __ R-help@r-project.org 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] multiple comparisons/tukey kramer
Hi, I'm trying to make sense of the options for multiple comparisons options in R. I've found the following options: pairwise.t.test, which provides standard t-tests, with options for choosing an appropriate correction for multiple comparisons TukeyHSD, which provides the usual Tukey test glht(package multcomp), which provides a variety of options From the help list, it appears that glht is the preferred approach. However, I don't understand what the options are. ?glht refers to a very technical paper on the numerical computations involved, and I couldn't find a description corresponding to the McDermott or AVE options. I did notice that the Tukey option provides the same result as TukeyHSD for balanced data. Is this the same as Tukey-Kramer? As I understand it, there is no universal consensus as to which test is best. TukeyHSD appears to be appropriate for balanced designs. I have an unbalanced design to analyze. I can use glht, but can someone tell me what each option is actually calculating? A reference to a paper that describes the procedures would be great, but I'm afraid I the one offered in ?glht[1] is beyond me. Thanks, Tyler [1] Frank Bretz, Alan Genz and Ludwig A. Hothorn (2001), On the numerical availability of multiple comparison procedures. _Biometrical Journal_, *43*(5), 645-656. __ R-help@r-project.org 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 pleaseeeeeeeee
Dears Sirs During my computational work I encountered unexpected behavior when calling ar function, namely # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used For me it is mysterious why sometimes it works and others it does not, perhaps I am doing something wrong and stupid :-( If anyone had already had this problem could you please tell me how you have solved it? Thank you for your time. Best Regards, Clara Cordeiro [[alternative HTML version deleted]] __ R-help@r-project.org 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] R2winBUGS WinBUGS gui
I am trying to figure out if it is possible to run winBUGS from within R, using R2winBUGS, without having winBUGS spawn any windows (basically - 'true' batch - no GUI actions at all). The reason being I have a machine which I (and several others) ssh/telnet into, and would like to run winBUGS without having to mount a virtual desktop of any kind. I've looked through the r2winBUGS docs, and there doesn't seem to be any command(s) which I can invoke to simply use the winBUGS 'engine', and not the winBUGS windows. Yes, I know I could look at classic BUGS, or openBUGS, but neither work particularly well for my purposes (since the code I'm using makes use of a numb4er of winBUGS 'extensions' which aren't supported in other flavours of BUGS). Is this possible in any fashion? Thanks in advance... __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
I found the file tkttest.r in the directory tcltk/demo. From this I hope I will be able to do what I want to. Again thank you for your help, Ptit Bleu. -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13911877 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Package specific dependencies...
On Nov 22, 2007 4:14 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: The SystemRequirements field on the DESCRIPTION file is used to document the system requirements. For example, the DESCRIPTION file for Ryacas (which requires yacas) is shown below. Package: Ryacas Version: 0.2-8 Date: 2007-08-22 Title: R interface to the yacas computer algebra system Author: Rob Goedman [EMAIL PROTECTED], Gabor Grothendieck [EMAIL PROTECTED], Søren Højsgaard [EMAIL PROTECTED], Ayal Pinkus [EMAIL PROTECTED] Maintainer: G Grothendieck [EMAIL PROTECTED] Encoding: latin1 Description: An interface to the yacas computer algebra system. Depends: R (= 2.5.1), XML SystemRequirements: yacas (= 1.0.63) # instructions on home page License: GPL URL: http://ryacas.googlecode.com Thats very useful to know and something that I wasn't aware of. But (in my mind) there is a subtle difference between installing packages that require specific libraries and those that require a specific piece of software. Taking the Ryacas package as an example, anyone installing that would automatically know that its required, and in all likelihood would probably have it installed on their system already and have been using it but then decided they want to interface with it from R. This isn't necessarily the case with libraries, you wouldn't know that a dependency is required until you come to try and install the package and get error messages that something is missing. There is also the rather striking difference (taking the two packages that have been discussed) in that Ryacas will install on a system that doesn't have the SystemRequirement met (i.e. without yacas installed) whereas GDD won't install unless the system has the SystemRequirement (libgd) is installed, and it is this problem that I am trying to help address. I do realise that in either instance a user could find this out in advance of installing any package by simply reading the DESCRIPTION file. I suspect that the ultimate answer to the question that I'm asking (i.e. how can dependencies for CRAN packages be pulled in *automatically* when installing them) will simply be that its down to the user/sysadmin to sort this out. Neil -- Don't remember what you can infer. - Harry Tennant Email - [EMAIL PROTECTED] / [EMAIL PROTECTED] Website - http://slack.ser.man.ac.uk/ Photos - http://www.flickr.com/photos/slackline/ __ R-help@r-project.org 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] more outrageous plotting
Within the base package collection, see ?colorRamp and ?colorRampPalette Then or.to.blue-colorRampPalette(c(orange,green,blue)) #green included to avoid muddy blues plot(df$X, df$Y,type=n) text(df$X, df$Y, labels=df$Z, col=or.to.blue(length(df$Z))[rank(df$Z)]) You don't need to order by Z to do this, but if you want that for another reason, see ?order and try oo-order(df$Z) df[oo,] Steve E hadley wickham [EMAIL PROTECTED] 23/11/2007 01:02:13 Hi Juan, Assuming that your data frame is named df, something like the following should work: library(ggplot) qplot(X, Y, data = df, colour = Z, label = Z, geom = text) + scale_colour_continuous(low=orange, high = blue) You can find out more about ggplot2 at http://had.co.nz/ggplot2. Hadley On 11/22/07, Juan Pablo Fededa [EMAIL PROTECTED] wrote: Dear Contributors: I have the next matrix: X Y Z 1 2 526 2 5 723 310 110 4 7 1110 5 9 34 6 8 778 7 1 614 8 4 876 9 6 249 10 3 14 I want to order the matrix from bigest Z (1110) to lower Z (14). Then I want to asign a color scale vector from blue ( bigest Z) to orange (lower Z), and then I want to make a plot with the X vs.Y coordinates of the matrix, with the number correspondent to Z in every point, each number coloured with the assigned colour scale colour. Is this doable? Thanks in advance again, Juan Pablo __ R-help@r-project.org 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. -- http://had.co.nz/ __ R-help@r-project.org 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. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org 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] rbinom with computed probability
Hello, I have a loop with probability computed from a logistic model like this: for (i in 1:300){ p[i]-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023 +z[i])) x and z generated from normal distribution. I get 300 different probabilities And I want to generate variables from bernulli distribution with P for every observation: T[i]-rbinom(1,1,p[i]) But i get missing values for T. What I'm doing wrong? Thank you, Sigalit. [[alternative HTML version deleted]] __ R-help@r-project.org 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] more outrageous plotting
Juan Pablo Fededa wrote: Dear Contributors: I have the next matrix: X Y Z 1 2 526 2 5 723 310 110 4 7 1110 5 9 34 6 8 778 7 1 614 8 4 876 9 6 249 10 3 14 I want to order the matrix from bigest Z (1110) to lower Z (14). Then I want to asign a color scale vector from blue ( bigest Z) to orange (lower Z), and then I want to make a plot with the X vs.Y coordinates of the matrix, with the number correspondent to Z in every point, each number coloured with the assigned colour scale colour. Is this doable? Sure, but I don't think you need to order the rows to do it: library(plotrix) jpf-read.csv(jpf.csv) plot(jpf$X,jpf$Y,main=Test of color/text plot, type=n) text(jpf$X,jpf$Y,labels=jpf$Z, col=color.scale(jpf$Z,extremes=c(orange,blue))) Note that the extremes argument will only work properly in the latest version of plotrix. Jim __ R-help@r-project.org 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] missing values
Here's my take on it, don't know if you cared at all about optimizing the first couple of lines: data - data.frame(x=rep(c(A,B),5), y=c(NA,NA,rnorm(8))) means - with(data,ave(y, as.character(x), FUN=function(x) mean(x, na.rm=TRUE))) data$y - ifelse(is.na(data$y),means,data$y) I tend to not use intermediate variables when they are only used once in the sequel (though they do often enhance readability). Also, I like using with when I tend to use a data frame more than once (perhaps an overkill in this case). It is a pity that ave doesn't pass its arguments to the FUN, so, the na.rm could be added as just another argument (though I see why it can't easily be done; It would be nice to be able to do that though, like the apply family works). The ifelse call at the end is perhaps an overkill, probably the assignment that Jim proposes is better in that case. Haris Skiadas Department of Mathematics and Computer Science Hanover College On Nov 23, 2007, at 3:37 PM, jim holtman wrote: you could use this instead of the last two statements; don't know if it makes any simpler since it is just combining into one statement what you had in two: data$y[is.na(data$y)] - means[is.na(data$y)] On Nov 23, 2007 1:49 PM, lamack lamack [EMAIL PROTECTED] wrote: Dear all, there is a best way to do the following task? x = rep(c(A,B),5) y = rnorm(10) data = data.frame(x,y) data$y[1:2] = c(NA,NA) means = ave(data$y,as.character(data$x),FUN=function(x)mean (x,na.rm=T)) aux = which(is.na(data$y)) data[aux,y] = means[aux] _ Encontre o que procura com mais eficiência! Instale já a Barra de Ferra[[replacing trailing spam]] [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] updating matrix from a dataframe
Here's one way. new.matrix - my.matrix new.matrix[] - with(my.df, my.value[match(my.matrix, my.id)]) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Milton Cezar Ribeiro Sent: Saturday, 24 November 2007 7:14 AM To: R-help Subject: [R] updating matrix from a dataframe Dear all, I have a matrix which values varying from 1 to 5. I also have a table with a column that match with matrix values (=my.id). my.matrix-matrix(sample(1:5,100,replace=T),nc=10) image(my.matrix) my.df-data.frame(cbind(my.id=1:5,my.value=c(0.1,0.3,0.2,0.9,1))) my.df How can I create a new matrix, where the values of this matrix is my.value when the value of my.matrix match with my.df$my.id I can do it in a for() looping, but my matrix are so big (2000 x 2000) and I need to it about 1,000 times. Thanks in advance, Miltinho para armazenamento! [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Packages - a great resource, but hard to find the right one
This is a strange argument. A good package will get a good review, which may help it to become better. A review of a weak package can point out how it can be fixed. Reviews will not become stale, just because packages are frequently updated by their authors (like some that could be mentioned). These are generally smaller changes. A constructive review will not just be concerned with details, but more with the overall aims of the package and how they are achieved (or not achieved). My argument is that package reviews are a rather strange beast, being a review of something that is neither particularly stable nor remedied soon after the writing of the review. Should the review be written for the package author (perhaps focussing on more technical/internal details) or for the package-using public (focussing on the overall philosophy and capabilities)? This at least seems like something that should be considered when choosing which packages to review. The data available from http://dirk.eddelbuettel.com/cranberries/ (although not currently arranged in the most useful form for that task) would useful to take into account. Why should JSS, one of the few journals for statistical software, review texts? Task views are a good idea, but are general. They give only a brief and subjective overview (and can hardly be expected to do more). The problem that started this thread was a problem finding the relevant R package and I'm not sure how package reviews would help. You would now have 1,000 lengthy reviews to read through instead of 1,000 brief paragraphs? That said, package reviews could clearly be useful in their own right, as peer feedback for authors, and to provide more information for the general public. If you were not an enthusiastic author of many R packages I would start to think that you are afraid of being reviewed, Hadley! What have you against someone studying a package, a group of packages or some other aspect of R in detail? Maybe I had better start reviewers on your packages first... I would be very happy to volunteer my packages for review, and I'd happily review a package for every package of mine that gets reviewed. I have no arguments with the fact that a package review would be a great learning opportunity for the author, but I'm still not sure what it gains the wider community (apart from having better software). Hadley -- http://had.co.nz/ __ R-help@r-project.org 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] ggplo2: fixed extent greater than data?
On 11/23/07, thegeologician [EMAIL PROTECTED] wrote: Hi everyone! I'm digging into ggplot for some while now, I must say it's great! But - as some others have posted before, and hadley knows very well himself - the documentation is lacking some bits... So I have to pose that question directly: I'd like to produce a series of maps with different data on, but exactly the same extent in each plot. Is there a way of switching the automatic extent (to the data of the last layer added) OFF? I'm trying something like: drawOverviewMap-function(){ p2-ggplot(xlimits=c(2,20),ylimits=c(43,50))+coord_map(project=azequalarea) p2-p2+geom_path(data=wa,mapping=aes(x=x,y=y)) p2-p2+geom_point(data=spts,mapping=aes(x=Lon,y=Lat)) return(p2) } If I plot this in cartesian coordinates, it will zoom to the extent of the country boundaries wa, plus some extra space around it (since this is the dataset with the widest range). This extent can be fixed with the limits=... parameter. If I plot it in a map projection, as shown above, it zooms to the extent of the sample localities spts (plus extra space). ;-( I think this is a bug in coord_map, as the limits set on the scales are basically ignored. However, I'm not completely sure how to fix this, as simply subsetting the data to be contained within those bounds may drop off points that are necessary to correctly draw boundaries. Essentially the problem is that the limits are specified on the unprojected data, and I don't know how to apply them to the projected data (and you might not want to do that anyway, given that it could produce non-linear boundaries). Additional question: is there a way of eliminating the extra spacing in a map projection? The expand=c(0,0) parameter seems not to work... This is a bug. The fix will be included in the next version of ggplot, or you can fix the current version by running this code: ScaleContinuous$new - function(., name=NULL, limits=c(NA,NA), breaks=NULL, labels=NULL, variable, trans=identity, expand=c(0.05, 0)) { if (is.null(breaks) !is.null(labels)) stop(Labels can only be specified in conjunction with breaks) .$proto(name=name, .input=variable, .output=variable, limits=limits, .breaks = breaks, .labels = labels, .expand=expand) } -- http://had.co.nz/ __ R-help@r-project.org 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] PCA with NA
The 'factor.model.stat' function (available in the public domain area of http://www.burns-stat.com) fits a principal components factor model to data that can have NAs. You might be able to copy what it does for your purposes. It does depend on there being some variables (columns) that have no missing values. If that doesn't work for you, then I would guess that doing missing value imputation could be another approach. I'm sure there be dragons there -- perhaps others on the list know where they lie. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Birgit Lemcke wrote: Dear all, (Mac OS X 10.4.11, R 2.6.0) I have a quantitative dataset with a lot of Na´s in it. So many, that it is not possible to delete all rows with NA´s and also not possible, to delete all variables with NA´s. Is there a function for a principal component analysis, that can deal with so many NA´s. Thanks in advance Birgit Birgit Lemcke Institut für Systematische Botanik Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 [EMAIL PROTECTED] __ R-help@r-project.org 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@r-project.org 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] Binary data
Hi, can anyone give me some advice on dealing with binary data in R efficiently? Are there any packages with fast binary vector datatypes /or algorithms (e.g. Hamming distance, set covering)? __ R-help@r-project.org 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] matrix (column-wise) multiple regression
Hi there, I am analyzing a table of brain volume measures where each brain area (183 of them) is a column with a label and volume values. I have another table of explanatory variables (age, gender, diagnosis and IntraCranialVol) that I have been using to model the brain volume differences. I have been doing this for single volume measures with no difficulties but I have been unable to apply this across the whole set of brain areas. If I try: lm(y.df, x.df) Error in eval(expr, envir, enclos) : object Left_Lateral_Ventricle not found Left_Lateral_Ventricle happens to be the first column label. Does this not work with tables? I have been unable to find any examples. Would you recommend another approach if I was doing this again. The number of columns (brain areas) depends on the parcellation strategy we use so I will probably be reforming these tables again and again. I would like the simplest way to analyze all the brain areas and find where there are significant differences driven mainly by the diagnosis factor. Thanks in advance for your time. Cheers, -Morgan --- Morgan Hough, D.Phil. Student, Oxford University FMRIB Centre FMRIB, JR Hospital, Headington, Oxford OX3 9DU, UK +44 (0) 1865 222466 (fax 222717) [EMAIL PROTECTED]http://www.fmrib.ox.ac.uk/~mhough __ R-help@r-project.org 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] Packages - a great resource, but hard to find the right one
JH == Johannes Huesing [EMAIL PROTECTED] on Thu, 22 Nov 2007 22:14:57 +0100 writes: JH Antony Unwin [EMAIL PROTECTED] [Thu, Nov 22, JH 2007 at 12:43:07PM CET]: There have been several constructive responses to John Sorkin's comment, but none of them are fully satisfactory. Of course, if you know the name of the function you are looking for, there are lots of ways to search ? provided that everyone calls the function by a name that matches your search. JH I follow the suggestion to Google (mostly restricted by JH site:cran.r-project.org) which gets me quite far. If you think there might be a function, but you don't know the name, then you have to be lucky in how you search. R is a language and the suggestions so far seem to me like dictionary suggestions, whereas maybe what John is looking for is something more like a thesarus. JH This is hard to do in a collaborative effort. One JH analogue is the HOWTOs vs the man pages which I see in JH Linux. Some of the HOWTOs are outstanding, the only JH problem they are facing is that they tend to be out of JH date. R packages are a strange collection, as befits a growing language. There are large packages, small packages, good packages (and not so good packages), personal mixtures of tools in packages, packages to accompany books, superceded packages, unusual packages, everything. Above all there are lots of packages. As the software editor of the Journal of Statistical Software I suggested we should review R packages. JH You mean: prior to submission? No one has shown any enthusiasm for this suggestion, but I think it would help. Any volunteers? JH I am still putting some hope into the R Wiki. To my JH dismay it is also package oriented, JH not method-oriented. I don't think this is true; at least it's not at all intended. I'll *exceptionally* am crossposting this to the R-Wiki Special Interest Group. JH I tend to think that there is a chance JH of controlled documentation if somebody set out an JH infrastructure going beyond the current one. Anything JH like a classification of methods. JH Thing is, I may like to volunteer, but not in the JH here's a package for you to review by week 32 JH way. Rather in the way that I search a package which JH fits my problem. One package lets me down and I'd like JH to know other users and the maintainer about it. The JH other one works black magic and I'd like to drop a JH raving review about it. This needs an infrastructure JH with a low barrier to entry. A wiki is not the worst JH idea if the initial infrastructure is geared at JH addressing problems rather than packages. JH -- Johannes H�sing __ R-help@r-project.org 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] rbinom with computed probability
I don't run into problems doing this: x=rnorm(300) z=rnorm(300) for (i in 1:300){ p[i]-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023 +z[i])); T[i]-rbinom(1,1,p[i]) } hth, Ingmar On 23 Nov 2007, at 10:25, sigalit mangut-leiba wrote: Hello, I have a loop with probability computed from a logistic model like this: for (i in 1:300){ p[i]-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023 +z[i])) x and z generated from normal distribution. I get 300 different probabilities And I want to generate variables from bernulli distribution with P for every observation: T[i]-rbinom(1,1,p[i]) But i get missing values for T. What I'm doing wrong? Thank you, Sigalit. [[alternative HTML version deleted]] __ R-help@r-project.org 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. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256723 [[alternative HTML version deleted]] __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
Hi Peter, In fact, just the beginning of the script is interesting to me. I'm just looking for a simple example : a single box with 3 entries and 3 labels before. Something like the example below but with a label before each entry. I know it is obvious but I don't manage to combine all the examples I saw here http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ I will keep on reading on testing this week-end, but if you can help me, I thank you in advance. Ptit Bleu. main - tktoplevel() tktitle(main) - My Tool filenames - c(toto, tata, titi) N - length(filenames) text - vector(list, N) textField - vector(list, N) labelText - tclVar(This is a text label) label1 - tklabel(tt,text=tclvalue(labelText)) tkconfigure(label1,textvariable=labelText) tkgrid(label1) for (i in 1:N) { text[[i]] - tclVar(filenames[i]) # get a filename (string value) textField[[i]] - tkentry(main,textvariable=text[[i]]) #build a text field tkgrid(textField[[i]]) } -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13909734 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
It's me again (the last message for today - promised). The following script can be very helpful to me (from http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/editboxes.html) but I' like to enter several parameters and have a single 'ok' box to validate all the entered paramaters. Anyone can help me to start ? Thank you, Ptit Bleu. -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13911645 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Packages - a great resource, but hard to find the right one
On 11/23/07, hadley wickham [EMAIL PROTECTED] wrote: Above all there are lots of packages. As the software editor of the Journal of Statistical Software I suggested we should review R packages. No one has shown any enthusiasm for this suggestion, but I think it would help. Any volunteers? There are two common types of review. When reviewing a paper, you are helping the author to make a better paper (and it's initiated by the author). When reviewing a book, you are providing advise on whether someone should make an expensive purchase (and it's initiated by an third party). Reviewing an R package seems somewhat in between. How would you deal with new version of an R package? It seems like there is the potential for reviews to become stale very quickly. Another model to look at would be that of an encyclopedia, something like the existing task views. To me, it would be of more benefit if JSS provided support, peer review, and regular review, for these. Entries would be more of a survey, and could provide links to the literature, much like a chapter of MASS. Yet another option would be to provide a site where users could post reviews and comments, much like the reviews on amazon. Hadley -- http://had.co.nz/ __ R-help@r-project.org 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] matrix (column-wise) multiple regression
Hi Gabor, Thanks for your reply. I have it working now. A couple of follow-ups if I may. I have a shell script parsing the output to find the brain areas where there is a significant effect of diagnosis but its a bit of a hack. I was wondering whether there are R specific tools for parsing/summarizing this kind of output. Can I apply multiple comparison corrections via lm() or do I need to apply something on the model output from lm() after? Thanks again for your time. Cheers, -Morgan Gabor Grothendieck wrote: Perhaps something like this: idx - 1:2 lm(as.matrix(iris[idx]) ~., iris[-idx]) Call: lm(formula = as.matrix(iris[idx]) ~ ., data = iris[-idx]) Coefficients: Sepal.Length Sepal.Width (Intercept) 3.682982 3.048497 Petal.Length0.905946 0.154676 Petal.Width-0.005995 0.623446 Speciesversicolor -1.598362 -1.764104 Speciesvirginica -2.112647 -2.196357 On Nov 23, 2007 10:09 AM, Morgan Hough [EMAIL PROTECTED] wrote: Hi there, I am analyzing a table of brain volume measures where each brain area (183 of them) is a column with a label and volume values. I have another table of explanatory variables (age, gender, diagnosis and IntraCranialVol) that I have been using to model the brain volume differences. I have been doing this for single volume measures with no difficulties but I have been unable to apply this across the whole set of brain areas. If I try: lm(y.df, x.df) Error in eval(expr, envir, enclos) : object Left_Lateral_Ventricle not found Left_Lateral_Ventricle happens to be the first column label. Does this not work with tables? I have been unable to find any examples. Would you recommend another approach if I was doing this again. The number of columns (brain areas) depends on the parcellation strategy we use so I will probably be reforming these tables again and again. I would like the simplest way to analyze all the brain areas and find where there are significant differences driven mainly by the diagnosis factor. Thanks in advance for your time. Cheers, -Morgan --- Morgan Hough, D.Phil. Student, Oxford University FMRIB Centre FMRIB, JR Hospital, Headington, Oxford OX3 9DU, UK +44 (0) 1865 222466 (fax 222717) [EMAIL PROTECTED]http://www.fmrib.ox.ac.uk/~mhough __ R-help@r-project.org 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@r-project.org 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] missing values
you could use this instead of the last two statements; don't know if it makes any simpler since it is just combining into one statement what you had in two: data$y[is.na(data$y)] - means[is.na(data$y)] On Nov 23, 2007 1:49 PM, lamack lamack [EMAIL PROTECTED] wrote: Dear all, there is a best way to do the following task? x = rep(c(A,B),5) y = rnorm(10) data = data.frame(x,y) data$y[1:2] = c(NA,NA) means = ave(data$y,as.character(data$x),FUN=function(x)mean(x,na.rm=T)) aux = which(is.na(data$y)) data[aux,y] = means[aux] _ Encontre o que procura com mais eficiência! Instale já a Barra de Ferra[[replacing trailing spam]] [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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 pleaseeeeeeeee
Hi Clara, Your example works fine on my Apple Mac running R 2.6.0. You should include the output of sessionInfo() so others will know what platorm you are working on. # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- + 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) res.ar-ar(x,aic=TRUE,demean=F) res.ar Call: ar(x = x, aic = TRUE, demean = F) Order selected 0 sigma^2 estimated as 1.482 res.ar-ar(x,aic=TRUE,demean=F) res.ar Call: ar(x = x, aic = TRUE, demean = F) Order selected 0 sigma^2 estimated as 1.482 summary(res.ar) Length Class Mode order 1 -none- numeric ar 0 -none- numeric var.pred1 -none- numeric x.mean 1 -none- numeric aic10 -none- numeric n.used 1 -none- numeric order.max 1 -none- numeric partialacf 9 -none- numeric resid 9 ts numeric method 1 -none- character series 1 -none- character frequency 1 -none- numeric call4 -none- call sessionInfo() R version 2.6.0 (2007-10-03) powerpc-apple-darwin8.10.1 locale: en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] survival_2.34 loaded via a namespace (and not attached): [1] tools_2.6.0 Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: smckinney +at+ bccrc +dot+ ca tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: [EMAIL PROTECTED] on behalf of Clara Cordeiro Sent: Fri 11/23/2007 7:38 AM To: [EMAIL PROTECTED] Subject: [R] help please Dears Sirs During my computational work I encountered unexpected behavior when calling ar function, namely # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used For me it is mysterious why sometimes it works and others it does not, perhaps I am doing something wrong and stupid :-( If anyone had already had this problem could you please tell me how you have solved it? Thank you for your time. Best Regards, Clara Cordeiro [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] updating matrix from a dataframe
Try this (not a lot of error checking -- assumes values 1-5 are in the matrix and in my.id): new.matrix - my.df$my.value[match(my.matrix, my.df$my.id)] dim(new.matrix) - dim(my.matrix) On Nov 23, 2007 4:13 PM, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: Dear all, I have a matrix which values varying from 1 to 5. I also have a table with a column that match with matrix values (=my.id). my.matrix-matrix(sample(1:5,100,replace=T),nc=10) image(my.matrix) my.df-data.frame(cbind(my.id=1:5,my.value=c(0.1,0.3,0.2,0.9,1))) my.df How can I create a new matrix, where the values of this matrix is my.value when the value of my.matrix match with my.df$my.id I can do it in a for() looping, but my matrix are so big (2000 x 2000) and I need to it about 1,000 times. Thanks in advance, Miltinho para armazenamento! [[alternative HTML version deleted]] __ R-help@r-project.org 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@r-project.org 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] Packages - a great resource, but hard to find the right one
R as a whole could benefit from systematic attention. There may be scope for several special issues of JSS. - R overview and philosophy - R penetration and influence, in the statistics community, in machine learning, and in a variety of application areas. - R as a vehicle for fostering communication between researchers in diverse areas. [A great thing about R-help, though nowadays this role is passing across to other lists such as R-sig-ME, is that it facilitates and even forces communication between application area specialists, and between those specialists and statistics professionals. This may be temporary; we may see the R community fragment into diverse communities that focus on their own specialist interests? Scope for a sociological study, perhaps?) - Who is using R?, as reflected in published scientific literature. (I'd like to see a wiki or somesuch where authors are encouraged to give details of published analyses that have used R.) - Where is R headed? How will the shaping of its direction proceed? Will it be a matter of step by step change and improvement, or is it (will it be) possible to lay out in advance an outline of the directions that its future development can be expected to take. - Traps for new (and old) users. - Books and papers on R. - Then onto packages! I guess what may be in order is something like the expansion of a task view into an extended paper. John Maindonald email: [EMAIL PROTECTED] phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. On 23 Nov 2007, at 10:00 PM, [EMAIL PROTECTED] wrote: From: Antony Unwin [EMAIL PROTECTED] Date: 23 November 2007 7:50:52 PM To: [EMAIL PROTECTED] Subject: Re: [R] Packages - a great resource, but hard to find the right one Johannes Hüsing wrote Above all there are lots of packages. As the software editor of the Journal of Statistical Software I suggested we should review R packages. You mean: prior to submission? No. No one has shown any enthusiasm for this suggestion, but I think it would help. Any volunteers? Thing is, I may like to volunteer, but not in the here's a package for you to review by week 32 way. Rather in the way that I search a package which fits my problem. That's what I was hoping for. One package lets me down and I'd like to know other users and the maintainer about it. The other one works black magic and I'd like to drop a raving review about it. This needs an infrastructure with a low barrier to entry. A wiki is not the worst idea if the initial infrastructure is geared at addressing problems rather than packages. We should differentiate between rave reviews of features that just happened to be very useful to someone and reviews of a package as a whole. Both have their place and at the moment we don't have either. If you are willing to review an R package or aspects of R for JSS please let me know. Antony Unwin Professor of Computer-Oriented Statistics and Data Analysis, Mathematics Institute, University of Augsburg, Germany [[alternative HTML version deleted]] __ R-help@r-project.org 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 pleaseeeeeeeee
Hi Clara, I suspect your error is happening because your input data is short (9 observations). In the help for ar() for argument order.max it states order.maxMaximum order (or order) of model to fit. Defaults to 10*log10(N) where N is the number of observations except for method=mle where it is the minimum of this quantity and 12. so perhaps the problem is 10*log10(9) is smaller than 1 and isn't being handled properly (this is just a guess). If I lengthen your data vector to be x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164, -0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1982,3)) I can not trip the error. I filed a bug report. You might try specifying order.max in your function call. If I specify order.max = 1 I can not trip the error. res.ar-ar(x,aic=TRUE,demean=F) res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning message: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning message: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) res.ar-ar(x,aic=TRUE,demean=F, order.max = 1) sessionInfo() R version 2.6.0 (2007-10-03) powerpc-apple-darwin8.10.1 locale: en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] survival_2.34 loaded via a namespace (and not attached): [1] tools_2.6.0 Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: smckinney +at+ bccrc +dot+ ca tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: [EMAIL PROTECTED] on behalf of Clara Cordeiro Sent: Fri 11/23/2007 7:38 AM To: [EMAIL PROTECTED] Subject: [R] help please Dears Sirs During my computational work I encountered unexpected behavior when calling ar function, namely # time series x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,- 1.7783313,0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1980,3)) # ar function res.ar-ar(x,aic=TRUE,demean=F) # call ar again and res.ar-ar(x,aic=TRUE,demean=F) Error in if (order 0) coefs[order, 1:order] else numeric(0) : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In log(var.pred) : NaNs produced 2: In if (order 0) coefs[order, 1:order] else numeric(0) : the condition has length 1 and only the first element will be used For me it is mysterious why sometimes it works and others it does not, perhaps I am doing something wrong and stupid
[R] help in plotting
Dear list, I want to combine several plots in one graph. I did this: plot(a1); plot(a2, add=TRUE); ...plot(a5, add=TRUE) The problem is the more plot we put, the more complex the graph. Is there any way to label each line; or other way just to make sure I know which one which? Thank you for the help, Ilham [[alternative HTML version deleted]] __ R-help@r-project.org 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.