Re: [R] cross-validation in plsr package
Peter Tillmann peter.tillm...@t-online.de writes: can anyone give an example how to use cross-validation in the plsr package. There are examples in the references cited on http://mevik.net/work/software/pls.html I miss to find the number of factors proposed by cross-validation as optimum. The cross-validation in the pls package does not propose a number of factors as optimum, you have to select this yourself. (The reason for this is that there is AFAIK no theoretically founded and widely accepted way of doing this automatically. I'd be happy to learn otherwise.) -- Regards, Bjørn-Helge Mevik __ 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] RExcel + RCOM + Linux
Dear all, does anyone know if it is possible to connect a Windows RExcel instance to a linux R instance? Within Rexcel, I find the option Remote Server Address, but I wonder what the installation procedure on my linux (ubuntu) R looks like (if possible at all)? Thanks Philipp __ 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] Error of Stepwise Regression with number of rows in use has changed: remove missing values?
This solution such as data-na.omit(original database) before you run step() or stepAIC() has some limitations, I think. I reduced the number of data lines, and it enhance R square value. If you have some tips or advices for another solution, I welcome. Kum Urban and Regional Planning, GRI On Sat, Feb 20, 2010 at 5:57 AM, Greg Snow greg.s...@imail.org wrote: Have you considered the implications of that solution? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Kum-Hoe Hwang Sent: Wednesday, February 17, 2010 1:41 AM To: r-help@r-project.org Subject: Re: [R] Error of Stepwise Regression with number of rows in use has changed: remove missing values? I thank those who helped to solve a error in stepwise regression with missing values. Kum * * A good solution that I have tried was Andreas's advice. = Try data-na.omit(original database) before you run step() or stepAIC() On Tue, Feb 16, 2010 at 8:09 PM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2010-02-16 1:24, Kum-Hoe Hwang wrote: Howdy, R Grues I have enjoyed R, but I cannot solve one problem easily. Please help my problem. When I tried the R script, I got the following Error. This error results from input data file exported through a Excel spreadsheet software. Error in step(lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + : number of rows in use has changed: remove missing values? Could you direct me to solve the Error? Thanks in advance, This is a common situation when you use step() on data where the predictors have missing values. A case (row) is included in the model only if all the predictors for that model are non-missing for the case. As you vary which predictors are to be in the model, the included cases will vary, resulting in models based on different data. (Think of your cases as subjects; you want all your models to be based on the same set of subjects.) Finally: (Re-)read the help page and note the 'warning'. -Peter Ehlers ### outputs from R console ### pop- step( + lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + + as.numeric(do.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist), data=borderI.data, na.action = na.omit) + ) Start: AIC=494.27 pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + as.numeric(do.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist) Df Sum of Sq RSS AIC - as.numeric(do.grant) 1 0.71 6622.9 492.28 - as.factor(policy) 1 1.21 6623.4 492.29 - as.numeric(DMZ.dist) 1 1.91 6624.1 492.30 - as.numeric(city.grant) 1 5.07 6627.3 492.36 - as.numeric(nation.grant) 1 11.51 6633.7 492.47 - as.numeric(year) 1 29.58 6651.8 492.80 none 6622.2 494.27 - as.numeric(Seoul.dist) 1 673.22 7295.4 503.79 Step: AIC=492.28 pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric(nation.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist) Df Sum of Sq RSS AIC - as.factor(policy) 1 1.99 6624.9 490.32 - as.numeric(DMZ.dist) 1 2.09 6625.0 490.32 - as.numeric(city.grant) 1 7.18 6630.1 490.41 - as.numeric(nation.grant) 1 20.08 6643.0 490.64 - as.numeric(year) 1 28.89 6651.8 490.80 none 6622.9 492.28 - as.numeric(Seoul.dist) 1 697.46 7320.4 502.20 Step: AIC=490.32 pop.rate ~ as.numeric(year) + as.numeric(nation.grant) + as.numeric(city.grant) + as.numeric(DMZ.dist) + as.numeric(Seoul.dist) Df Sum of Sq RSS AIC - as.numeric(DMZ.dist) 1 2.08 6627.0 488.35 - as.numeric(city.grant) 1 10.65 6635.6 488.51 - as.numeric(nation.grant) 1 31.30 6656.2 488.88 - as.numeric(year) 1 31.44 6656.4 488.88 none 6624.9 490.32 - as.numeric(Seoul.dist) 1 732.88 7357.8 500.80 Step: AIC=488.35 pop.rate ~ as.numeric(year) + as.numeric(nation.grant) + as.numeric(city.grant) + as.numeric(Seoul.dist) Df Sum of Sq RSS AIC - as.numeric(city.grant) 1 9.86 6636.9 486.53 - as.numeric(year) 1 31.42 6658.4 486.92 - as.numeric(nation.grant) 1 33.33 6660.3 486.95 none 6627.0 488.35 - as.numeric(Seoul.dist)
Re: [R] cross-validation in plsr package
Kjaere Bjørn-Helge, can anyone give an example how to use cross-validation in the plsr package. There are examples in the references cited on http://mevik.net/work/software/pls.html I miss to find the number of factors proposed by cross-validation as optimum. The cross-validation in the pls package does not propose a number of factors as optimum, you have to select this yourself. (The reason for this is that there is AFAIK no theoretically founded and widely accepted way of doing this automatically. I'd be happy to learn otherwise.) tusend takk. Vi i NIRS bruker CV for a bestemme antall faktorer i PLS, derfor lurer jeg paa en foreslag fra CV. Men klart vi er bare brukerer ikke statistiker i samenheng med PLS. Hilsen Peter * Espenauer Str. 28, D-34246 Vellmar, Deutschland -- View this message in context: http://n4.nabble.com/cross-validation-in-plsr-package-tp1563815p1564131.html Sent from the R help mailing list archive at Nabble.com. [[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] Odp: new to R Project
Hi r-help-boun...@r-project.org napsal dne 22.02.2010 08:49:01: hi everyone, i am new to R project can anyone please help me by providing documents If you already succeeded to install R it has installed into some directory. Use means of your operating system (maybe Windows?) to find where it is. In a doc folder of R directory (maybe R-2.10.1) you find many documents and If you bother to read at least R Intro you will get answers to many of your questions. I am not sure where you get R. If from CRAN there is also extensive set of various documents together with some books you can buy. And last but not least when starting R you can use help provided with system simply by questioning required function ?plot Regards Petr my goal is using R i have to connect to the database and i have to generate reports. Thanks in advance chinna. -- View this message in context: http://n4.nabble.com/new-to-R-Project- tp1564104p1564104.html 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. __ 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] how to generate graph from dataframe?
chinna wrote: I connected to database and i am accessing the tables but i dont know how to generate graphs from the database tables. can anyone please help me i am new to R project Hi, Take a look at the plot() command. Or you can have a look at the lattice or ggplot2 packages. The book R graphics by Paul Murrel is a good book on R graphics. cheers, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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] plotrix 2.8-3
Hi all, I'm announcing this version of plotrix because I have made a couple of changes that will affect users. Although the function that used to be known as hierobarp is fairly new, there may be some users who are surprised when they find that it has changed its name to barNest. I will probably rename the two functions hierobarp.svymean and hierobarp.svyprop in the next version to barNest.* as well. The other major changes are to the pyramid.plot function. A recent exchange with a user led to new options to use different category labels for the left and right bars and to place the category labels and values outside the bars. So there are a couple of new arguments and options. The help page and examples should make these clear. If not, you all know my email address. Have fun. 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.
[R] Single character input without Enter
How do I wait for a single character input without terminating Enter? Following Brian Ripley on http://markmail.org/message/ptmbkhdfnpnf5zcd In general R does not have a character-by-character interface with a keyboard. 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] bug in R 2.10.1 html help
I'm running R 2.10.1 on a GNU/Linux Debian Squeeze (testing) I type : help.start() I get : starting httpd help server ... Terminé. Si 'xdg-open' est déjà lancé, il ne sera pas relancé, et vous devez passer à sa fenêtre. Sinon, soyez patient... I think the translation is : If '/usr/bin/xdg-open' is already running, it is *not* restarted, and you must switch to its window. Otherwise, be patient ... Iceweasel starts and I get the page http://127.0.0.1:28025/doc/html/index.html Now I type : ?plot It does not opens the help page in Iceweasel. It starts the R documentation in my terminal. To fix the problem : Create a .Rprofile file in your home/'user' directory containing the following command : options(help_type=html) I hope it will help. Tristan __ 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] how do I calculate means or cov matrix for multivariate groups
Hello, Having the matrix d d value value2 class 1 1 1 x 2 2 2 x 3 3 3 x 4 4 2 x 5 5 1 y 6 11 3 y 7 12 4 z 8 13 5 z 9 14 6 z 1015 7 z I want to calculate the means and cov matrix for groups x,y,z. I know how to do it the long way. I tried to use tapply and kmeans but no good results. (tapply is a good solution for only 1 variable) Thank you Bogdan -- View this message in context: http://n4.nabble.com/how-do-I-calculate-means-or-cov-matrix-for-multivariate-groups-tp1564157p1564157.html 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] plotrix 2.8-3
Hi Jim, I just went thorough the demo(plotrix) , what amazing work you have done there, thank you! Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Mon, Feb 22, 2010 at 11:08 AM, Jim Lemon j...@bitwrit.com.au wrote: Hi all, I'm announcing this version of plotrix because I have made a couple of changes that will affect users. Although the function that used to be known as hierobarp is fairly new, there may be some users who are surprised when they find that it has changed its name to barNest. I will probably rename the two functions hierobarp.svymean and hierobarp.svyprop in the next version to barNest.* as well. The other major changes are to the pyramid.plot function. A recent exchange with a user led to new options to use different category labels for the left and right bars and to place the category labels and values outside the bars. So there are a couple of new arguments and options. The help page and examples should make these clear. If not, you all know my email address. Have fun. 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. [[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] how do I calculate means or cov matrix for multivariate groups
Hi: Here are three ways, but there are others: # (1) # package doBy: library(doBy) summaryBy(value + value2 ~ class, data = df) class value.mean value2.mean 1 x2.5 2.0 2 y8.0 2.0 3 z 13.5 5.5 # (2) aggregate(): with(df, aggregate(list(val1 = value, val2 = value2), list(class), FUN = mean)) Group.1 val1 val2 1 x 2.5 2.0 2 y 8.0 2.0 3 z 13.5 5.5 # plyr solution library(plyr) ddply(df, .(class), summarise, val1 = mean(value), val2 = mean(value2)) class val1 val2 1 x 2.5 2.0 2 y 8.0 2.0 3 z 13.5 5.5 HTH, Dennis On Mon, Feb 22, 2010 at 1:13 AM, mirauta bmira...@yahoo.com wrote: Hello, Having the matrix d d value value2 class 1 1 1 x 2 2 2 x 3 3 3 x 4 4 2 x 5 5 1 y 6 11 3 y 7 12 4 z 8 13 5 z 9 14 6 z 1015 7 z I want to calculate the means and cov matrix for groups x,y,z. I know how to do it the long way. I tried to use tapply and kmeans but no good results. (tapply is a good solution for only 1 variable) Thank you Bogdan -- View this message in context: http://n4.nabble.com/how-do-I-calculate-means-or-cov-matrix-for-multivariate-groups-tp1564157p1564157.html 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. [[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] rownames cannot allocate vector of size
Hi, On R 2.10.1 for Windows, when I do the following to duplicate the structure of a large numeric matrix called matrix1: matrix2 - matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1)) and then rownames(matrix2) - rownames(matrix1) I get a cannot allocate vector of size xxMb error but if I instead do: rnames - list() rnames - rownames(matrix1) matrix2 - matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1),dimnames=rnames) I get no error. Of course both approaches work in R on Unix without memory limits. But I'm intrigued about the apaprent difference in memory usage/allocation for the two above approaches. Is there any explanation for this difference in behaviour? thanks Tony __ 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] rownames cannot allocate vector of size
assigning rownames (after the object is created) triggers a copy of the object... if you assign the rownames at creation time, no extra copies... b On Mon, Feb 22, 2010 at 9:46 AM, Larson, TR t...@york.ac.uk wrote: Hi, On R 2.10.1 for Windows, when I do the following to duplicate the structure of a large numeric matrix called matrix1: matrix2 - matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1)) and then rownames(matrix2) - rownames(matrix1) I get a cannot allocate vector of size xxMb error but if I instead do: rnames - list() rnames - rownames(matrix1) matrix2 - matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1),dimnames=rnames) I get no error. Of course both approaches work in R on Unix without memory limits. But I'm intrigued about the apaprent difference in memory usage/allocation for the two above approaches. Is there any explanation for this difference in behaviour? thanks Tony __ 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] (Somewhat) broken EPS files produced
Hi Wartan, Not really an answer to your specific problem, but you could try to use pdf instead of eps, in combination ofcourse with pdflatex. I've never had problems with pdf nad Sweave. If you need to use eps, than my reply is of no help to you :). cheers, Paul Wartan Hachaturow wrote: Hello. I'm writing some simple text using sweave, and faced a strange problem with eps files produced for my plots (one example attached). Individual eps files are interpreted by ghostscript just fine, and show up without errors. But once I try to include them into main LaTeX/Sweave document (using regular \includegraphics, produced by Sweave), ghostscript gives me this error on those files: Error: /undefinedresult in --stringwidth-- Operand stack: (600) 0.5 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop 1755 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- Dictionary stack: --dict:1157/1684(ro)(G)-- --dict:0/20(G)-- --dict:82/200(L)-- --dict:178/300(L)-- --dict:91/200(L)-- Current allocation mode is local Current file position is 207944 GPL Ghostscript 8.71: Unrecoverable error, exit code 1 What might be the problem? P.S. I get exactly the same behavior on Debian/sid and OS X. __ 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. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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] how do I calculate means or cov matrix for multivariate groups
Thanks, These functions solve 1 problem ( the mean). I tried to use them also for the cov matrix but I didn't succed. Is there any way to calculate the cov matrix for groups? -- View this message in context: http://n4.nabble.com/how-do-I-calculate-means-or-cov-matrix-for-multivariate-groups-tp1564157p1564234.html 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.
[R] Generating reports from database
MY REQUIREMENT: I have a database and i want to connect to the database through R Project and using the tables from the database i need to generate the reports. can anyone plese tell me whether this is possible with R project or not. Thanks in advance Chinna. -- View this message in context: http://n4.nabble.com/Generating-reports-from-database-tp1564238p1564238.html 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] Generating reports from database
List Requirements: PLEASE do read the posting guide [1]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. With that said.. We need a *bit* more information What database are you connecting to? MySQL? MSSQL? Are you on Windows? Linux? [2]https://stat.ethz.ch/mailman/listinfo/r-sig-db With a lil bit of Googling, I found: [3]http://www.statmethods.net/input/dbinterface.html which highlights RODBC and the other access methods for retrieving data from DBMS's for use in R. I personally use RODBC and RMySQL for working with data. Regards, -cedrick On 2/22/2010 5:38 AM, chinna wrote: MY REQUIREMENT: I have a database and i want to connect to the database through R Project and using the tables from the database i need to generate the reports. can anyone plese tell me whether this is possible with R project or not. Thanks in advance Chinna. References 1. http://www.R-project.org/posting-guide.html 2. https://stat.ethz.ch/mailman/listinfo/r-sig-db 3. http://www.statmethods.net/input/dbinterface.html __ 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] Generating reports from database
we r using teradata database and through R Project we have to access tables from teradata database and we need to generate graphs using that dataand also we need forecasted results of that data ...can please tell me the possible ways. Thanks in advance Regards Chinna -- View this message in context: http://n4.nabble.com/Generating-reports-from-database-tp1564238p1564280.html 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.
[R] cmdscale error message - k' must be in {1, 2, .. n - 1}
Hi, I got the error message: Error in cmdscale(1 - similarity, k = 1) : 'k' must be in {1, 2, .. n - 1} It turned out that similarity was just a scalar and therefore n-1 = 0 :( Maybe the error message could be improved. Bset Sigbert __ 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] BMDP and SAS (was R in clinical trials)
Once I suggested to BMDP to introduce a module-statement that would direct the syntax to the specified module (1L, 2L, ...), so that all syntax could reside in one job, but they did not like that idea. Heinz At 14:55 19.02.2010, Terry Therneau wrote: I used both BMDP and SAS in my earlier years, side by side. At that time the BMDP statistical methods were much more mature and comprehensive: we treated them as the standard when the two packages disagreed. (It was a BMDP manual that clearly explained to me what the hypothesis of Yate's weighted mean test is, something SAS decided to call type III and eternally obfuscate by defining it in terms of a computational algorithm). The BMDP programs had reasonable facilities for data manipulation --- not as strong as SAS but reasonable. However each analysis program was a separate run, so you had to cut and paste your block of setup code onto the front of each program's instructions. Cut and paste with a keypunch machine is not quite as simple as with a mouse, if you needed a listing, some frequencies, 2-3 regressions, ... it got rather tedious. Terry Therneau __ 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] Post-Hoc tests for Friedman Test?
Hello David, I wanted to thank you for pointing to this code for performing posthoc friedman test. I just used this example to create a function to perform this test (and also added some illustrative flexible plots to the mix), here: http://www.r-statistics.com/2010/02/post-hoc-analysis-for-friedmans-test-r-code/ Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Mon, Sep 21, 2009 at 3:35 AM, David Winsemius dwinsem...@comcast.netwrote: On Sep 20, 2009, at 9:05 PM, j...@terraspark.com wrote: Hi there all, This is my first post to the list and I'll first say a few things: - R is great! - The archives of this list have helped me solve all of my problems/questions so far - I only know enough statistics to be dangerous I'm looking for a way to do post-hoc tests for the Friedman test. I have a dataset from a within-subjects design with 5 conditions where some of the dependent variables are ordinal, resulting from (summed) likert-scaled questionnaire data. From what I've read, I could use a wilcox.test on pairs of conditions and adjust the p level, but is there something in R that does a better job/automates this. I've seen references to the npmc package but that doesn't seem to do what I'm looking for, because it only accepts a data frame with two columns - i.e. there's no way to specify grouping/subject identifiers. Thanks, There is a worked example in the coin package for using a permutation test to examine differences after a Friedman test. The authors, Hothorn , Hornik , van de Wiel, and Zeileis, call this method the Wilcoxon-Nemenyi-McDonald-Thompson test and cite: Hollander Wolfe (1999), page 295 http://finzi.psych.upenn.edu/R/library/coin/html/SymmetryTests.html -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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. [[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] how do I calculate means or cov matrix for multivariate groups
Try this: lapply(list(mean, cov), by, data = d[,1:2], INDICES = d[,'class']) On Mon, Feb 22, 2010 at 6:13 AM, mirauta bmira...@yahoo.com wrote: Hello, Having the matrix d d value value2 class 1 1 1 x 2 2 2 x 3 3 3 x 4 4 2 x 5 5 1 y 6 11 3 y 7 12 4 z 8 13 5 z 9 14 6 z 10 15 7 z I want to calculate the means and cov matrix for groups x,y,z. I know how to do it the long way. I tried to use tapply and kmeans but no good results. (tapply is a good solution for only 1 variable) Thank you Bogdan -- View this message in context: http://n4.nabble.com/how-do-I-calculate-means-or-cov-matrix-for-multivariate-groups-tp1564157p1564157.html 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] change email subscription
Dear R team, As this is a university email address with very small inbox limit, can I please change my R email subscription to another email address instead of this one? My new email address is wendy2.q...@gmail.com. I have change my email in my profile, but seems that does not change my subscription. Thank you. Wendy [[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] Raster table: how separate lines with the same value (count 1)
Dear all, I intend to do some statistics with my raster table, like correlations or regression analysis. For that, I need that each pixel be in one line, that is, there is no count 1. So, all columns should have the same number of lines, when I compare (combine) rasters. I'd like to know if there is a way to create lines and copy the values of the lines, when count is 1. So, even though values were the same, and count twice (or more), I need that those values be repeated in different lines. Example: My raster table now: COUNT_Forest KTOTAL500X FOREST_BUF 1 28006 50 1 27953 50 1 12726 150 2 12725 1 1 12722 50 1 76001 2 586 1000 10 5861 My new raster table (the ideal one): COUNT_Forest KTOTAL500X FOREST_BUF 1 28006 50 1 27953 50 1 12726 150 1 12725 1 1 12725 1 1 12722 50 1 76001 1 586 1000 1 586 1000 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 After that, I'd like to join tables using KTOTAL500X column. How can I do that? Thank you very much. Best regards Simone. -- Simone R. Freitas Universidade Federal do ABC (UFABC) Centro de Ciências Naturais e Humanas (CCNH) R. Catequese, 242 Bairro Jardim 09090-400 - Santo André - SP Brasil http://srfreitas.webs.com/ [[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] tests for measures of influence in regression
I don't think this information can be found in the documentation, but you can always just check the actual influence.measures() and print.infl() code to find out. Most importantly, influence.measures() incldues the following code: function (model) { is.influential - function(infmat, n) { k - ncol(infmat) - 4 if (n = k) stop(too few cases, n k) absmat - abs(infmat) result - cbind(absmat[, 1L:k] 1, absmat[, k + 1] 3 * sqrt(k/(n - k)), abs(1 - infmat[, k + 2]) (3 * k)/(n - k), pf(infmat[, k + 3], k, n - k) 0.5, infmat[, k + 4] (3 * k)/n) dimnames(result) - dimnames(infmat) result } ... infmat - cbind(dfbetas, dffit = dffits, cov.r = cov.ratio, cook.d = cooks.d, hat = h) ... is.inf - is.influential(infmat, sum(h 0)) ... } So, a case is flagged if: - any of its absolute dfbetas values are larger than 1, or - its absolute dffits value is larger than 3*sqrt(k/(n-k)), or - abs(1 - covratio) is larger than 3*k/(n-k), or - its Cook's distance is larger than the 50% percentile of an F-distributio with k and n-k degrees of freedom, or - its hatvalue is larger than 3*k/n, where k denotes the number of model coefficients (e.g., k = 2 for simple regression with the intercept included in the model). Best, -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +31 (43) 388-2277 School for Public Health and Primary Care Office Location: Maastricht University, P.O. Box 616 Room B2.01 (second floor) 6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck) Original Message From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Frank Tamborello Sent: Monday, February 22, 2010 00:39 To: r-help@r-project.org Subject: [R] tests for measures of influence in regression influence.measures gives several measures of influence for each observation (Cook's Distance, etc) and actually flags observations that it determines are influential by any of the measures. Looks good! But how does it discriminate between the influential and non- influential observations by each of the measures? Like does it do a Bonferroni-corrected t on the residuals identified by the influence measures or some other test? Cheers, Frank Tamborello, PhD W. M. Keck Postdoctoral Fellow School of Health Information Sciences University of Texas Health Science Center, Houston [[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] new to R Project
chinna wrote: hi everyone, i am new to R project can anyone please help me by providing documents my goal is using R i have to connect to the database and i have to generate reports. Thanks in advance chinna. R is a complex program. If you can't work out how to find the documentation, I doubt you will be able to use R. Dave __ 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] (Somewhat) broken EPS files produced
On Feb 21, 2010, at 10:48 PM, Wartan Hachaturow wrote: Hello. I'm writing some simple text using sweave, and faced a strange problem with eps files produced for my plots (one example attached). Individual eps files are interpreted by ghostscript just fine, and show up without errors. But once I try to include them into main LaTeX/Sweave document (using regular \includegraphics, produced by Sweave), ghostscript gives me this error on those files: Error: /undefinedresult in --stringwidth-- Operand stack: (600) 0.5 Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop 1755 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- Dictionary stack: --dict:1157/1684(ro)(G)-- --dict:0/20(G)-- --dict:82/200(L)-- --dict:178/300(L)-- --dict:91/200(L)-- Current allocation mode is local Current file position is 207944 GPL Ghostscript 8.71: Unrecoverable error, exit code 1 What might be the problem? P.S. I get exactly the same behavior on Debian/sid and OS X. It would be helpful to attach the .Rnw SWeave file (if small) or post it someplace that we can look at it, along with any data to replicate your process. I took the EPS file that you provided here, included it in a simple tex file (test.tex) which contains the following: \documentclass{article} \usepackage{graphicx} \begin{document} \begin{figure} \centering \includegraphics[width=0.8\textwidth]{Report-fig1} \caption{Test Figure} \end{figure} \end{document} I then processed the file using MacTeX (TeXLive on Snow Leopard) with: latex test.tex dvips test -o test.ps ps2pdf test.ps test.pdf The result is attached here and there were no problems. I would say that perhaps your GS installation might be corrupted, but that seems less likely on two separate platforms, unless your installation process is common and faulty. Alternatively, there is a problem with your .Rnw file content, since that would be common on both. That does not give you a specific resolution, but at least suggests that the EPS generation process via SWeave is not at fault. Regards, Marc Schwartz test.pdf Description: Adobe PDF document __ 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] R language syntax highlighting file of VIM
I sent an email to current maintainer Vaidotas Zemlys 2 weeks ago but no response yet. Here is a mod, it's an unfinished version. Please have a look, thanks. __ 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] Alternatives to linear regression with multiple variables
I wonder if someone can give some pointers on alternatives to linear regression (e.g. Loess) when dealing with multiple variables. Taking any simple table with three variables, you can very easily get the intercept and coefficients with: summary(lm(read_table)) For obvious reasons, the coefficients in a multiple regression are quite different from what you get if you calculate regressions for the single variables separately. Alternative approaches such as Loess seem straightforward when you have only one variable, and have the advantage that they can cope even if the relationship is not linear. My question is: how can you extend a flexible approach like Loess to a multi-variable scenario? I assume that any non-parametric calculation becomes very resource-intensive very quickly. Can anyone suggest alternatives (preferably R-based) that cope with multiple variables, even when the relationship (linear, etc) is not known in advance? Thanks, Guy -- View this message in context: http://n4.nabble.com/Alternatives-to-linear-regression-with-multiple-variables-tp1564370p1564370.html 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] new to R Project
Hi! You should first go to the home page of the R project and read the manuals available there (and there are a lot). When you'll understand how R works, read the posting guide and ask specific questions. I don't think you'll get answers if you have such imprecise questions. Ivan Le 2/22/2010 14:07, Dr. David Kirkby a écrit : chinna wrote: hi everyone, i am new to R project can anyone please help me by providing documents my goal is using R i have to connect to the database and i have to generate reports. Thanks in advance chinna. R is a complex program. If you can't work out how to find the documentation, I doubt you will be able to use R. Dave __ 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] Fortune candidate! Re: new to R Project
One vote goes to Dave's answer! You made (saved) my day detlef On Mon, 22 Feb 2010 13:07:23 + Dr. David Kirkby david.kir...@onetel.net wrote: chinna wrote: hi everyone, i am new to R project can anyone please help me by providing documents my goal is using R i have to connect to the database and i have to generate reports. Thanks in advance chinna. R is a complex program. If you can't work out how to find the documentation, I doubt you will be able to use R. Dave __ 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] odfWeave - merged table cells, and adding information like totals and p-values
The devel version of odfWeave has some multicolumn capabilities. these were added by Patrick Lenon and Zekai Otles recently, but I have not had a chance to test it out. You can go to: https://r-forge.r-project.org/projects/odfweave/ and download the version there if you want to evaluate the new arguments to odfTable. Thanks, Max On Sun, Feb 21, 2010 at 11:35 AM, Polwart Calum (County Durham and Darlington NHS Foundation Trust) calum.polw...@nhs.net wrote: I'm hoping I'm missing some (probably fundamental basic process) which might make my life easier! Lets assume I have a 3 column table summarizing results from a trial from three arms (Arm A, B and C). For each arm there will be a number of pieces of information to report. The simplest example might be to compare this to the demographic comparisons often seen in clinical traisl where you are setting out to prove that your randomization produced similar populations So I might have a table like this: --- A B C --- Male 50 50 50 Female 49 51 50 Age 65 30 29 31 Age 65+ 69 72 69 --- I've got a matrix with that data in it which I'm passing to odfWeave's table function. I just want to check a few basic things. Here's some short code which will create the matrix: groups = c(A,B,C) factors = c(Male,Female, Age lt; 65, Age 65+) mydata = matrix (c(50,49,30,69,50,51,29,72,50,50,31,69), nrow=4, dimnames = list(factors,groups)) - Is there anyway to add a merged cell above ABC which would say Group? - If I want to total column I can do that using: total=as.numeric() for (fact in 1:length(factors)) { total[fact]=sum(mydata[fact,]) } mydata = cbind(mydata,total) Is there an easier way? - Now lets say i want to do a chi-squ test between the ages differences in Gp A and Gp B I run chisq.test(mydata[3:4,1:2]) What I really want is the p-value and I'll want to repeat that for Gp A vs Gp C. If I was just using R I'd simply print those and then add them to my table by hand. But I'm trying to be smart and use odfWeave. Now I know I can put them in my caption but I'd probably have added them as an extra row in my table or added it in brackets similar to the SDs/ORs and CIs shown in this example http://www.bmj.com/cgi/content-nw/full/340/feb05_1/c199/TBL2 depending which was more appropriate. - Is there an easy way to do anything like this? I'm thinking that we often put crude numbers in and (%) in brackets, or CIs etc - so my exported table would not ideally be pure numbers. - As a p value usually links two columns I might have expected to use a merged cell which again brings me back to my original question ;-) Thanks Calum Polwart BSc(Hons) MSc MRPharmS SP IP Network Pharmacist - North of England Cancer Network and Pharmacy Clinical Team Manager (Cancer Aseptic Services) - County Durham Darlington NHS Foundation Trust This message may contain confidential information. If ...{{dropped:16}} __ 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] cross-validation in plsr package
The cross-validation in the pls package does not propose a number of factors as optimum, you have to select this yourself. (The reason for this is that there is AFAIK no theoretically founded and widely accepted way of doing this automatically. I'd be happy to learn otherwise.) The caret package has a wrapper for pls and multiple resampling methods (cv, bootstrap, repeated test/train splits etc). There are a few modules that can be used for automatically determining the optimal number of components. I agree that there is no uniformly best technique. The only thing that I know of that is widely accepted is the 1 stardard error rule in CART. In this case, that would mean that you find the value of ncomp with the smallest error and choose the final ncomp value based of the smallest value within one standard error of the optimal. caret can do this or use any other rule that you think is appropriate. Thanks, Max __ 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] Fortune candidate! Re: new to R Project
Thanks for the pointer, Detlef, added to the devel-version on R-Forge. Z On Mon, 22 Feb 2010, Detlef Steuer wrote: One vote goes to Dave's answer! You made (saved) my day detlef On Mon, 22 Feb 2010 13:07:23 + Dr. David Kirkby david.kir...@onetel.net wrote: chinna wrote: hi everyone, i am new to R project can anyone please help me by providing documents my goal is using R i have to connect to the database and i have to generate reports. Thanks in advance chinna. R is a complex program. If you can't work out how to find the documentation, I doubt you will be able to use R. Dave __ 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-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] Generating reports from database
Chinna, I found that there are ODBC drivers for the teradatabase available, so with the use of RODBC you should be able to connect to your database. This will allow you to extract your data into an R dataframe, and make reports of it. But you noticed in another thread that you are an R beginner, so maybe you should sit down and take the time to learn how to work with R, read the manuals and docs! R is very powerfull and flexible, but is known for it's rather steep learning curve. And connecting to a db, extracting the data you want, analyse this and put in a report, with graphs isn't that hard, but if you are starting out, you have to accept that you will have to learn the basics. So go on, play with R and your data, and ask when you are stuck and can't figure it out without reading the manuals, help lists, ... Bart -- View this message in context: http://n4.nabble.com/Generating-reports-from-database-tp1564238p1564443.html 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.
[R] Rounding like in finances
Hello, I need to have a kaufmaennisches Runden function. Is there already something like that? It means: rounding up the 5, instead of rounding it down. So, 245.455 would give 245.46 I found no option for this. Maybe there is a package for it? Oliver __ 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] Rounding like in finances
round(245.455, 2) ? On Mon, Feb 22, 2010 at 11:06 AM, Oliver oli...@first.in-berlin.de wrote: Hello, I need to have a kaufmaennisches Runden function. Is there already something like that? It means: rounding up the 5, instead of rounding it down. So, 245.455 would give 245.46 I found no option for this. Maybe there is a package for it? Oliver __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] Extract information from S4 object
The function prediction() returns this: Formal class 'performance' [package ROCR] with 6 slots ..@ x.name : chr Cutoff ..@ y.name : chr Accuracy ..@ alpha.name : chr none ..@ x.values:List of 1 .. ..$ : Named num [1:89933] Inf 2.23 2.22 2.17 2.16 ... .. .. ..- attr(*, names)= chr [1:89933] 36477 56800 41667 ... ..@ y.values:List of 1 .. ..$ : num [1:89933] 0.5 0.5 0.5 0.5 0.5 ... ..@ alpha.values: list() Now, since I want to match each prediction with its original case, I need to extract the names, i.e. the information in - attr(*, names)= chr [1:89933] 36477 56800 41667 ... so I can use it with a simple datafile[names,] query. How do I get these names in plain number formats? __ 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] Raster table: how separate lines with the same value (count 1)
On Feb 22, 2010, at 6:40 AM, Simone R. Freitas wrote: Dear all, I intend to do some statistics with my raster table, like correlations or regression analysis. For that, I need that each pixel be in one line, that is, there is no count 1. So, all columns should have the same number of lines, when I compare (combine) rasters. I'd like to know if there is a way to create lines and copy the values of the lines, when count is 1. So, even though values were the same, and count twice (or more), I need that those values be repeated in different lines. Example: My raster table now: COUNT_Forest KTOTAL500X FOREST_BUF 1 28006 50 1 27953 50 1 12726 150 2 12725 1 1 12722 50 1 76001 2 586 1000 10 5861 My new raster table (the ideal one): COUNT_Forest KTOTAL500X FOREST_BUF 1 28006 50 1 27953 50 1 12726 150 1 12725 1 1 12725 1 1 12722 50 1 76001 1 586 1000 1 586 1000 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 1 5861 dta[ rep(row(dta)[ ,1], dta$COUNT_Forest), ] COUNT_Forest KTOTAL500X FOREST_BUF 1 1 28006 50 2 1 27953 50 3 1 12726150 4 2 12725 1 4.12 12725 1 5 1 12722 50 6 1 7600 1 7 2586 1000 7.12586 1000 8 10586 1 8.1 10586 1 8.2 10586 1 8.3 10586 1 8.4 10586 1 8.5 10586 1 8.6 10586 1 8.7 10586 1 8.8 10586 1 8.9 10586 1 After that, I'd like to join tables using KTOTAL500X column. How can I do that? ?merge Thank you very much. Best regards Simone. -- Simone R. Freitas Universidade Federal do ABC (UFABC) Centro de Ciências Naturais e Humanas (CCNH) R. Catequese, 242 Bairro Jardim 09090-400 - Santo André - SP Brasil http://srfreitas.webs.com/ [[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] machine precision problem
On Feb 21, 2010, at 1:37 PM, wendy wrote: Dear all, I am analysising a set of gene expression data using multiplicative Gaussian Kernel function. I calculated the kernels between two gene sets with 2 genes for each set. The kernels are less than 1, therefore the product of the kernels is out of the minimum precision in R. I wonder if there is a way to lowering the minimum double precision in R. I am using R version 2.10.1. Have you considered other strategies, e.g. summing the logs and exponentiating? Your proposed solution would involve rewriting R. There is no switch to throw that would increase the width of doubles. -- David __ 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] Normality in split-plot design
Hi, I would like to test the normality of errors in an split-plot design using R. I used the following program: anava = aov(ganhos ~ Blocos + Trat*Supl + Error(Blocos/Trat)) summary(anava) bartlett.test(ganhos, Trat) bartlett.test(ganhos, Supl) How can I test the normality of the errors? Thanks, -- Silvano Cesar da Costa Departamento de Estatística Universidade Estadual de Londrina Fone: 3371-4346 __ 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] Extract information from S4 object
Try this: names(o...@x.values) On Mon, Feb 22, 2010 at 11:05 AM, Jay josip.2...@gmail.com wrote: The function prediction() returns this: Formal class 'performance' [package ROCR] with 6 slots ..@ x.name : chr Cutoff ..@ y.name : chr Accuracy ..@ alpha.name : chr none ..@ x.values :List of 1 .. ..$ : Named num [1:89933] Inf 2.23 2.22 2.17 2.16 ... .. .. ..- attr(*, names)= chr [1:89933] 36477 56800 41667 ... ..@ y.values :List of 1 .. ..$ : num [1:89933] 0.5 0.5 0.5 0.5 0.5 ... ..@ alpha.values: list() Now, since I want to match each prediction with its original case, I need to extract the names, i.e. the information in - attr(*, names)= chr [1:89933] 36477 56800 41667 ... so I can use it with a simple datafile[names,] query. How do I get these names in plain number formats? __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] Rounding like in finances
Oh strange... round(108.275 , 2) [1] 108.28 round(208.275 , 2) [1] 208.28 round(308.275 , 2) [1] 308.27 looks not like what one should expect... R version 2.9.2 (2009-08-24) Ciao, Oliver __ 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] Extract information from S4 object
On Feb 22, 2010, at 8:05 AM, Jay wrote: The function prediction() returns this: Formal class 'performance' [package ROCR] with 6 slots ..@ x.name : chr Cutoff ..@ y.name : chr Accuracy ..@ alpha.name : chr none ..@ x.values:List of 1 .. ..$ : Named num [1:89933] Inf 2.23 2.22 2.17 2.16 ... .. .. ..- attr(*, names)= chr [1:89933] 36477 56800 41667 ... ..@ y.values:List of 1 .. ..$ : num [1:89933] 0.5 0.5 0.5 0.5 0.5 ... ..@ alpha.values: list() Now, since I want to match each prediction with its original case, I need to extract the names, i.e. the information in - attr(*, names)= chr [1:89933] 36477 56800 41667 ... so I can use it with a simple datafile[names,] query. How do I get these names in plain number formats? Not sure what you mean by plain number formats but this should get you a vector of names assuming the prediction object is named predobject: names( predobj...@x.values ) If you wanted them as.numeric, then that is the name of the appropriate function. -- David __ 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] Rounding like in finances
On 22/02/2010 9:06 AM, Oliver wrote: Hello, I need to have a kaufmaennisches Runden function. Is there already something like that? It means: rounding up the 5, instead of rounding it down. So, 245.455 would give 245.46 I found no option for this. Maybe there is a package for it? This is a little tricky, because 245.455 is not a representable number in base R. If x is represented as x+epsilon, it will tend to round up, if it is x-epsilon, it will tend to round down. (I say tend to because R tries to do banker's rounding, and the math routines attempt to do exact calculations even when they are not really possible, so it is hard to predict exactly what will happen for a particular number.) There are packages for handling rational numbers that could handle it exactly; I don't know how flexible they are about rounding. Duncan Murdoch __ 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] Rounding like in finances
same result with R2.10.1 on Windows... Le 2/22/2010 15:34, Oliver a écrit : Oh strange... round(108.275 , 2) [1] 108.28 round(208.275 , 2) [1] 208.28 round(308.275 , 2) [1] 308.27 looks not like what one should expect... R version 2.9.2 (2009-08-24) Ciao, Oliver __ 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. -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Institut und Museum Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php __ 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] change email subscription
Hi, On Mon, Feb 22, 2010 at 7:27 AM, Wendy Qiao wendy.q...@utoronto.ca wrote: Dear R team, As this is a university email address with very small inbox limit, can I please change my R email subscription to another email address instead of this one? My new email address is wendy2.q...@gmail.com. I have change my email in my profile, but seems that does not change my subscription. I think you'll just have to unsubscribe from the list with your current address, then resubscribe with your desired one. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ 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] Rounding like in finances
Hello, which packages are you talking about? And... are thoise packages using integer-based calculations? __ 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] svm
Hi Amy, On Sat, Feb 20, 2010 at 9:29 PM, Amy Hessen amy_4_5...@hotmail.com wrote: Hi , Could you please help me in this question:? After trying this code: library(e1071) mydata - as.matrix(read.delim(iris.txt)) train.x - mydata[,-1] train.y - mydata[,1] mymodel - svm(train.x, train.y, cross=3, type=C-classification) I receive this error: Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric I put the class label in the first column. I think you would be able to find out where many of your problems lie if you try to provide a reproducible example we can use to test: meaning, something I can just copy from your email and paste into my R workspace that would reproduce your problem. The error is telling you that something is expecting x to be numeric, and it's not. So the question is, what isn't numeric? I guess the answer must be in one of the two arguments you supply to the svm function, so can you please check to see what type of arguments you are passing into your function? You can do that by running these R commands? R is(mydata) R is(train.x) R is(train.y) What do you get from that? -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ 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] Count between interval
Hi all, I take a simple dataset like this: -1.3 1 -1.5 -1 1.5 -2.5 3 -0.5 Now I want to count how many values there are between -2 and 2. The answer here would be 6. Can anyone do this with R? Thank you in advance. Gr. Bosken -- View this message in context: http://n4.nabble.com/Count-between-interval-tp1564537p1564537.html 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] Accessing values of a matrix
Hello Sarah, thanks for answering For example if I have the following example test - as.data.frame(matrix(c(1,2,3,4, 11,12,13,14, a,b,b,c), nrow = 3, ncol=3,dimnames = list(c(r1,r2,r3,r4),NULL)) V1 V2 V3 r1 1 11 a r2 2 12 b r3 3 13 b r4 4 14 c it is easy to select test - test[,mylist] with for example mylist - c(V1,V3) V1 V3 r1 1 a r2 2 b r3 3 b r4 4 c But after how can I restrict test in selecting the rows where the result in column V3 are in a list mylist2, with for example mylist2 -c(b,c,d) ? which would give as an example V1 V3 r2 2 b r3 3 b r4 4 c Regards Colin -- View this message in context: http://n4.nabble.com/Accessing-values-of-a-matrix-tp1561932p1564533.html 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.
[R] How to run the VECM BEKK model in R?
Dear all, I want to run the VECM BEKK model, but I cannot find the corresponding package to run this model. Anybody can help? Thanks a lot Ted -- View this message in context: http://n4.nabble.com/How-to-run-the-VECM-BEKK-model-in-R-tp1564555p1564555.html 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] plot is not keeping the order of variable
Dieter Menne wrote: Peter Dalgaard wrote: d - data.frame(f=c(rare, medium,well-done)) #To get the cast in order of appearance, this can be used: d$f - factor(d$f, levels=unique(d$f)) d$f [1] rare mediumwell-done Levels: rare medium well-done .. which caused some head-scratching from me, because it made me believe there was some hidden Kopenhagen-factor conserving the original order. To protect the innocent: for the more general case, unique() does not help. Right. As I said, it gives cast in order of appearance. The default factor levels are sort(unique(x)) which is independent of data order, but not necessarily desirable. In the general case, you have to tell R about the order explicitly. Dieter levs = c(rare, medium,well-done) set.seed(4711) d - data.frame(f=sample(levs,10,TRUE)) unique(d$f) d$f = factor(d$f, levels=unique(d$f)) levels(d$f) d$f = factor(d$f, levels = levs) levels(d$f) -- 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 ~~ - (p.dalga...@biostat.ku.dk) 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] tests for measures of influence in regression
Thank you, Wolfgang! Now that I know what the function does I can at least search some literature to learn about those criteria. Thanks, Frank Tamborello On Feb 22, 2010, at 7:00 AM, Viechtbauer Wolfgang (STAT) wrote: I don't think this information can be found in the documentation, but you can always just check the actual influence.measures() and print.infl() code to find out. Most importantly, influence.measures () incldues the following code: function (model) { is.influential - function(infmat, n) { k - ncol(infmat) - 4 if (n = k) stop(too few cases, n k) absmat - abs(infmat) result - cbind(absmat[, 1L:k] 1, absmat[, k + 1] 3 * sqrt(k/(n - k)), abs(1 - infmat[, k + 2]) (3 * k)/(n - k), pf(infmat[, k + 3], k, n - k) 0.5, infmat[, k + 4] (3 * k)/n) dimnames(result) - dimnames(infmat) result } ... infmat - cbind(dfbetas, dffit = dffits, cov.r = cov.ratio, cook.d = cooks.d, hat = h) ... is.inf - is.influential(infmat, sum(h 0)) ... } So, a case is flagged if: - any of its absolute dfbetas values are larger than 1, or - its absolute dffits value is larger than 3*sqrt(k/(n-k)), or - abs(1 - covratio) is larger than 3*k/(n-k), or - its Cook's distance is larger than the 50% percentile of an F-distributio with k and n-k degrees of freedom, or - its hatvalue is larger than 3*k/n, where k denotes the number of model coefficients (e.g., k = 2 for simple regression with the intercept included in the model). Best, -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +31 (43) 388-2277 School for Public Health and Primary Care Office Location: Maastricht University, P.O. Box 616 Room B2.01 (second floor) 6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck) Original Message From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Frank Tamborello Sent: Monday, February 22, 2010 00:39 To: r-help@r-project.org Subject: [R] tests for measures of influence in regression influence.measures gives several measures of influence for each observation (Cook's Distance, etc) and actually flags observations that it determines are influential by any of the measures. Looks good! But how does it discriminate between the influential and non- influential observations by each of the measures? Like does it do a Bonferroni-corrected t on the residuals identified by the influence measures or some other test? Cheers, Frank Tamborello, PhD W. M. Keck Postdoctoral Fellow School of Health Information Sciences University of Texas Health Science Center, Houston [[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. __ 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] Accessing values of a matrix
On Feb 22, 2010, at 8:45 AM, statquant wrote: Hello Sarah, thanks for answering For example if I have the following example test - as.data.frame(matrix(c(1,2,3,4, 11,12,13,14, a,b,b,c), nrow = 3, ncol=3,dimnames = list(c(r1,r2,r3,r4),NULL)) This is a malformed example. Should be: test - as.data.frame(matrix(c(1,2,3,4, 11,12,13,14, a,b,b,c), nrow= 4, ncol=3,dimnames = list(c(r1,r2,r3,r4),NULL)) ) test V1 V2 V3 r1 1 11 a r2 2 12 b r3 3 13 b r4 4 14 c V1 V2 V3 r1 1 11 a r2 2 12 b r3 3 13 b r4 4 14 c it is easy to select test - test[,mylist] with for example mylist - c(V1,V3) V1 V3 r1 1 a r2 2 b r3 3 b r4 4 c But after how can I restrict test in selecting the rows where the result in column V3 are in a list mylist2, with for example mylist2 - c(b,c,d) ? which would give as an example ?%in% ?[ ?subset test[test$V3 %in% c(b,c,d), c(V1,V2)] V1 V2 r2 2 12 r3 3 13 r4 4 14 #Or: subset(test, V3 %in% c(b,c,d), select=c(V1, V3)) V1 V3 r2 2 b r3 3 b r4 4 c V1 V3 r2 2 b r3 3 b r4 4 c Regards Colin -- View this message in context: http://n4.nabble.com/Accessing-values-of-a-matrix-tp1561932p1564533.html 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. __ 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 language syntax highlighting file of VIM
Your attachment did not get though. Here is what did: https://stat.ethz.ch/pipermail/r-help/2010-February/229132.html On Mon, Feb 22, 2010 at 8:11 AM, zhuojun chen uifid...@gmail.com wrote: I sent an email to current maintainer Vaidotas Zemlys 2 weeks ago but no response yet. Here is a mod, it's an unfinished version. Please have a look, thanks. __ 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] Count between interval
Hi, ab-read.table(header=F,file=textConnection(-1.3 1 -1.5 -1 1.5 -2.5 3 -0.5)) length(which(ab =-2 ab=2)) Bosken schrieb: Hi all, I take a simple dataset like this: -1.3 1 -1.5 -1 1.5 -2.5 3 -0.5 Now I want to count how many values there are between -2 and 2. The answer here would be 6. Can anyone do this with R? Thank you in advance. Gr. Bosken -- Eik Vettorazzi Institut für Medizinische Biometrie und Epidemiologie Universitätsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 __ 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] Rounding like in finances
On 22/02/2010 9:57 AM, Oliver wrote: Hello, which packages are you talking about? And... are thoise packages using integer-based calculations? I don't use this, but the ones I'd look in would be: MASS (function rational()) rcdd Rmpfr You can use RSiteSearch(rational) to look for more. Duncan Murdoch __ 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] how to make R plot under Linux
thank you for reply. I just type: hist(x) from SSH terminal, expecting a histogram to pop up like what i got under windows.instead I got the following error msg: Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype, : unable to start device X11cairo In addition: Warning message: In function (display = , width, height, pointsize, gamma, bg, : unable to open connection to X11 display '' Would you give some clues what is going on? thanks -- View this message in context: http://n4.nabble.com/how-to-make-R-plot-under-Linux-tp1562060p1564632.html 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] how to make R plot under Linux
Hi! 22.02.2010 17:45, xin wei wrote: thank you for reply. I just type: hist(x) from SSH terminal, expecting a histogram to pop up like what i got under windows.instead I got the following error msg: Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype, : unable to start device X11cairo In addition: Warning message: In function (display = , width, height, pointsize, gamma, bg, : unable to open connection to X11 display '' Would you give some clues what is going on? You wrote you are using R over an SSH connection. Have you enabled X-window support for the connection (see 'man ssh')? HTH, -Kimmo __ 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] how to make R plot under Linux
xin wei wrote: thank you for reply. I just type: hist(x) from SSH terminal, expecting a histogram to pop up like what i got under windows.instead I got the following error msg: Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype, : unable to start device X11cairo In addition: Warning message: In function (display = , width, height, pointsize, gamma, bg, : unable to open connection to X11 display '' Would you give some clues what is going on? thanks Did you start ssh with the -X switch? -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ 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] tiff() and antialias option
Uwe, you're right, it turns out that cairo hadn't been previously installed on the system. Andrew 2010/2/19 Uwe Ligges lig...@statistik.tu-dortmund.de On 19.02.2010 17:44, Andrew Yee wrote: I was wondering if someone could help with the antialias option in tiff(). I'm running R 2.9.2 on a Linux machine. I'm working on creating a tiff file and have tried different antialias parameters, e.g. default, none, gray, and subpixel, but don't seem to be seeing a difference in the output. Or perhaps I'm missing something obvious? Perhaps you are not using type=cairo ? Uwe Ligges Thanks, Andrew [[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. [[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] SEM error
On 20.02.2010 08:51, Dan Edgcumbe wrote: I'm trying to do some confirmatory factor analysis on some data. My SEM model solves in 22 iterations, but when I try to look at the modification indices, using mod.indices, I get the following error message: Error in solve.default(hessian) : system is computationally singular: reciprocal condition number = 4.40283e-18 What does this mean? That the method you apply tries to invert some object called hessian (maybe a hessian? ;-)) but fails since a singular matrix cannot be inverted. Perhaps (as I often found for people doing sem analyses) you have less observations than parameters to estimate or only certain combinations for some factors? Uwe Ligges Many thanks, Dan [[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] Rounding like in finances
Duncan Murdoch murdoch at stats.uwo.ca writes: [...] MASS (function rational()) rcdd Rmpfr [...] OK, I will look for those packages. Maybe they will help. Thank you. __ 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] Count between interval
Hi, Here is a suggeston: x - c(-1.3, 1, -1.5, -1, 1.5, -2.5, 3, -0.5) sum(x =-2 x=2) [1] 6 HTH, Jorge On Mon, Feb 22, 2010 at 9:49 AM, Bosken wrote: Hi all, I take a simple dataset like this: -1.3 1 -1.5 -1 1.5 -2.5 3 -0.5 Now I want to count how many values there are between -2 and 2. The answer here would be 6. Can anyone do this with R? Thank you in advance. Gr. Bosken -- View this message in context: http://n4.nabble.com/Count-between-interval-tp1564537p1564537.html 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. [[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] change email subscription
See the footer of your message. Uwe Ligges On 22.02.2010 13:27, Wendy Qiao wrote: Dear R team, As this is a university email address with very small inbox limit, can I please change my R email subscription to another email address instead of this one? My new email address is wendy2.q...@gmail.com. I have change my email in my profile, but seems that does not change my subscription. Thank you. Wendy [[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] Error with KNN
On 20.02.2010 19:10, Nancy Adam wrote: Hi all I receive this error message: “Error in mymodel$MSE : $ operator is invalid for atomic vectors” When I use KNN. This is the code: library(e1071) train- rbind(iris3[,,1], iris3[,,2], iris3[,,3]) cl- factor(c(rep(s,50), rep(c,50), rep(v,50))) knn.cv(train, cl, k = 3, prob = TRUE) sqrt(mymodel$MSE) #error message : “Error in mymodel$MSE : $ operator is invalid for atomic vectors” There is no component MSE in mymodel. Hence you cannot extract it. Uwe Ligges thanks, Nancy _ Hotmail: Trusted email with powerful SPAM protection. [[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.
[R] gsub patterns from vector elements w/out loop?
Dear list, I have two vectors: x - c(one,two) y - paste(rep(x,2),blah) I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] something else blah something else blah something else blah [4] something else blah I can do this using a loop: for ( i in 1:length(x) ) { y - gsub(x[i],something else,y) } Surely, there must be a less kludgy way? I tried looking at the different apply()s but am not getting anywhere, partly because I lack the mental flexibility to combine the fact that I am applying gsub() to y but now want to apply that to x ... erm. :/ Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.10 __ 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] replicate matrix
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of wendy Sent: Saturday, February 20, 2010 6:58 PM To: r-help@r-project.org Subject: [R] replicate matrix Hi all, I have a matrix, for example [,1] [,2] [1,] 13 [2,] 46 I want to replicate the matrix twice and add an extra column at the end, which is [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 13 13 132 [2,] 46 46 465 I found 'rep' only works for vector. Does anyone know how to replicate a matrix, and append the matrix? You want to replicate the columns of the matrix so use rep() in a column subscripting expression: x - matrix(c(1,4,3,6),nrow=2,ncol=2) # setup xRepped - x[ , rep(seq_len(ncol(x)), 3)] then append the new column with xReppedAppended - cbind(xRepped, c(2,5)) I avoid the solutions that convert the original matrix to a vector and back to a matrix, like xxx - matrix(rep(as.vector(x),3), nrow=2) as they make me assume more than I want to assume about how matrices are represented internally. Those solutions also lose any column or row names that my matrix may have had. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com Thank you in advance, Wendy -- View this message in context: http://n4.nabble.com/replicate-matrix-tp1563337p1563337.html 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. __ 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] gsub patterns from vector elements w/out loop?
gsub(one|two, something else, y) ? On Mon, Feb 22, 2010 at 4:25 PM, Marianne Promberger marianne.promber...@kcl.ac.uk wrote: Dear list, I have two vectors: x - c(one,two) y - paste(rep(x,2),blah) I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] something else blah something else blah something else blah [4] something else blah I can do this using a loop: for ( i in 1:length(x) ) { y - gsub(x[i],something else,y) } Surely, there must be a less kludgy way? I tried looking at the different apply()s but am not getting anywhere, partly because I lack the mental flexibility to combine the fact that I am applying gsub() to y but now want to apply that to x ... erm. :/ Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.10 __ 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] gsub patterns from vector elements w/out loop?
On Feb 22, 2010, at 10:25 AM, Marianne Promberger wrote: Dear list, I have two vectors: x - c(one,two) y - paste(rep(x,2),blah) I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] something else blah something else blah something else blah [4] something else blah I can do this using a loop: for ( i in 1:length(x) ) { y - gsub(x[i],something else,y) } Surely, there must be a less kludgy way? I tried looking at the different apply()s but am not getting anywhere, partly because I lack the mental flexibility to combine the fact that I am applying gsub() to y but now want to apply that to x ... erm. :/ Marianne You can use | to specify a logical or in the search regex: gsub(one|two, something else, y) [1] something else blah something else blah something else blah [4] something else blah Thus: paste(x, collapse = |) [1] one|two and finally: gsub(paste(x, collapse = |), something else, y) [1] something else blah something else blah something else blah [4] something else blah See ?regex and ?paste HTH, Marc Schwartz __ 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] Count between interval
And as long as the interval is symmetric about zero: sum(abs(x) = 2) [1] 6 -Peter Ehlers On 2010-02-22 9:18, Jorge Ivan Velez wrote: Hi, Here is a suggeston: x- c(-1.3, 1, -1.5, -1, 1.5, -2.5, 3, -0.5) sum(x=-2 x=2) [1] 6 HTH, Jorge On Mon, Feb 22, 2010 at 9:49 AM, Bosken wrote: Hi all, I take a simple dataset like this: -1.3 1 -1.5 -1 1.5 -2.5 3 -0.5 Now I want to count how many values there are between -2 and 2. The answer here would be 6. Can anyone do this with R? Thank you in advance. Gr. Bosken -- View this message in context: http://n4.nabble.com/Count-between-interval-tp1564537p1564537.html 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. [[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. -- Peter Ehlers University of Calgary __ 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] gsub patterns from vector elements w/out loop?
gsub(paste(x, collapse = |), something else, y) [1] something else blah something else blah something else blah [4] something else blah Many thanks! I didn't know about collapse. Should have thought about reading up in ?paste ... Thanks Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.10 __ 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] SEM error
I have often found this to happen if the scale of one variable is orders of magnitude different than the scale of other variables. Have you tried inspecting the covariance matrix and log transforming any such variables? On Feb 22, 2010, at 8:14 AM, Uwe Ligges wrote: On 20.02.2010 08:51, Dan Edgcumbe wrote: I'm trying to do some confirmatory factor analysis on some data. My SEM model solves in 22 iterations, but when I try to look at the modification indices, using mod.indices, I get the following error message: Error in solve.default(hessian) : system is computationally singular: reciprocal condition number = 4.40283e-18 What does this mean? That the method you apply tries to invert some object called hessian (maybe a hessian? ;-)) but fails since a singular matrix cannot be inverted. Perhaps (as I often found for people doing sem analyses) you have less observations than parameters to estimate or only certain combinations for some factors? Uwe Ligges Many thanks, Dan [[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. __ 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] adding infrequent date labels to x-axis
I'm sure there is a clever way to do the following, but I've been unable to find it on this forum or by writing my own functions. I have 8 years worth of weekly data but would like to restrict the labels on the x-axis to months only. I've included the first year's worth of data below. My line of thought has been along these lines x-seq(as.Date(1999-04-01),as.Date(2007-10-25),by=1 month) y-as.POSIXlt(x)$mon+1 months-month.name month.names-months[as.numeric(y)] month.names-substr(month.names,1,3) plot(cropped.cast1$date,cropped.cast1$Frac_ET_Satsfd_mean,xaxt='n') mtext(text=month.names,side=1,at=??? I'm not sure how to tie month.names back to their true location on the x-axis? I appreciate any insights, Eric Also, class(cropped.cast1$date) [1] POSIXt POSIXct cropped.cast1 date Frac_ET_Satsfd_mean Frac_ET_Satsfd_sd 1999-04-08 0.83448850.13545515 1999-04-15 0.83554660.12810387 1999-04-22 0.85955790.11259251 1999-04-29 0.89972250.09611060 1999-05-06 0.87143640.09527164 1999-05-13 0.85302030.11088544 1999-05-20 0.84378660.12689882 1999-05-27 0.83100030.13985307 1999-06-03 0.80312030.15851422 1999-06-10 0.82885050.12827027 1999-06-17 0.82511300.13051783 1999-06-24 0.82276390.14227501 1999-07-01 0.79146890.15892716 1999-07-08 0.80509290.14465413 1999-07-15 0.83701410.11843615 1999-07-22 0.84486970.10823010 1999-07-29 0.85619250.10694348 1999-08-05 0.85207900.09953065 1999-08-12 0.84299250.10545427 1999-08-19 0.83979660.11629002 1999-08-26 0.83679530.12363411 1999-09-02 0.82194790.13870596 1999-09-09 0.82181930.13617427 1999-09-16 0.82175840.13346997 1999-09-23 0.82168340.13304117 1999-09-30 0.81110050.14367143 1999-10-07 0.80908130.14967750 1999-10-14 0.82651880.13484263 1999-10-21 0.83913330.11873929 1999-10-28 0.84261020.11215439 1999-11-04 0.84318130.11007485 1999-11-11 0.83941400.11206864 1999-11-18 0.83506500.11042384 1999-11-25 0.83600820.11011926 1999-12-02 0.83621290.10834491 1999-12-09 0.83775120.10519698 1999-12-16 0.83673390.10176535 1999-12-23 0.83386210.10273662 1999-12-30 0.83170940.10470654 -- View this message in context: http://n4.nabble.com/adding-infrequent-date-labels-to-x-axis-tp1564804p1564804.html 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.
[R] Re : how to plot select points in preexisting persp plot
Hello, I am trying to plot selected data points to a preexisting persp plot that satisfies a condition. I used the following statement - text(coords[,1], coords[,2], names(act[which(act 8.75)]), cex=0.7) But I get all the points labeled, instead of the points that satisfy the condition specified. Is there any way to plot only the points I want? Also can this be done using trans3d function. I found no topics pertaining to this issue. Regards, Preeti __ 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] Accessing values of a matrix
OKKK Thanks a lot for letting me know the subset function Cheers -- View this message in context: http://n4.nabble.com/Accessing-values-of-a-matrix-tp1561932p1564724.html 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] Extract information from S4 object
Tahnk you. But, when I try the command you both suggested I get a NULL as the results. names(object1 @ x.values) NULL Where did I go wrong? On Feb 22, 4:34 pm, David Winsemius dwinsem...@comcast.net wrote: On Feb 22, 2010, at 8:05 AM, Jay wrote: The function prediction() returns this: Formal class 'performance' [package ROCR] with 6 slots ..@ x.name : chr Cutoff ..@ y.name : chr Accuracy ..@ alpha.name : chr none ..@ x.values :List of 1 .. ..$ : Named num [1:89933] Inf 2.23 2.22 2.17 2.16 ... .. .. ..- attr(*, names)= chr [1:89933] 36477 56800 41667 ... ..@ y.values :List of 1 .. ..$ : num [1:89933] 0.5 0.5 0.5 0.5 0.5 ... ..@ alpha.values: list() Now, since I want to match each prediction with its original case, I need to extract the names, i.e. the information in - attr(*, names)= chr [1:89933] 36477 56800 41667 ... so I can use it with a simple datafile[names,] query. How do I get these names in plain number formats? Not sure what you mean by plain number formats but this should get you a vector of names assuming the prediction object is named predobject: names( predobj...@x.values ) If you wanted them as.numeric, then that is the name of the appropriate function. -- David __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://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] counting repeating sequence lengths in a vector
Hello, I have a very long (~50,000) sequence of repeating numbers. The first 100 are: [1] 0 0 0 0 0 0 0 0 0 0 0 429 [13] 429 429 429 429 429 429 429 858 858 858 858 858 [25] 858 1287 1287 1287 1287 1287 1716 2145 2145 2574 2574 3003 [37] 3003 3432 3432 3861 4290 4719 5148 5577 5577 6006 6006 6006 [49] 6435 6435 6435 6864 6864 7293 7293 7293 7722 7722 7722 7722 [61] 8151 8151 8151 8580 8580 8580 9009 9009 9009 9009 9438 9438 [73] 9438 9438 9867 9867 9867 10296 10296 10296 10725 10725 10725 10725 [85] 11154 11154 11154 11154 11154 11583 11583 11583 11583 12012 12012 12012 [97] 12012 12441 12441 12441 What I want is to produce a vector of lengths for each contiguous run of numbers . i.e. for the above example, the first three items of the vector returned would be: 11 8 6 ...to represent the counts of 0, 429, and 585, respectively. I could do this with unique() and a for loop, but this would be very inefficient. Any advice on how to do this efficiently would be most appreciated. thanks Tony __ 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] counting repeating sequence lengths in a vector
Try this: rle(x)$length On Mon, Feb 22, 2010 at 2:27 PM, Larson, TR t...@york.ac.uk wrote: Hello, I have a very long (~50,000) sequence of repeating numbers. The first 100 are: [1] 0 0 0 0 0 0 0 0 0 0 0 429 [13] 429 429 429 429 429 429 429 858 858 858 858 858 [25] 858 1287 1287 1287 1287 1287 1716 2145 2145 2574 2574 3003 [37] 3003 3432 3432 3861 4290 4719 5148 5577 5577 6006 6006 6006 [49] 6435 6435 6435 6864 6864 7293 7293 7293 7722 7722 7722 7722 [61] 8151 8151 8151 8580 8580 8580 9009 9009 9009 9009 9438 9438 [73] 9438 9438 9867 9867 9867 10296 10296 10296 10725 10725 10725 10725 [85] 11154 11154 11154 11154 11154 11583 11583 11583 11583 12012 12012 12012 [97] 12012 12441 12441 12441 What I want is to produce a vector of lengths for each contiguous run of numbers . i.e. for the above example, the first three items of the vector returned would be: 11 8 6 ...to represent the counts of 0, 429, and 585, respectively. I could do this with unique() and a for loop, but this would be very inefficient. Any advice on how to do this efficiently would be most appreciated. thanks Tony __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] [BioC] Empirical Pvalue
Hi Mohamed, Please read the posting guides for both, the R-help and BioC mailing lists, so you learn the basics of how to ask questions on these lists (and software related mailing lists in general). Following those guides will greatly increase the chance that someone will actually be willing (and able) to help you. Cheers, H. Mohamed Lajnef wrote: Dear R users, Can someone explain me the interpretation of empirical p-value ( max(t)) used to test the genetic association with PLINK? Any help will be appreciated Regards M -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fhcrc.org Phone: (206) 667-5791 Fax:(206) 667-1319 __ 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] Re : how to plot select points in preexisting persp plot
Preeti, Could you please post a sample of your data and all the code? It is hard to answer your question without knowing what coords and act are - Try http://prettygraph.com Pretty Graph , the easiest way to make R-powered graphs on the web. -- View this message in context: http://n4.nabble.com/Re-how-to-plot-select-points-in-preexisting-persp-plot-tp1564808p1564839.html 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.
[R] Bootstrap Multivariate Times Series Forecast
Dear Users, Consider a multivariate time series model: a_1*y(t)-...-a_k*y(t-k)=b+[c_1*z(t)-...-c_j*z(t-j)] i.e., a simple multivariate time series model with one exogenous variable. I would like to know what package can I use to do the following, using R: 1) Select k and j jointly; 2) Estimate the model; 2) Forecast h=4 steps ahead the estimated model; 4) Bootstrap the forecast, since my sample is small. For univariate time series, I already used the BootBC package, but I don't know how to perform the analysis in the case here. Thanks in advance, Rick [[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] adding infrequent date labels to x-axis
Hello Hrishi, The command you suggested plotted the years on the x-axis only. It was the same exact plot as the one I included in the original post. Respectfully, Eric -- View this message in context: http://n4.nabble.com/adding-infrequent-date-labels-to-x-axis-tp1564804p1564875.html 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] adding infrequent date labels to x-axis
Hi emorway, It seems to me that all you need is one command: plot(as.Date(cropped.cast1$date,%Y-%m-%d),cropped.cast1$Frac_ET_Satsfd_mean) - Try http://prettygraph.com Pretty Graph , the easiest way to make R-powered graphs on the web. -- View this message in context: http://n4.nabble.com/adding-infrequent-date-labels-to-x-axis-tp1564804p1564865.html 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] how to make R plot under Linux
hi, Kevin and K.Elo: thank you for the suggestion. Can you be more specific on these? (like how exactly get into x-switch or man ssh). I am totally ignorant about linux and SSH:( Memory limitation forces me to switch from windows to Linux cluster. Xin -- View this message in context: http://n4.nabble.com/how-to-make-R-plot-under-Linux-tp1562060p1564850.html 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] SEM error
Dear Jarret, Uwe, and Dan, Sorry -- I missed the initial question. What's a bit odd here is that the singularity occurs only in the computation of the modification indices. It might help to look at the conditioning of the covariance matrix of the parameter estimates (i.e., the eigenvalues or singular values), which must have been invertible. Regards, John On Mon, 22 Feb 2010 09:00:08 -0800 Jarrett Byrnes byr...@msi.ucsb.edu wrote: I have often found this to happen if the scale of one variable is orders of magnitude different than the scale of other variables. Have you tried inspecting the covariance matrix and log transforming any such variables? On Feb 22, 2010, at 8:14 AM, Uwe Ligges wrote: On 20.02.2010 08:51, Dan Edgcumbe wrote: I'm trying to do some confirmatory factor analysis on some data. My SEM model solves in 22 iterations, but when I try to look at the modification indices, using mod.indices, I get the following error message: Error in solve.default(hessian) : system is computationally singular: reciprocal condition number = 4.40283e-18 What does this mean? That the method you apply tries to invert some object called hessian (maybe a hessian? ;-)) but fails since a singular matrix cannot be inverted. Perhaps (as I often found for people doing sem analyses) you have less observations than parameters to estimate or only certain combinations for some factors? Uwe Ligges Many thanks, Dan [[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. __ 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. John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ __ 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] gsub patterns from vector elements w/out loop?
Marianne, The function substring2 from the Hmisc packages works nicely for me to do this (without explicit gsub, though): x- c(one,two) y- paste(rep(x,2),blah) y [1] one blah two blah one blah two blah substring2(y,x)- something else y [1] something else blah something else blah something else blah something else blah Christian On 02/22/2010 10:25 AM, Marianne Promberger wrote: Dear list, I have two vectors: x- c(one,two) y- paste(rep(x,2),blah) I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] something else blah something else blah something else blah [4] something else blah I can do this using a loop: for ( i in 1:length(x) ) { y- gsub(x[i],something else,y) } Surely, there must be a less kludgy way? I tried looking at the different apply()s but am not getting anywhere, partly because I lack the mental flexibility to combine the fact that I am applying gsub() to y but now want to apply that to x ... erm. :/ Marianne -- Christian Raschke Department of Economics and ISDS Research Lab (HSRG) Louisiana State University Patrick Taylor Hall, Rm 2128 Baton Rouge, LA 70803 (225)226-0017 cras...@lsu.edu __ 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] how to make R plot under Linux
Dne Po 22. února 2010 18:53:55 xin wei napsal(a): hi, Kevin and K.Elo: thank you for the suggestion. Can you be more specific on these? (like how exactly get into x-switch or man ssh). I am totally ignorant about linux Hello, in Linux You can plot as in Windows, for example using hist(x). But not over remote connection using SSH. Connect with command similar to ssh -X your_usern...@remote.server.com Then You can launch applications making windows. Normally, over SSH You can use only text-based applications. But there is one big but: the remote server has to support the -X switch. If it is not permitted in configuration of server's SSH daemon, You can not use it and You will not have windows with Your graphs. Then You would have to ask admin of the server or run R on Your own computer. For more information type man ssh. Best regards, Vojtěch Zeisek and SSH:( Memory limitation forces me to switch from windows to Linux cluster. Xin -- Vojtěch Zeisek Komunita openSUSE GNU/Linuxu / Community of the openSUSE GNU/Linux http://www.opensuse.org/ http://web.natur.cuni.cz/~zeisek/ signature.asc Description: This is a digitally signed message part. __ 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] how to make R plot under Linux
Hi! 22.02.2010 19:53, xin wei wrote: hi, Kevin and K.Elo: thank you for the suggestion. Can you be more specific on these? (like how exactly get into x-switch or man ssh). I am totally ignorant about linux and SSH:( Memory limitation forces me to switch from windows to Linux cluster. Could you provide us with more information about the software you use for establishing the ssh connection (i.e. your ssh client). I suppose you are connecting a linux server (having R on it) from a windows system, aren't you? And you use a ssh client software, right? There should be an enable X11 forwarding (or something similar) option in your ssh client application. You should look e.g. in connection settings. Kind regards, Kimmo __ 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] Alternatives to linear regression with multiple variables
You can try the locfit package, which I believe can handle up to 5 variables. E.g., R library(locfit) Loading required package: akima Loading required package: lattice locfit 1.5-6 2010-01-20 R x - matrix(runif(1000 * 3), 1000, 3) R y - rnorm(1000) R mydata - data.frame(x, y) R str(mydata) 'data.frame': 1000 obs. of 4 variables: $ X1: num 0.21 0.769 0.661 0.978 0.15 ... $ X2: num 0.426 0.132 0.214 0.774 0.472 ... $ X3: num 0.971 0.659 0.474 0.867 0.479 ... $ y : num -0.496 -0.636 1.778 -0.876 0.657 ... R fit - locfit(y ~ lf(X1, X2, X3), data=mydata) R plot(fit) Andy -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Guy Green Sent: Monday, February 22, 2010 7:47 AM To: r-help@r-project.org Subject: [R] Alternatives to linear regression with multiple variables I wonder if someone can give some pointers on alternatives to linear regression (e.g. Loess) when dealing with multiple variables. Taking any simple table with three variables, you can very easily get the intercept and coefficients with: summary(lm(read_table)) For obvious reasons, the coefficients in a multiple regression are quite different from what you get if you calculate regressions for the single variables separately. Alternative approaches such as Loess seem straightforward when you have only one variable, and have the advantage that they can cope even if the relationship is not linear. My question is: how can you extend a flexible approach like Loess to a multi-variable scenario? I assume that any non-parametric calculation becomes very resource-intensive very quickly. Can anyone suggest alternatives (preferably R-based) that cope with multiple variables, even when the relationship (linear, etc) is not known in advance? Thanks, Guy -- View this message in context: http://n4.nabble.com/Alternatives-to-linear-regression-with-mu ltiple-variables-tp1564370p1564370.html 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. Notice: This e-mail message, together with any attachme...{{dropped:10}} __ 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] how to make R plot under Linux
K. Elo wrote: Hi! 22.02.2010 19:53, xin wei wrote: hi, Kevin and K.Elo: thank you for the suggestion. Can you be more specific on these? (like how exactly get into x-switch or man ssh). I am totally ignorant about linux and SSH:( Memory limitation forces me to switch from windows to Linux cluster. Could you provide us with more information about the software you use for establishing the ssh connection (i.e. your ssh client). I suppose you are connecting a linux server (having R on it) from a windows system, aren't you? And you use a ssh client software, right? There should be an enable X11 forwarding (or something similar) option in your ssh client application. You should look e.g. in connection settings. Kind regards, Kimmo Agree. Sounds like you are using a client on Windows. Also, Vojtech Zeisek's reply is pertinent too. -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ 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] adding infrequent date labels to x-axis
Hi emorway, You are right. I tried the command only with one year's data, in which case it plots month names as labels. But for multiple years, the labels become years. I found this old post useful - http://n4.nabble.com/Month-tick-marks-on-a-plot-td879121.html#a879121. Picking the code from the comment by Gavin Simson, I think this should work: plot(as.Date(cropped.cast1$date,%Y-%m-%d),cropped.cast1$Frac_ET_Satsfd_mean,xaxt=n) x-as.Date(cropped.cast1$date,%Y-%m-%d) ticks.at - seq(min(x), max(x), by = months) ## format the labels as abbreviated month names ticks.lab - format(ticks.at, format = %b) ## indicator variable; is month January? m1 - ticks.lab == Jan ## plot small ticks and labels for months not Jan Axis(x, at = ticks.at[!m1], side = 1, labels = ticks.lab[!m1], las = 2, cex.axis = 0.7) ## plot the default tick locations for years Axis(x, side = 1, las = 2) ## add the box box() - Try http://prettygraph.com Pretty Graph , the easiest way to make R-powered graphs on the web. -- View this message in context: http://n4.nabble.com/adding-infrequent-date-labels-to-x-axis-tp1564804p1564924.html 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] adding infrequent date labels to x-axis
Hello Hrishi, That worked great, and in the process I learned some new ways of going about writing R code. Thank you very much for helping me out! Eric -- View this message in context: http://n4.nabble.com/adding-infrequent-date-labels-to-x-axis-tp1564804p1564943.html 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] gsub patterns from vector elements w/out loop?
Here are a few possibilities using gsubfn in the gsubfn package x - c(one,two) y - paste(rep(x,2),blah) library(gsubfn) # 1 gsubfn(\\w+, w ~ if (w %in% x) something else else w, y) # 2 gsubfn(\\w+, list(one = something else, two = something else), y) # 3 L - sapply(x, function(...) something else, simplify = FALSE) gsubfn(\\w+, L, y) gsubfn is the same as gsub except the second argument can be a function, list or certain other objects. The regular expression \\w+ matches each word in y and in the first solution that is replaced with phrase or just returned according to the function which is specified in formula notation. The second solution uses the fact that gsubfn allows lists such that the names of the list components are matched and replaced with the corresponding contents. The third is the same as the second except that it uses sapply to create the list from x. On Mon, Feb 22, 2010 at 11:55 AM, Marianne Promberger marianne.promber...@kcl.ac.uk wrote: gsub(paste(x, collapse = |), something else, y) [1] something else blah something else blah something else blah [4] something else blah Many thanks! I didn't know about collapse. Should have thought about reading up in ?paste ... Thanks Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.10.1 (2009-12-14) Ubuntu 9.10 __ 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] how to make R plot under Linux
Hi, You just need to install X11 windows software on windows, such as xming, and start xming before ssh -X use...@remotehost Hope this helps. On 2/22/10, xin wei xin...@stat.psu.edu wrote: thank you for reply. I just type: hist(x) from SSH terminal, expecting a histogram to pop up like what i got under windows.instead I got the following error msg: Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype, : unable to start device X11cairo In addition: Warning message: In function (display = , width, height, pointsize, gamma, bg, : unable to open connection to X11 display '' Would you give some clues what is going on? thanks -- View this message in context: http://n4.nabble.com/how-to-make-R-plot-under-Linux-tp1562060p1564632.html 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. -- Zhuanshi He / Z. He (PhD) Waterloo Centre for Atmospheric Sciences (WCAS) Department of Earth and Environmental Sciences Phy Bldg, Rm 2022 University of Waterloo, Waterloo, ON N2L 3G1 Canada Tel: +1-519-888-4567 ext 36667 __ 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] First Appearance of value in splitted matrix
Hello, I have a large matrix (foo), I have to split by weeks and in which measures start at different points of time. Now I am looking for the number of the week, in which a specific value appears. I do not need the date or any other information from a row, but (due to structure of result table) the indicator i. One example: foo has two columns: Date, ID foo.all- split(foo, cut(foo$Date, weeks) l_foo-length(foo.all) for (i in 1:l_foo){ foo.i-foo.all[[i]] } Question: Given I search for ID=4. How do I find the i, in which 4 appears? Thanks in advance! -- View this message in context: http://n4.nabble.com/First-Appearance-of-value-in-splitted-matrix-tp1564964p1564964.html Sent from the R help mailing list archive at Nabble.com. [[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] Goodness of fit test for count data
Dear all, I am trying to test goodness of fit. I assume that a data follow Poisson or Negative binomial distribution. I can test the goodness of fit in case of no truncated data. However, I could not find any good function or packages when a data is truncated. For example, a frequency table for the number of visiting emergency room in one hundred one observations past one year is as follow: N freq 1 30 2 35 3 26 4 8 5 0 6 2 7 0 I expect the frequency table to satisfy a Poisson distribution or Negative binomial distribution. However, the distribution is different from the usual Poisson or Negative binomial distribution because one value, zero, is excluded. I expect that the distribution is zero truncated distribution. In case of SAS, I used NLMIXED procedure to calculate the expected probability when y=1 … y=n under the assumption that a data follows Poisson or Negative binomial distribution. And then I run Chi-square test. If you need the SAS code, I will send E-mail. I want to run this test in R. Could you suggest any idea that can I perform this test in R. Have a nice day. -- View this message in context: http://n4.nabble.com/Goodness-of-fit-test-for-count-data-tp1564963p1564963.html 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.
[R] useR! 2010, Submission/early registration deadline: March 1
Dear R-help members, This message is to remind you that the submission deadline for abstracts for the R User Conference, useR! 2010, is one week away: Submission deadline: Monday, March 1, 2010 The deadline for early registration is also Monday, March 1, 2010. I encourage you all to submit abstracts (to give a presentation, or to present a poster). More information regarding the conference is pasted below. best regards, Kate Mullen, for the useR! 2010 organizing committee -- We are happy to announce that the R User Conference useR! 2010 http://www.R-project.org/useR-2010 is scheduled for July 21-23, 2010, and will take place at the headquarters of the National Institute of Standards and Technology (NIST) in Gaithersburg, Maryland, USA. Following the successful useR! 2004, useR! 2006, useR! 2007, useR! 2008, and useR! 2009, conferences, the conference is focused on: 1. R as the `lingua franca' of data analysis and statistical computing, 2. providing a platform for R users to discuss and exchange ideas on how R can be used to do statistical computations, data analysis, visualization and exciting applications in various fields, 3. giving an overview of the new features of the rapidly evolving R project. As for the predecessor conferences, the program will consist of two parts: invited lectures and user-contributed sessions. Prior to the conference, there will be tutorials on R, descriptions of which are available at http://www.R-project.org/useR-2010/tutorials All R users are invited to submit abstracts on exciting applications of R as specified in the call at http://www.R-project.org/useR-2010/#Call The deadline for abstract submission (and early registration) is March 1, 2010. INVITED LECTURES Invited speakers will include Mark Handcock, Frank Harrell Jr, Friedrich Leisch, Michael Meyer, Richard Stallman, Luke Tierney, Diethelm Wuertz. USER-CONTRIBUTED SESSIONS The sessions will be a platform to bring together R users, contributors, package maintainers and developers in the S spirit that `users are developers'. People from different fields will show us how they solve problems with R in fascinating applications. The sessions are organized by members of the program committee, including Dirk Eddelbuettel, John Fox, Virgilio Gomez-Rubio, Richard Heiberger, Torsten Hothorn, Aaron King, Jan de Leeuw, Nicholas Lewin-Koh, Andy Liaw, Uwe Ligges, Martin Maechler, Katharine Mullen, Heather Turner, Ravi Varadhan, H. D. Vinod, John Verzani, Alan Zaslavsky, Achim Zeileis. The program will cover topics such as * Applied Statistics Biostatistics * Bayesian Statistics * Bioinformatics * Chemometrics and Computational Physics * Data Mining * Econometrics Finance * Environmetrics Ecological Modeling * High Performance Computing * Machine Learning * Marketing Business Analytics * Psychometrics * Robust Statistics * Social network analysis * Spatial Statistics * Statistics in the Social and Political Sciences * Teaching * Visualization Graphics * and many more. IMPORTANT DATES 2009-10-01 open submission of abstracts 2009-10-01 open registration 2009-11-01 tutorial submission deadline ** 2010-03-01 early registration deadline ** 2010-03-01 submission deadline for abstracts Before 2010-03-15notification of acceptance 2010-06-20 registration deadline (later registration NOT possible on site) 2010-07-20 tutorials 2010-07-21 conference start 2010-07-23 conference end We hope to meet you in Gaithersburg! __ 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.