Re: [R] Package installation in Windows
On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote: As a sys admin, how do I install packages so that there is one common library for all users of the MS Windows computer, instead of the default individual location for each user? I've done this for Linux. The same way. You set R_LIBS_SITE in etc/Renviron.site. See ?.Library.site . This was discussed on this list with the last couple of weeks, so please do check the archives. Thanks, in advance, for your help. Mike -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] binomial(link=inverse)
This isn't accurate. You are talking about link functions *known by name*. link: a specification for the model link function. This can be a name/expression, a literal character string, a length-one character vector or an object of class 'link-glm' (provided it is not specified via one of the standard names given next). Nothing is stopping you giving the link as an object, and there is an example on the help page. We made this easily user-extensible quite a while back. As to why the list of links known by name is as it is, that seems history. in part the White Book history of S. I've always thought it an error that 'log' was a standard link for binomial, as the range does not match the specification of probabilities (and S did not do so, MASS Table 7.1 ). For each of log and inverse you have a valid model only for some values of the data, and can easily ask for predictions that give an out-of-range error. On Tue, 9 Sep 2008, Ben Bolker wrote: this may be a better question for r-devel, but ... Is there a particular reason (and if so, what is it) that the inverse link is not in the list of allowable link functions for the binomial family? I initially thought this might have something to do with the properties of canonical vs non-canonical link functions, but since other link functions (probit, cloglog, cauchit, log) are allowed, I can't think of any good reason. In fact, it's sort of a mystery to me why the sets of link functions for each family are restricted. Is this from painful experience that some link functions just don't work well? I can go ahead and hack my own version that allows inverse link, but it would be nice to know if I'm doing something dumb. (The reason I want to do this is that the inverse link linearizes the Michaelis-Menten function, y = a*x/(b+x) ...) cheers Ben Bolker -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] fBasics package: dnig
Rajdeep Das wrote: Hi, I am trying to calculate probability density of normal inverse gaussian distribution. I am using dnig function of fBasics package. However, I am getting following result. The density at x = 0.003042866 is: dnig(x= 0.003042866, alpha=5.184868, beta= 0.11841, delta= 0.06038513, mu= -0.0003520626) [1] 6.550251 I am not sure why it is 6.550251. Can anyone tell me why density is more than 1? Thank you for your time. Without looking closer at the specific distribution: Why shouldn't it be more than 1? The density at x=0.25 of a uniform(a=0, b=0.5) distribution is 2 - hopefully. Uwe Ligges --Raj __ 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] tsdiag error
[EMAIL PROTECTED] wrote: Does anyone know why I get the following error when trying tsdiag? Error in UseMethod(tsdiag) : no applicable method for tsdiag I am invoking it as: tsdiag(mar). tsdiag is a generic function that tries to dispatch for mar, but there is no appropriate method available that is able to deal with objects of class of mar. Hence check what classes of objects you can specify for tsdiag() and of which class mar currently is. Uwe Ligges Thank you. Kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] PCA and % variance explained
pgseye wrote: After doing a PCA using princomp, how do you view how much each component contributes to variance in the dataset. I'm still quite new to the theory of PCA - I have a little idea about eigenvectors and eigenvalues (these determine the variance explained?). Are the eigenvalues related to loadings in R? You can plot the princomp object using screeplot() and you can get the percentage of explained variance from the princomp object p using p$sdev^2 / sum(p$sdev^2) -- Gad Abraham Dept. CSSE and NICTA The University of Melbourne Parkville 3010, Victoria, Australia email: [EMAIL PROTECTED] web: http://www.csse.unimelb.edu.au/~gabraham __ 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] Computation of contour values - Speeding up computation
Andreas Wittmann wrote: Dear R useRs, i have the following code to compute values needed for a contour plot myContour - function(a, b, plist, veca, vecb, dim) { tmpb - seq(0.5 * b, 1.5 * b, length=dim) tmpa - seq(0.5 * a, 1.5 * a, length=dim) z - matrix(0, nrow=dim, ncol=dim) for(i in 1:dim) { for(j in 1:dim) { z[i, j] - posteriorPdf(a=tmpa[j], b=tmpb[i], plist=plist, veca=veca, vecb=vecb) } } } posteriorPdf - function(a, b, plist, veca, vecb) { res - sum(plist[, 1] * exp(vecb[, 1] * log(vecb[, 2]) + (vecb[, 1] - 1.0) * log(b) - vecb[, 2] * b - lgamma(vecb[, 1])) * exp(veca[, 1] * log(veca[, 2]) + (veca[, 1] - 1.0) * log(a) - veca[, 2] * a - lgamma(veca[, 1]))) return(res) } plist - matrix(0, 100, 3) plist[, 1] - runif(100) veca - vecb - matrix(0, 100, 2) veca[, 1] - seq(20, 50, len=100) veca[, 2] - seq(10, 20, len=100) vecb[, 1] - seq(50, 200, len=100) vecb[, 2] - seq(1000, 40, len=100) myContour(a=20, b=0.01, plist=plist, veca=veca, vecb=vecb, dim=50) this is part of my other computations which i do with R. Here i recognized, that my functions myContour and posteriorPdf took a long time of my computations. The key to speed this up is to avoid the two for-loops in myContour, i think. I tried a lot to do this with apply or something like that, but i didn't get it. If you have any advice how i can to this computations fast, i would be very thankful, one idea is to use external c-code? It takes 0.8 seconds on my machine. Not worth working on it, is it? Your problem is that you are applying many calculations for all iterations of the inner loop, even if the result won't change, example: lgamma(veca[, 1]) will be calculated dim^2 times! Hence you can improve your loop considerably: myContour - function(a, b, plist, veca, vecb, dim) { tmpb - seq(0.5 * b, 1.5 * b, length=dim) tmpa - seq(0.5 * a, 1.5 * a, length=dim) z - matrix(0, nrow=dim, ncol=dim) plist1 - plist[, 1] vecb1l2 - vecb[, 1] * log(vecb[, 2]) vecb11 - vecb[, 1] - 1 vecb1lg - lgamma(vecb[, 1]) vecb2 - vecb[, 2] veca1l2 - veca[, 1] * log(veca[, 2]) veca11 - veca[, 1] - 1 veca2 - veca[, 2] veca1lg - lgamma(veca[, 1]) for(i in 1:dim) { for(j in 1:dim) { z[i, j] - sum(plist1 * exp(vecb1l2 + vecb11 * log(tmpb[i]) - vecb2 * tmpb[i] - vecb1lg) * exp(veca1l2 + veca11 * log(tmpa[j]) - veca2 * tmpa[j] - veca1lg)) } } z } Uwe Ligges best regards Andreas -- __ 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] relsurv package
Dear R-users, I have a couple of questions about the relsurv package: 1) when I try to run the example: fit - rsmul(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365.24,sex=sex,year=year),ratetable=slopop,data=rdata) with the datasets in the package (rdata and slopop) it gives me an error: Error in nrow(x) : object x not found 2) If I have a date format like:6/17/1997 9/10/1990 12/4/1996 how to convert it in the Rdate format required by ratetable? Thank you very much for help, Giulia - Original Message From: [EMAIL PROTECTED] [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 9:39:47 AM Subject: relsurv package Message rejected by filter rule match [[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] Information on the number of CPU's
Many thanks Luke, much appreciated, Tolga Luke Tierney [EMAIL PROTECTED] 09/09/2008 21:21 To [EMAIL PROTECTED] cc Prof Brian Ripley [EMAIL PROTECTED], r-help r-help@r-project.org Subject Re: [R] Information on the number of CPU's The wmic command line utility can also be used to query this; on a dual-core Vista laptop I get C:\Users\lukewmic cpu get NumberOfCores,NumberOfLogicalProcessors NumberOfCores NumberOfLogicalProcessors 2 2 luke -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote: Many thanks, that's very helpful. Regards, Tolga - Original Message - From: Prof Brian Ripley [EMAIL PROTECTED] Sent: 09/09/2008 20:57 CET To: Tolga Uzuner Cc: r-help@r-project.org Subject: Re: [R] Information on the number of CPU's On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote: Dear R Users, I am on Windows XP SP2 platform, using R version 2.7.2 . I was wondering if there is a way to find out, within R, the number of CPU's on my machine ? I would use this information to set the number of nodes in a cluster, depending on the machine. Sys.info() and .Platform do not carry this information. Correct, since a) R does not make use of more than 1. b) It is really not portable, and not even well-defined. (How many CPUs has a hyperthreaded dual Xeon? Some say 2, some say 4. Do you want CPUs or cores? If this is a virtualized OS, is the physical number or the logical number?) In the case of Windows, how depends on the Windows version. The w32api (XP or later) call GetNativeSystemInfo will tell you the number of CPUs, for some (unstated) definition of 'CPU'. Later versions have GetLogicalProcessorInformation, which can give the number of cores. Thanks in advance, Tolga Uzuner -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. __ 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. Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted
Re: [R] fBasics package: dnig
Raj has mixed up the concept of density function with CDF (Cumulative Distribution Function) - the former one doesn't need to be smaller than 1, while the latter one is certainly no greater than 1. Yihui On Wed, Sep 10, 2008 at 3:55 PM, Uwe Ligges [EMAIL PROTECTED] wrote: Rajdeep Das wrote: Hi, I am trying to calculate probability density of normal inverse gaussian distribution. I am using dnig function of fBasics package. However, I am getting following result. The density at x = 0.003042866 is: dnig(x= 0.003042866, alpha=5.184868, beta= 0.11841, delta= 0.06038513, mu= -0.0003520626) [1] 6.550251 I am not sure why it is 6.550251. Can anyone tell me why density is more than 1? Thank you for your time. Without looking closer at the specific distribution: Why shouldn't it be more than 1? The density at x=0.25 of a uniform(a=0, b=0.5) distribution is 2 - hopefully. Uwe Ligges --Raj -- Yihui Xie [EMAIL PROTECTED] Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China __ 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] request: table of sequences
Dear R community The following code gives me the most repeated sequence of values. i.e. x=c(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,3,3,3,4,4,4,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, 0,0,0,0,0,0,1,2,2,2,2,2,0,3,3,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) x=array(x,dim=c(3,6,7)) apply(x,3,function(.mat){ rows - table(apply(.mat,1,function(z){ # remove the zeros z - z[z != 0] paste(z,collapse=' ') })) # remove empty strings rows - rows[names(rows) != ] if (!is.null(rows)){ return(names(rows)[which.max(rows)])# return(table(names(rows))) } else return(NULL) }) I am trying to get frequencies of all the sequences instead of most repeated using return(table(names(rows))). But i could not get the desired results (i mean frequencies of all possible sequences)e.g. for first sector the result should be 1 3 and so on. Please suggest me some suitable way. Thanks Muhammad Azam [[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] relsurv package
For the second question, try something like: strptime('12/4/1996','%M/%d/%Y') [1] 1996-09-04 00:12:00 # only date? as.Date(strptime('12/4/1996','%M/%d/%Y')) [1] 1996-09-04 Yihui On Wed, Sep 10, 2008 at 4:22 PM, Giulia Barbati [EMAIL PROTECTED] wrote: Dear R-users, I have a couple of questions about the relsurv package: 1) when I try to run the example: fit - rsmul(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365.24,sex=sex,year=year),ratetable=slopop,data=rdata) with the datasets in the package (rdata and slopop) it gives me an error: Error in nrow(x) : object x not found 2) If I have a date format like:6/17/1997 9/10/1990 12/4/1996 how to convert it in the Rdate format required by ratetable? Thank you very much for help, Giulia -- Yihui Xie [EMAIL PROTECTED] Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China __ 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] code of an R function {probably easy methods question}
DScottNZ == David Scott [EMAIL PROTECTED] on Wed, 10 Sep 2008 11:29:31 +1200 (NZST) writes: DScottNZ On Tue, 9 Sep 2008, Edna Bell wrote: Dear R Gurus: I want to look at the code for the t.test function. I did the following: t.test function (x, ...) UseMethod(t.test) environment: namespace:stats getAnywhere(t.test) A single object matching 't.test' was found It was found in the following places package:stats registered S3 method for t from namespace stats namespace:stats with value function (x, ...) UseMethod(t.test) environment: namespace:stats methods(t.test) [1] t.test.default* t.test.formula* Non-visible functions are asterisked Ok. Now what, please? I'm sure it's really simple. DScottNZ getAnywhere(t.test.default) yes, or in this case, stats:::t.test.default *HOWEVER* this does *NOT* give you the code for the t.test() function in the strict sense. It gives you the (print() of the) parsed and deparsed version of the code. The source code typically also has *comments* and may have been (and typically is - with standard R code) written indented and formatted *better* than what you print() does. To see the source code you must look at the *source*, i.e., into the source file, typically foo.R in directory pkg/R/ For standard R, the source is not only packed in the R-version.tar.gz file you can get from CRAN, but also available via subversion and (less powerfully) via a web browser, pointing to https://svn.R-project.org/R/ E.g. for the R 2.7.2 version of t.test https://svn.r-project.org/R/tags/R-2-7-2/src/library/stats/R/t.test.R or for the always latest R-devel version -- currently identical to the 2.7.2 one: https://svn.r-project.org/R/trunk/src/library/stats/R/t.test.R Note that most people would want to *search* in the R sources, and therefore still get the complete R sources (either by subversion or from a *.tar.gz file, from CRAN). Yes, Uwe Ligges wrote an R News (2006 (4), p.43-45) article on the theme... See R homepage - Newsletter, or directly (currently) http://www.r-project.org/doc/Rnews/ Martin Maechler, ETH Zurich __ 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] Hardwarefor R cpu 64 vs 32, dual vs quad
Nic, I'd buy a Mac Power server. Not that's much faster, but while one of the cores toils away at R you can play games on the others :-)-O el on 9/9/08 8:54 PM Henrik Bengtsson said the following: On Tue, Sep 9, 2008 at 6:31 AM, Nic Larson [EMAIL PROTECTED] wrote: Need to buy fast computer for running R on. Today we use 2,8 MHz intel D cpu and the calculations takes around 15 days. Is it possible to get the same calculations down to minutes/hours by only changing the hardware? Should I go for an really fast dual 32 bit cpu and run R over linux or xp or go for an quad core / 64 bit cpu? Is it effective to run R on 64 bit (and problem free (running/installing))??? Have around 2000-3000 euro to spend Faster machines won't do that much. Without knowing what methods and algorithms you are running, I bet you a beer that it can be made twice as fast by just optimizing the code. My claim applies recursively. In other words, by optimizing the algorithms/code you can speed up things quite a bit. From experience, it is not unlikely to find bottlenecks in generic algorithms that can be made 10-100 times faster. Here is *one* example illustrating that even when you think the code is fully optimized you can still squeeze out more: http://wiki.r-project.org/rwiki/doku.php?id=tips:programming:code_optim2 So, start profiling your code to narrow down the parts that takes most of the CPU time. help(Rprof) is a start. There is also a Section 'Profiling R code for speed' in 'Writing R Extensions'. Good old verbose print out of system.time() also helps. My $.02 ...or 2000-3000USD if it was bounty?! ;) /Henrik Thanx for any tip [[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. -- Dr. Eberhard W. Lisse \/ Obstetrician Gynaecologist (Saar) [EMAIL PROTECTED] el108-ARIN / * | Telephone: +264 81 124 6733 (cell) PO Box 8421 \ / Please do NOT email to this address Bachbrecht, Namibia ;/if it is DNS related in ANY way __ 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] New Amsterdam course Pharmacokinetic and pharmacodynamic modeling and simulation
Dear Mr./Mrs., I would like to inform you about the new course Pharmacokinetic and pharmacodynamic modeling and simulation by Dr. Jan Freijer in Amsterdam, November 28th. The course is meant for users of R or S-PLUS in the bio-pharmaceutical sciences who would like to use R for clinical trial simulations. You can find the full information on the course via: http://www.can.nl/events/details.php?id=57 Price for the course is EURO 395,- VAT excluded and you can subscribe via web site, email(reply), fax (+31 (0)20 5608448) or post (CAN - Nieuwpoortkade 25 - 1055 RX Amsterdam). If you have any questions, please feel free to contact me. Best Regards, Gosé Fischer Mathematica, S-PLUS and Maple Training Finance Courses Maple TA - Automated Online Testing Assessment - FREE Workshops Check out our complete event list at: http://www.can.nl/events/ _ ir. Gosé Fischer, account manager CANdiensten, Nieuwpoortkade 23-25, NL-1055 RX Amsterdam voice: +31 20 5608430 fax: +31 20 5608448 [EMAIL PROTECTED] _ Your Partner in Finance, Mathematics and Statistics! __ 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] cluster/snow question
Dear R Users, Apologies for a somewhat basic cluster question. I am trying to come to grips with how variables are instantiated within the environment of each node in a cluster. When I run the following code, I expect to see the variable x in the environment of each node, but fail to do so. What am I doing wrong ? library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment, but get back the same result as in the call above stopCluster(cl) library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) [[1]] [1] args fun [[2]] [1] args fun x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment [[1]] [1] args fun [[2]] [1] args fun stopCluster(cl) Thanks in advance, Tolga Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[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] relsurv package
On Wed, 10 Sep 2008, Yihui Xie wrote: For the second question, try something like: strptime('12/4/1996','%M/%d/%Y') [1] 1996-09-04 00:12:00 # only date? as.Date(strptime('12/4/1996','%M/%d/%Y')) [1] 1996-09-04 Why not as.Date('12/4/1996', format = '%m/%d/%Y') [1] 1996-12-04 ? (And note the typo in your solution and hence incorrect answer.) Yihui On Wed, Sep 10, 2008 at 4:22 PM, Giulia Barbati [EMAIL PROTECTED] wrote: Dear R-users, I have a couple of questions about the relsurv package: 1) when I try to run the example: fit - rsmul(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365.24,sex=sex,year=year),ratetable=slopop,data=rdata) with the datasets in the package (rdata and slopop) it gives me an error: Error in nrow(x) : object x not found 2) If I have a date format like:6/17/1997 9/10/1990 12/4/1996 how to convert it in the Rdate format required by ratetable? Thank you very much for help, Giulia -- Yihui Xie [EMAIL PROTECTED] Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China __ 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. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] cluster/snow question
Hi Tolga, I am not sure why ls() is showing only args and fun. But x is at the nodes. Try this: clusterEvalQ(cl,x-x+3) [[1]] [1] 4 [[2]] [1] 4 clusterCall(cl,function()x+5) [[1]] [1] 9 [[2]] [1] 9 Best Markus [EMAIL PROTECTED] schrieb: Dear R Users, Apologies for a somewhat basic cluster question. I am trying to come to grips with how variables are instantiated within the environment of each node in a cluster. When I run the following code, I expect to see the variable x in the environment of each node, but fail to do so. What am I doing wrong ? library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment, but get back the same result as in the call above stopCluster(cl) library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) [[1]] [1] args fun [[2]] [1] args fun x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment [[1]] [1] args fun [[2]] [1] args fun stopCluster(cl) Thanks in advance, Tolga Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[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. -- Dipl.-Tech. Math. Markus Schmidberger Ludwig-Maximilians-Universität München IBE - Institut für medizinische Informationsverarbeitung, Biometrie und Epidemiologie Marchioninistr. 15, D-81377 Muenchen URL: http://ibe.web.med.uni-muenchen.de Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de Tel: +49 (089) 7095 - 4599 __ 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] Genmod in SAS vs. glm in R
Whats the R equivalent for Proc logistic in SAS ? Is there a stepwise method there ? How to create scoring models in R , for larger datasets (200 mb), Is there a way to compress and use datasets (like options compress=yes;) Ajay On Wed, Sep 10, 2008 at 11:12 AM, Peter Dalgaard [EMAIL PROTECTED] wrote: Rolf Turner wrote: For one thing your call to glm() is wrong --- didn't you notice the warning messages about ``non-integer #successes in a binomial glm!''? You need to do either: glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y), weights=k) or: glm(cbind(r,k-r) ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y)) You get the same answer with either, but this answer still does not agree with your SAS results. Perhaps you have an error in your SAS syntax as well. I wouldn't know. The data created in the data step are not those used in the analysis. Changing to data nelson; etc gives the same result as R on the versions I have available: Analysis Of Parameter Estimates Standard Wald 95% Confidence Chi- ParameterDFEstimate Error Limits SquarePr ChiSq Intercept 1 -3.5866 2.2413 -7.9795 0.8064 2.560.1096 x 1 0.9544 2.8362 -4.6046 6.5133 0.110.7365 Scale 0 1. 0. 1. 1. and Call: glm(formula = r/k ~ x, family = binomial(link = cloglog), data = bin_data, weights = k, offset = log(y)) Deviance Residuals: 1234 0.5407 -0.9448 -1.0727 0.7585 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) -3.5866 2.2413 -1.6000.110 x 0.9544 2.8362 0.3360.736 cheers, Rolf Turner On 10/09/2008, at 10:37 AM, sandsky wrote: Hello, I have different results from these two softwares for a simple binomial GLM problem. From Genmod in SAS: LogLikelihood=-4.75, coeff(intercept)=-3.59, coeff(x)=0.95 From glm in R: LogLikelihood=-0.94, coeff(intercept)=-3.99, coeff(x)=1.36 Is there anyone tell me what I did wrong? Here are the code and results, 1) SAS Genmod: % r: # of failure % k: size of a risk set data bin_data; input r k y x; os=log(y); cards; 1350.5 0250.5 0241.0 1241.0 ; proc genmod data=nelson; model r/k = x / dist = binomial link =cloglog offset = os ; Results from SAS Log Likelihood -4.7514 ParameterDFEstimate Error Limits SquarePr ChiSq Intercept 1 -3.6652 1.9875 -7.5605 0.2302 3.400.0652 x1 0.8926 2.4900 -3.9877 5.7728 0.130.7200 Scale 0 1. 0. 1. 1. 2) glm in R bin_data - data.frame(cbind(y=c(5,5,4,4),r=c(1,0,0,1),k=c(3,2,2,2),x=c(0.5,0.5,1.0,1.0))) glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y)) Results from R Coefficients: (Intercept)x -3.9911.358 'log Lik.' -0.9400073 (df=2) ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Regards, Ajay Ohri http://tinyurl.com/liajayohri __ 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] request: table of sequences
Dear R community Thanks. The problem has been solved by just using return(rows) Muhammad Azam [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with 'spectrum'
Hello, [...] -- Message: 41 Date: Tue, 9 Sep 2008 9:44:34 -0700 From: [EMAIL PROTECTED] Subject: [R] Help with 'spectrum' To: r-help@r-project.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=utf-8 For the command 'spectrum' I read: The spectrum here is defined with scaling 1/frequency(x), following S-PLUS. This makes the spectral density a density over the range (-frequency(x)/2, +frequency(x)/2], whereas a more common scaling is 2? and range (-0.5, 0.5] (e.g., Bloomfield) or 1 and range (-?, ?]. Forgive my ignorance but I am having a hard time interpreting this. ... Hehe, better ignore, if it's unclear ;-) The term frequency might be used differently, depending on the context. :) I just want to add a note regarding fft(vect). fft() for example does not scale with 1/n (n is length(vect)). This is, how fft() is used like a continous forier transform. The discrete fourier transform is defined with 1/N (N here is te nmber of samples). This would mean, that fft() even if it is working on discrete data, is calculatd like the classical non-discrete fourier transform. To get a DFT out of fft() one must divide by length of the used vector. On the other hand, fft()'s result is then really rather a FFT than a DFT and therefore the name of that function is good choice, IMHO. But I'm just new to R and there may be more issues that one can think about. spectrum() for me also is new and I didn't looked at it in detail. As far as I understand, the result is divided by a factor also. The R-Help enry for frequency gives:00 'frequency' returns the number of samples per unit time. Maybe that means 1/N ? But I'm not used to R's timeseries attributes, so I can't give you more help here. BTW: I've bought the book from Venable and Ripley and it's quite good. There you can find many hints. If it is sufficient information to you, I don't know. But it's a good fingerpost I think. 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] Genmod in SAS vs. glm in R
Ajay ohri wrote: Whats the R equivalent for Proc logistic in SAS ? glm with the appropriate family (binomial) and link, I guess. There is a book 'R for SAS and SPSS users' forthcoming http://www.springer.com/statistics/computational/book/978-0-387-09417-5 Is there a stepwise method there ? See library(MASS) ?stepAIC for an example; the following might provide a useful read on stepwise methods: http://www.pitt.edu/~wpilib/statfaq/regrfaq.html How to create scoring models in R , for larger datasets (200 mb), Is there a way to compress and use datasets (like options compress=yes;) Fit the model using glm and 'score' using the predict method. 200 Mb isn't that large anymore, but see Thomas Lumley's biglm package for a bounded-memory version if you're working on limited hardware. HTH, Tobias On Wed, Sep 10, 2008 at 11:12 AM, Peter Dalgaard [EMAIL PROTECTED] wrote: Rolf Turner wrote: For one thing your call to glm() is wrong --- didn't you notice the warning messages about ``non-integer #successes in a binomial glm!''? You need to do either: glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y), weights=k) or: glm(cbind(r,k-r) ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y)) You get the same answer with either, but this answer still does not agree with your SAS results. Perhaps you have an error in your SAS syntax as well. I wouldn't know. The data created in the data step are not those used in the analysis. Changing to data nelson; etc gives the same result as R on the versions I have available: Analysis Of Parameter Estimates Standard Wald 95% Confidence Chi- ParameterDFEstimate Error Limits SquarePr ChiSq Intercept 1 -3.5866 2.2413 -7.9795 0.8064 2.560.1096 x 1 0.9544 2.8362 -4.6046 6.5133 0.110.7365 Scale 0 1. 0. 1. 1. and Call: glm(formula = r/k ~ x, family = binomial(link = cloglog), data = bin_data, weights = k, offset = log(y)) Deviance Residuals: 1234 0.5407 -0.9448 -1.0727 0.7585 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) -3.5866 2.2413 -1.6000.110 x 0.9544 2.8362 0.3360.736 cheers, Rolf Turner On 10/09/2008, at 10:37 AM, sandsky wrote: Hello, I have different results from these two softwares for a simple binomial GLM problem. From Genmod in SAS: LogLikelihood=-4.75, coeff(intercept)=-3.59, coeff(x)=0.95 From glm in R: LogLikelihood=-0.94, coeff(intercept)=-3.99, coeff(x)=1.36 Is there anyone tell me what I did wrong? Here are the code and results, 1) SAS Genmod: % r: # of failure % k: size of a risk set data bin_data; input r k y x; os=log(y); cards; 1350.5 0250.5 0241.0 1241.0 ; proc genmod data=nelson; model r/k = x / dist = binomial link =cloglog offset = os ; Results from SAS Log Likelihood -4.7514 ParameterDFEstimate Error Limits SquarePr ChiSq Intercept 1 -3.6652 1.9875 -7.5605 0.2302 3.400.0652 x1 0.8926 2.4900 -3.9877 5.7728 0.130.7200 Scale 0 1. 0. 1. 1. 2) glm in R bin_data - data.frame(cbind(y=c(5,5,4,4),r=c(1,0,0,1),k=c(3,2,2,2),x=c(0.5,0.5,1.0,1.0))) glm(r/k ~ x, family=binomial(link='cloglog'), data=bin_data, offset=log(y)) Results from R Coefficients: (Intercept)x -3.9911.358 'log Lik.' -0.9400073 (df=2) ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list
Re: [R] Compiling date
It is a mixture of both. The data is so notorious excel cant format properly. Therefore I thought whether R can do something otherwise I have to do manually. --- On Tue, 9/9/08, Dr Eberhard W Lisse [EMAIL PROTECTED] wrote: From: Dr Eberhard W Lisse [EMAIL PROTECTED] Subject: Re: [R] Compiling date To: David Scott [EMAIL PROTECTED] Cc: Dr Eberhard W Lisse [EMAIL PROTECTED], Megh Dal [EMAIL PROTECTED], [EMAIL PROTECTED] Date: Tuesday, September 9, 2008, 11:37 PM Is this Month-Day or Day-Month or a mixture of both? I still think using the Format - Cell - Date will work much better... el On 09 Sep 2008, at 11:21 , David Scott wrote: On Mon, 8 Sep 2008, Megh Dal wrote: Hi, I have following kind of dataset (all are dates) in my Excel sheet. 09/08/08 09/05/08 09/04/08 09/02/08 09/01/08 29/08/2008 28/08/2008 27/08/2008 26/08/2008 25/08/2008 22/08/2008 21/08/2008 20/08/2008 18/08/2008 14/08/2008 13/08/2008 08/12/08 08/11/08 08/08/08 08/07/08 However I want to use R to compile those data to make all dates in same format. Can anyone please tell me any automated way for doing that? Well you have to read them in as character first. Then use sub to make the two digit years into four digits. The following could probably be improved by a regular expression whiz, but works: strngs - c(06/05/08,23/11/2008) sub(([0-9][0-9]/[0-9][0-9]/)([0-9][0-9]$),\\120\\2,strngs) [1] 06/05/2008 23/11/2008 David Scott __ 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] Modality Test
Hi Bert, ## returns TRUE only if the distributions are the same ... Thanks for the elegant code. Problem is, the result is elusive, constantly slipping from view and then rolling into the dip. Perhaps it's broken in this version of R (2.7.2.Patched). A fix would therefore be much appreciated, as I may need to use it again in the near future. A little example follows: ## p1 - rnorm(100, 10, 5) p2 - rnorm(100, 35, 5) equaldist(p1, p2) [1] FALSE equaldist(c(p1,p2), c(p2,p1)) [1] FALSE plot(density(c(p1, p2)), main=Twin Peaks) lines(c(p1,p2)) ? Regards, Mark. Bert Gunter wrote: Here is a function that tests for equality of however many distributions as you like: equaldist - function(...){ ## ... numeric sample vectors from the possibly different distributions to be tested ## returns TRUE only if the distributions are the same FALSE } ;-) -- Bert Gunter Genentech -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Difford Sent: Tuesday, September 09, 2008 1:23 PM To: r-help@r-project.org Subject: Re: [R] Modality Test Hi Amin, And I have just remembered that there is a function called curveRep in Frank Harrell's Hmisc package that might be useful, even if not quite in the channel of your enquiry. curveRep was added to the package after my struggles, so I never used it and so don't know how well it performs (quite well, I would think). Regards, Mark. Amin W. Mugera wrote: Dear Readers: I have two issues in nonparametric statistical analysis that i need help: First, does R have a package that can implement the multimodality test, e.g., the Silverman test, DIP test, MAP test or Runt test. I have seen an earlier thread (sometime in 2003) where someone was trying to write a code for the Silverman test of multimodality. Is there any other tests that can enable me to know how many modes are in a distribution? Second, i would like to test whether two distributions are equal. Does R have a package than can implement the Li (1996) test of the equality of two distributions? Is there any other test i can use rather than the Li test? Thank you in advance for your help. Amin Mugera Graduate Student AgEcon Dept. Kansas State University __ 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. -- View this message in context: http://www.nabble.com/Modality-Test-tp19396085p19400426.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. -- View this message in context: http://www.nabble.com/Modality-Test-tp19396085p19412015.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 find where is the space in data
I have following 1975 01 7711.16 Here I need to identify where the space is there and then concatenate rest of the digits without space, i.e. I want to have 1975017711.16. Is there any R function? Regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: error handling in try
Why don't you use 'try' in this fashion: f.error - function(x) if (x == 1) stop('error') value - try(f.error(1)) Error in f.error(1) : error if (inherits(value, 'try-error')) cat(Got this error:, value) else print (no error) Got this error: Error in f.error(1) : error value - try(f.error(0)) # no error if (inherits(value, 'try-error')) cat (Got this error:, value) else print(no error) [1] no error On Tue, Sep 9, 2008 at 8:56 PM, Andy Zhu [EMAIL PROTECTED] wrote: First time to post and searched archive for this problem with no clue. My version is 2.5.1. Below is a function to check if a given date is a valid date to a given date function object. It uses try (also tried tryCatch but with same problem). When given an invalid date, I am hoping try will generate en error message which would be picked up by the geterrmessage and thus expecting a false result. but this is not the case when it is inside a function. However, if simply run the body of function, the ret is indeed a false value. Why are they different? Many thanks is.Date= # adate: a scalar value # fun: the date function object # format: the designated date format to date function function(adate,fun,format) { ret=NA; error.old=geterrmessage(); .Internal(seterrmessage('no error')); try(fun(adate,format),silent=T); error=geterrmessage(); if (error=='no error') { ret=T; } else { ret=F; } .Internal(seterrmessage(error.old)); return(ret); } adate='12/2000'; fun=as.Date; format='%b %Y'; is.Date(adate,fun,format) # returns true which is not correct. ret=NA; error.old=geterrmessage(); .Internal(seterrmessage('no error')); try(fun(adate,format),silent=T); error=geterrmessage(); if (error=='no error') { ret=T; } else { ret=F; } .Internal(seterrmessage(error.old)); ret # shows false which is correct [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to find where is the space in data
Is this what you want: gsub( , , 1975 01 7711.16) [1] 1975017711.16 On Wed, Sep 10, 2008 at 8:07 AM, Megh Dal [EMAIL PROTECTED] wrote: I have following 1975 01 7711.16 Here I need to identify where the space is there and then concatenate rest of the digits without space, i.e. I want to have 1975017711.16. Is there any R function? Regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] cluster/snow question
Many thanks. Yes, weird, somehow ls does not show the variables in the environment, even though they are clearly there. It would be nice to understand why that is the case, just to be clear about what is going on. Thanks Markus, Tolga Markus Schmidberger [EMAIL PROTECTED] 10/09/2008 10:45 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc r-help@r-project.org Subject Re: [R] cluster/snow question Hi Tolga, I am not sure why ls() is showing only args and fun. But x is at the nodes. Try this: clusterEvalQ(cl,x-x+3) [[1]] [1] 4 [[2]] [1] 4 clusterCall(cl,function()x+5) [[1]] [1] 9 [[2]] [1] 9 Best Markus [EMAIL PROTECTED] schrieb: Dear R Users, Apologies for a somewhat basic cluster question. I am trying to come to grips with how variables are instantiated within the environment of each node in a cluster. When I run the following code, I expect to see the variable x in the environment of each node, but fail to do so. What am I doing wrong ? library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment, but get back the same result as in the call above stopCluster(cl) library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) [[1]] [1] args fun [[2]] [1] args fun x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment [[1]] [1] args fun [[2]] [1] args fun stopCluster(cl) Thanks in advance, Tolga Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[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. -- Dipl.-Tech. Math. Markus Schmidberger Ludwig-Maximilians-Universität München IBE - Institut für medizinische Informationsverarbeitung, Biometrie und Epidemiologie Marchioninistr. 15, D-81377 Muenchen URL: http://ibe.web.med.uni-muenchen.de Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de Tel: +49 (089) 7095 - 4599 Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure,
Re: [R] How to find where is the space in data
on 09/10/2008 07:07 AM Megh Dal wrote: I have following 1975 01 7711.16 Here I need to identify where the space is there and then concatenate rest of the digits without space, i.e. I want to have 1975017711.16. Is there any R function? See ?gsub: # Strip out blanks gsub( , , 1975 01 7711.16) [1] 1975017711.16 # Strip out non-numeric or decimal gsub([^0-9\\.], , 1975 01 7711.16) [1] 1975017711.16 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.
[R] Problem with dir.create in windows servers
Hello. I've being having problems to create directories in a windows server environment . It seems that the recursive argument is not working properly on the intranet, as it does in a local path. For example: dir.create(server/directory1/directory2) , this works fine, and creates the directory2, but If we want to create the directory3 and another directory called directory4 inside of it. dir.create(server/directory1/directory3/directory4, recursive=T) fails, and don't create any directory. The ShowWarning doesn't show any message. Any help please. Fran. __ 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] WG: Re: NMDS and varimax rotation
hello, thanks a lot for your help. @ Stephen: In my opinion the proscrutes rotation is more used to compare the alignment of different ordination methods. But maybe I'm wrong. @ Bill: Thanks for the comprehensive description. That was the information I was looking for. Greetings, Bernd Panassiti __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] PCA and % variance explained
Thanks everyone, Paul -- View this message in context: http://www.nabble.com/PCA-and---variance-explained-tp19388970p19410675.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 find where is the space in data
Try this: str - 1975 01 7711.16 # Find the position of the space in string gregexpr([[:space:]], str) # Remove the space gsub([[:space:]], , str) On Wed, Sep 10, 2008 at 9:07 AM, Megh Dal [EMAIL PROTECTED] wrote: I have following 1975 01 7711.16 Here I need to identify where the space is there and then concatenate rest of the digits without space, i.e. I want to have 1975017711.16. Is there any R function? Regards, __ 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 [[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] randomForest
Hi Kate, Things that can reasonably be combined will appear in the combined randomForest object. Those that cannot are set to NULL. I believe variable importance is kept, and possibly (pseudo) r-squared as well. Best, Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kate Behrman Sent: Tuesday, September 09, 2008 1:53 PM To: r-help@r-project.org Subject: [R] randomForest I am combining many different random forest objects run on the same data set using the combine ( ) function. After combining the forests I am not sure whether the variable importance, local importance, and rsq predictors are recalculated for the new random forest object or are calculated individually for each tree ensemble? Is it possible to calculate these predictors for the new random forest object after calling the combine function? Any help would be greatly apprecaited. Thanks, Kate [[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. Notice: This e-mail message, together with any attachme...{{dropped:12}} __ 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] smoothing with the Gaussian kernel
Use ksmooth(x, y, kernel=normal) Andy From: dxc13 useR's, Does anyone know what function or package allows one to specify use of the Gaussian kernel to smooth a data set, or is this just the default for most functions? Thanks, dxc13 -- View this message in context: http://www.nabble.com/smoothing-with-the-Gaussian-kernel-tp193 23294p19323294.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:12}} __ 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] cluster/snow question
ls() looks in its calling environment, which in this case would be the internals of the snow mechnism. If you want ls of the global environment use one of clusterEvalQ(cl, ls()) clusterCall(cl, ls, .GlobalEnv) luke On Wed, 10 Sep 2008, [EMAIL PROTECTED] wrote: Many thanks. Yes, weird, somehow ls does not show the variables in the environment, even though they are clearly there. It would be nice to understand why that is the case, just to be clear about what is going on. Thanks Markus, Tolga Markus Schmidberger [EMAIL PROTECTED] 10/09/2008 10:45 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc r-help@r-project.org Subject Re: [R] cluster/snow question Hi Tolga, I am not sure why ls() is showing only args and fun. But x is at the nodes. Try this: clusterEvalQ(cl,x-x+3) [[1]] [1] 4 [[2]] [1] 4 clusterCall(cl,function()x+5) [[1]] [1] 9 [[2]] [1] 9 Best Markus [EMAIL PROTECTED] schrieb: Dear R Users, Apologies for a somewhat basic cluster question. I am trying to come to grips with how variables are instantiated within the environment of each node in a cluster. When I run the following code, I expect to see the variable x in the environment of each node, but fail to do so. What am I doing wrong ? library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment, but get back the same result as in the call above stopCluster(cl) library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) [[1]] [1] args fun [[2]] [1] args fun x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment [[1]] [1] args fun [[2]] [1] args fun stopCluster(cl) Thanks in advance, Tolga Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[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. -- Dipl.-Tech. Math. Markus Schmidberger Ludwig-Maximilians-Universit?? M??chen IBE - Institut f?? medizinische Informationsverarbeitung, Biometrie und Epidemiologie Marchioninistr. 15, D-81377 Muenchen URL: http://ibe.web.med.uni-muenchen.de Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de Tel: +49 (089) 7095 - 4599 Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain
[R] isolating X on an expression
Dear R-gurus, I know that it is not a R problem, but as need to implement some solution for this on R, I would like to know if someone help me on how to isolate X on the expression below. K=(sen A * sen B ) + ( cos A * cos B * cos ( X - Y ) ) Any help are welcome mitinho astronauta brazil [[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] Mixed effects model with binomial errors - problem
Hi, We released individual birds into a room with 2 trees. We counted the number of visits to each of the 2 tree. One of the trees is always a control tree and the other tree is either treatment 1, treatment 2 or treatment3 or treatment 4. Ind Treat ContrTree ExpTree Total visits 1 1 11 16 27 1 2 6 9 15 1 3 5 13 18 1 4 11 25 36 2 1 2 3 5 4 1 6 7 13 4 3 4 4 8 4 4 2 5 7 6 1 1 1 2 6 4 5 16 21 etc etc (as you see, not all treatments are included for all individuals) Our question is if the proportion of visits to the experimental tree, in relation to the total number of visits to both trees differs between treatments. We have made treatment and individual into a factor All individuals were subjected to a maximum of 4 treatments, so 'individual' is a random factor We came up with this model: model1-lmer(cbind(ExpTree,Total visits-ExpTree)~ Treat +(1|Ind),method=ML , family=binomial, data=r)) However, the error we get is this: Error in match.arg(method, c(Laplace, AGQ)) : 'arg' should be one of “Laplace”, “AGQ” HELP! -- View this message in context: http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19413327.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] Compiling date
So, am I correct that each datum is either of the form mm/dd/yy or of the form dd/mm/? If that is correct, then the following should work, and takes care of converting 99 to 1999 instead of 2099: dates - c(06/15/07,04/09/99,20/03/2008) short - grep(\\d\\d/\\d\\d/\\d\\d$, dates, perl=TRUE) dates[short] - format(strptime(dates[short], format=%m/%d/%y), format=%d/%m/%Y) Or Henrique's suggestion, slightly modified: strptime(dates, ifelse(nchar(dates) == 8, '%m/%d/%y', '%d/%m/%Y')) Haris Skiadas Department of Mathematics and Computer Science Hanover College On Sep 10, 2008, at 7:40 AM, Megh Dal wrote: It is a mixture of both. The data is so notorious excel cant format properly. Therefore I thought whether R can do something otherwise I have to do manually. --- On Tue, 9/9/08, Dr Eberhard W Lisse [EMAIL PROTECTED] wrote: From: Dr Eberhard W Lisse [EMAIL PROTECTED] Subject: Re: [R] Compiling date To: David Scott [EMAIL PROTECTED] Cc: Dr Eberhard W Lisse [EMAIL PROTECTED], Megh Dal [EMAIL PROTECTED], [EMAIL PROTECTED] Date: Tuesday, September 9, 2008, 11:37 PM Is this Month-Day or Day-Month or a mixture of both? I still think using the Format - Cell - Date will work much better... el On 09 Sep 2008, at 11:21 , David Scott wrote: On Mon, 8 Sep 2008, Megh Dal wrote: Hi, I have following kind of dataset (all are dates) in my Excel sheet. 09/08/08 09/05/08 09/04/08 09/02/08 09/01/08 29/08/2008 28/08/2008 27/08/2008 26/08/2008 25/08/2008 22/08/2008 21/08/2008 20/08/2008 18/08/2008 14/08/2008 13/08/2008 08/12/08 08/11/08 08/08/08 08/07/08 However I want to use R to compile those data to make all dates in same format. Can anyone please tell me any automated way for doing that? Well you have to read them in as character first. Then use sub to make the two digit years into four digits. The following could probably be improved by a regular expression whiz, but works: strngs - c(06/05/08,23/11/2008) sub(([0-9][0-9]/[0-9][0-9]/)([0-9][0-9]$),\\120\\2,strngs) [1] 06/05/2008 23/11/2008 David Scott __ 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] writing simple function through script
Hi all, I try to write a simple function in a script. The script is as follows yo-function(Xdata) { n-length(Xdata[,1]) Lgm-nls(formula=LgmFormula, data=Xdata, start=list(a=1500,b=0.1),weights=Xdata$Qe) return(Lgm) } After the execution of the script, when I call the function yo on data called NC60.DATA I get an error. #yo(NC60.DATA) Erreur dans eval(expr, envir, enclos) : objet Xdata not found The object Xdata isn't found. Why? Is that possible to debug a function with R? Regards/Cordialement - Benoit Boulinguiez Ph.D Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 Sciences Chimiques de Rennes Campus de Beaulieu, 263 Avenue du Général Leclerc 35700 Rennes, France Tel 33 (0)2 23 23 80 83 Fax 33 (0)2 23 23 81 20 http://www.ensc-rennes.fr/ [[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] A question about the hypergeometric distribution and phyper()
Dear All I have a question about the hypergeomteric distribution. Example 1: I have a universe of 6187 objects, and 164 have a particular attribute, therefore 6187-164 do not have that attribute. I sample 249 of those objects, and find that 19 have that attribute. I get a p-value here (looking at just over-representation): phyper(19, 164, 6187-164, 249, lower.tail=FALSE) [1] 7.816235e-06 Example 2: I have a universe of 6187 objects, and 12 have a particular attribute, therefore 6187-12 do not have that attribute. I sample 249 of those objects, and find that 4 have that attribute. I get a p-value here (looking at just over-representation): phyper(4, 12, 6187-12, 249, lower.tail=FALSE) [1] 6.368919e-05 It seems to me that the probability of seeing 19 out of 164 in a sample of 249 being less than the probability of seeing 4 out of 12 in a sample of the same size is counter-intuitive. First off, am I using phyper() properly? Secondly, can someone point me to some documentation explaining why these seemingly counter-intuitive p-values occur? Thanks Mick __ 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] randomForest partial dependence plots
The partial dependence at X1=x is simply the average of predicted response at all data points, holding X1=x. No additional `normalization' is done. That web link says the image does not exist. Andy From: Christopher Schwalm Hello ALL, I'm unsure how to interpret partial dependence plots and had 2 questions: Does the randomForest library scale partial dependence plots such that zero on the y axis is mean(y)? I am also unclear as to why the range of y on these plots is smaller than what is in the dataset. Also I have noticed that partial dependence plots cluster around the mean response. That is, if I'm looking at the partial dependence plot of y given x1, x2, x3 and I standardize the x's (so they scale sensibly to be displayed on one graph) then everything seems to meet at mean(y) and z-score of 0 for all x's. The match is not exact but is close and shows up in all partial dependence plots I've looked at for this particular project. A sample graph of this is here: img213 imagevenue com/img php?image=48746_partial_plot_122_538lo jpg [replace spaces with dots, this bounces otherwise] I am unsure if this means anything or if it's built in (like a SLR going thru the mean of x an y). I should note that for this example I have assumed that the y-axis is not scaled somehow (see first question). Any insight appreciated. Thanks for your time. Christopher __ 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:12}} __ 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] yahoo finance into R
Yahoo and OandA provide only daily data, but the history goes back quite a ways: msft - get.hist.quote(instrument=MSFT, start=1986-03-31, end=2008-09-10, quote=c(O,H,L,C,A,V), provider=yahoo, retclass=zoo) NROW(msft) [1] 5663 That's 22 years of data. Not sure what you were expecting. David L. Reiner, PhD Head Quant Rho Trading Securities, LLC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of thomastos Sent: Tuesday, September 09, 2008 10:18 PM To: r-help@r-project.org Subject: Re: [R] yahoo finance into R thanks a lot. i thought it was more difficult. however i am dissapointed that i get so little data. thanks again thomas Peter Dalgaard wrote: thomastos wrote: Hi R, I am familiar with the basics of R. To learn more I would like how to get data from Yahoo!finance directly into R. So basically I want a data frame or matrix to do some data analysis. How do I do this? RSiteSearch(yahoo) get.hist.quote() from tseries yahooSeries() from fImport (untried) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/yahoo-finance-into-R-tp19385481p19405623.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] writing simple function through script
Its looking in environment(LgmFormula) for Xdata in order to evaluate Xdata$Qe in the weights argument so just specify weights = Qe. Alternately insert the following as the beginning of yo. It creates a new local LgmFormula but with its environment set to the current environment: environment(LgmFormula) - environment() See the Environment section of ?formula On Wed, Sep 10, 2008 at 9:22 AM, Benoit Boulinguiez [EMAIL PROTECTED] wrote: Hi all, I try to write a simple function in a script. The script is as follows yo-function(Xdata) { n-length(Xdata[,1]) Lgm-nls(formula=LgmFormula, data=Xdata, start=list(a=1500,b=0.1),weights=Xdata$Qe) return(Lgm) } After the execution of the script, when I call the function yo on data called NC60.DATA I get an error. #yo(NC60.DATA) Erreur dans eval(expr, envir, enclos) : objet Xdata not found The object Xdata isn't found. Why? Is that possible to debug a function with R? Regards/Cordialement - Benoit Boulinguiez Ph.D Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 Sciences Chimiques de Rennes Campus de Beaulieu, 263 Avenue du Général Leclerc 35700 Rennes, France Tel 33 (0)2 23 23 80 83 Fax 33 (0)2 23 23 81 20 http://www.ensc-rennes.fr/ [[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] extract variance components
Take a look again at help(getVarCov). Mark Lyman, Statistician ATK Launch Systems [EMAIL PROTECTED] From: huang min [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 09, 2008 10:02 PM To: r-help@r-project.org Cc: [EMAIL PROTECTED] Subject: Re: extract variance components Hi, Thanks for all. I now know how to extract the \sigma's. For the unbalanced model y_{ijk}=x\beta+\alpha_i+\beta_{ij}+e_{ijk} i=1,2,\dots,a, j=1,2,\dots,b_i, k=1,2,\dots,n_{ij} How can I extract the variance matrix $V$? The variance for the ith group is also of help. Suppose the ith group has totally 10 observations. b_i=4, n_{i1}=1,n_{i2}=3,n_{i3}=2 and n_{i4}=1. $V_i=\sigma_a^2 J_{10}+\sigma_b^2 diag(J_1,J_3,J_2, J_1)+\sigma_e^2 I_{10}$, where I is the identity matrix and J_d is the matrix of 1's with dimention d \by d. J_d reduces to 1 if d=1. I only know how to extract the design matrix for the fixed effect by model.matrix(lme.fit2). How to deal with the parts for the random effects? Thank you. Huang On Fri, Aug 29, 2008 at 11:30 AM, huang min [EMAIL PROTECTED] wrote: HI, I would like to extract the variance components estimation in lme function like a.fit-lme(distance~age, data=aaa, random=~day/subject) There should be three variances \sigma_day, \sigma_{day %in% subject } and \sigma_e. I can extract the \sigma_e using something like a.fit$var. However, I cannot manage to extract the first two variance components. I can only see the results in summary(a.fit). I have some problem in the lme4 package and hence use the nlme package. The example data also has some problem so I just list the function here using some imaginary data set. Thank you. Huang [[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] isolating X on an expression
Try Ryacas: library(Ryacas) A - Sym(A); B - Sym(B); X - Sym(X); Y - Sym(Y); K - Sym(K) Solve(K==(sin(A) * sin(B) ) + ( cos(A) * cos(B) * cos ( X - Y ) ), X) [1] Starting Yacas! expression(list(X == Y + acos((K - sin(A) * sin(B))/(cos(A) * cos(B))), X == Y - acos((K - sin(A) * sin(B))/(cos(A) * cos(B) See home page at: http://ryacas.googlecode.com On Wed, Sep 10, 2008 at 9:09 AM, milton ruser [EMAIL PROTECTED] wrote: Dear R-gurus, I know that it is not a R problem, but as need to implement some solution for this on R, I would like to know if someone help me on how to isolate X on the expression below. K=(sen A * sen B ) + ( cos A * cos B * cos ( X - Y ) ) Any help are welcome mitinho astronauta brazil [[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] writing simple function through script
Benoit Boulinguiez benoit.boulinguiez at ensc-rennes.fr writes: yo-function(Xdata) { n-length(Xdata[,1]) Lgm-nls(formula=LgmFormula, data=Xdata, start=list(a=1500,b=0.1),weights=Xdata$Qe) return(Lgm) } After the execution of the script, when I call the function yo on data called NC60.DATA I get an error. #yo(NC60.DATA) Erreur dans eval(expr, envir, enclos) : objet Xdata not found This is my most frequently used Brian Ripley trick which I always have to look up in my examples list. Getting the environment right is the most difficult part in writing R packages Dieter DNase1 - subset(DNase, Run == 1) DNase1$Qe = rnorm(nrow(DNase1),1,0.1) LgmFormula = density ~ SSlogis(log(conc), Asym, xmid, scal) fm1DNase1 - nls(LgmFormula, DNase1) y0 = function(Xdata) { LgmFormula = density ~ SSlogis(log(conc), Asym, xmid, scal) # the following fails #nls(LgmFormula, Xdata, weights=Xdata$Qe) # Brian Ripley trick to get around an issue in lme (not only) # http://finzi.psych.upenn.edu/R/Rhelp02a/archive/16599.html eval(substitute(nls(LgmFormula,Xdata), list(form=LgmFormula))) } y0(DNase1) __ 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] A question about the hypergeometric distribution and phyper()
On 10 Sep 2008, at 15:19, michael watson (IAH-C) wrote: Example 1: I have a universe of 6187 objects, and 164 have a particular attribute, therefore 6187-164 do not have that attribute. I sample 249 of those objects, and find that 19 have that attribute. I get a p- value here (looking at just over-representation): phyper(19, 164, 6187-164, 249, lower.tail=FALSE) [1] 7.816235e-06 Actually, if you look at ?phyper, you'll see that this should be phyper(18, 164, 6187-164, 249, lower.tail=FALSE) [1] 2.775819e-05 if you want to calculate Pr(X = 19) = Pr(X 18). Similarly: phyper(4, 12, 6187-12, 249, lower.tail=FALSE) [1] 6.368919e-05 phyper(3, 12, 6187-12, 249, lower.tail=FALSE) [1] 0.0009816739 Which you'll still find counterintuitive, of course. It seems to me that the probability of seeing 19 out of 164 in a sample of 249 being less than the probability of seeing 4 out of 12 in a sample of the same size is counter-intuitive. Secondly, can someone point me to some documentation explaining why these seemingly counter-intuitive p-values occur? I think it's just because the hypergeometric distribution becomes very skewed and non-normal for expected values 1 (expectations should be roughly 6.6 in the first case and 0.5 in the second case). Perhaps it helps to visualize the two distributions? M - rbind(dhyper(0:20, 164, 6187-164, 249), dhyper(0:20, 12, 6187-12, 249)) rownames(M) - c(164 out of 6187, 12 out of 6187) colnames(M) - 0:20 barplot(M, beside=TRUE, legend = TRUE) Best regards, Stefan Evert [ [EMAIL PROTECTED] | http://purl.org/stefan.evert ] __ 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] Mixed effects model with binomial errors - problem
ok, the model does run now! but, dont i need the method=ML when i want to compare this model with a reduced model using anova(model1, model2)? The R-Book tells me that REML is not good for that (p.635) So, besides that... how do i now do a sort of posthoc test to see 1) estimates of all treatments and 2) which treatments are different from which. Luc. PS. the names are not the original names in the file Ben Bolker wrote: RFTW l.temarvelde at nioo.knaw.nl writes: Our question is if the proportion of visits to the experimental tree, in relation to the total number of visits to both trees differs between treatments. We have made treatment and individual into a factor All individuals were subjected to a maximum of 4 treatments, so 'individual' is a random factor We came up with this model: model1-lmer(cbind(ExpTree,Total visits-ExpTree)~ Treat +(1|Ind),method=ML , family=binomial, data=r)) why not leave out method=ML and see what happens? for the current iteration of lmer, REML is not a possibility in any case. The default Laplace method should work OK. I'd be slightly worried about your variable name with a space in it (`Total visits`) -- are you sure that is working as expected? For further questions along these lines I would suggest e-mailing [EMAIL PROTECTED] instead ... Ben Bolker __ 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. -- View this message in context: http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19414516.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] Return dimension index from array with n-dimensions
Hi, I have been dealing with some problems finding a fast way of getting to know in what dimension a specific value is located out of an array (like the 'which' function for a vector returns its position). Unable to find anything about this on the internet I wrote a function myself. Could you please comment if such a function already exists, and if not, please feel free to comment the function I wrote. Hopefully resulting in the integration of such a function in a R-packages. Kind regards, Niels Hintzen #Example: a - array(100:1,dim=c(5,4,5)) which(a == 7) nindex(a,7) nindex-function(array.,index.){ dims - dim(array.) ldim - length(dim(array.)) dimmy - matrix(NA,ncol=length(index.),nrow=ldim) remain - matrix(NA,ncol=length(index.),nrow=ldim) remain[1,] - index. for(i in 1:(length(dims)-1)){ dimmy[i,]- ceiling(remain[i,]/(prod(dims[1:(ldim-i)]))) dimmy[i,dimmy[i,]==0] - rev(dims)[i] remain[i+1,] - index.%%prod(dims[1:(ldim-i)]) } remain[length(remain[,1]),remain[length(remain[,1]),]==0] - dims[1] dimmy[1+(length(dims)-1),] - remain[length(remain[,1]),] dimmy - dimmy[dim(dimmy)[1]:1,] return(matrix(t(dimmy),nrow=length(index.),dimnames=list(seq(1,length(in dex.),1),dimensions=paste(dim,as.character(c(1:length(dims))),sep=)) ))} [[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] Return dimension index from array with n-dimensions
Is this what you were looking for: a - array(100:1,dim=c(5,4,5)) which(a == 7) [1] 94 which(a == 7, arr.ind=TRUE) dim1 dim2 dim3 [1,]435 On Wed, Sep 10, 2008 at 10:22 AM, Hintzen, Niels [EMAIL PROTECTED] wrote: Hi, I have been dealing with some problems finding a fast way of getting to know in what dimension a specific value is located out of an array (like the 'which' function for a vector returns its position). Unable to find anything about this on the internet I wrote a function myself. Could you please comment if such a function already exists, and if not, please feel free to comment the function I wrote. Hopefully resulting in the integration of such a function in a R-packages. Kind regards, Niels Hintzen #Example: a - array(100:1,dim=c(5,4,5)) which(a == 7) nindex(a,7) nindex-function(array.,index.){ dims - dim(array.) ldim - length(dim(array.)) dimmy - matrix(NA,ncol=length(index.),nrow=ldim) remain - matrix(NA,ncol=length(index.),nrow=ldim) remain[1,] - index. for(i in 1:(length(dims)-1)){ dimmy[i,]- ceiling(remain[i,]/(prod(dims[1:(ldim-i)]))) dimmy[i,dimmy[i,]==0] - rev(dims)[i] remain[i+1,] - index.%%prod(dims[1:(ldim-i)]) } remain[length(remain[,1]),remain[length(remain[,1]),]==0] - dims[1] dimmy[1+(length(dims)-1),] - remain[length(remain[,1]),] dimmy - dimmy[dim(dimmy)[1]:1,] return(matrix(t(dimmy),nrow=length(index.),dimnames=list(seq(1,length(in dex.),1),dimensions=paste(dim,as.character(c(1:length(dims))),sep=)) ))} [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Package installation in Windows - Urgent!
Thanks for your response. However, I need more guidance. 1) I searched the archives of this list back to June 1. I found no discussion on this subject as I examined all the subject titles for the string [Ww]in. 2) I tried (what I understand) to be you suggestion. I created etc/Renviron.site: R_LIBS_SITE=C:\Program Files\R\R-2.7.2\library:C:\Program Files\R\R-2.7.2\Packages 3) As a test, downloading a package resulted in it being stored in: C:\Documents and Settings\[USER]\Local Settings\Temp\RtmpO7pcpi\downloaded_packages 4) From the documantation of Renviron: Unix versions of R have a file 'R_HOME/etc/Renviron' which is read very early in the start-up processing. It contains environment variables set by R in the configure process, and is *not used on R for Windows*. I seek your guidance, for I quickly need to deploy R and selected contributed packages on several classroom computers. Mike On Wed, Sep 10, 2008 at 2:02 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Tue, 9 Sep 2008, [EMAIL PROTECTED] wrote: As a sys admin, how do I install packages so that there is one common library for all users of the MS Windows computer, instead of the default individual location for each user? I've done this for Linux. The same way. You set R_LIBS_SITE in etc/Renviron.site. See ?.Library.site This was discussed on this list with the last couple of weeks, so please do check the archives. Thanks, in advance, for your help. Mike -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 [[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] ggplot2: edge outlines on points
The graphic design elements in ggplot2 are so well done for color graphics. Thank you! For BW publication graphs, there are a few options I would like to be able to tweak, but can't seem to find the grob handles necessary OR the right plotting strategy. Here's one problem I've been puzzling over: Q How do you plot points with a grey fill and a black outline around the edge? I haven't been able to find the MatLab equivalent of MarkerEdgeColor so I've been working on trying to overlay two plots of the same points, one plotted with fills and the other plotted with edge outlines (here is my conceptual code): pfill - ggplot(data=DF, aes(x=X, y=Y)) + geom_point(aes(colour=TRT),size=4) + scale_colour_grey(end=0.8) + theme_bw pedge - ggplot(data=DF, aes(x=X, y=Y)) + geom_point(aes(colour=TRT),size=4) + scale_colour_grey(end=0.8) + scale_shape(solid=FALSE) + theme_bw However, I can't figure out the correct syntax, if this is even the right way to go about it. Any suggestions as to the best approach to achieve filled points with an edge outline would be greatly appreciated. --- Adam G. Marsh, Ph.D. Associate Professor Marine Biological Sciences University of Delaware Lewes, DE 19958 302.645.4367 [[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] using function instead of formula in plm
Hi all, I am trying to use plm to estimate coefficients in a model consisting of a system of equations. So far I used mle2 from the package bbmle, but now I need to test for autocorrelation and mle2 does not provide for the necessary tests. mle2 needs a function as input that might as well consist of many different equations. plm however requires an object of class formula that needs to be included in the plm-call. Does anyone know if there is a way to make R understand that it should do something like result - plm(function,data = paneldata,...) and what the object function then has to look like? Thanks in advance, Erich -- __ 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] binomial(link=inverse)
Prof Brian Ripley wrote: This isn't accurate. You are talking about link functions *known by name*. link: a specification for the model link function. This can be a name/expression, a literal character string, a length-one character vector or an object of class 'link-glm' (provided it is not specified via one of the standard names given next). Nothing is stopping you giving the link as an object, and there is an example on the help page. We made this easily user-extensible quite a while back. Thanks, I had overlooked this. So the short answer to my question is really glm(...,family=binomial(link=make.link(inverse)) As to why the list of links known by name is as it is, that seems history. in part the White Book history of S. I've always thought it an error that 'log' was a standard link for binomial, as the range does not match the specification of probabilities (and S did not do so, MASS Table 7.1 ). For each of log and inverse you have a valid model only for some values of the data, and can easily ask for predictions that give an out-of-range error. True, but there are some ecological examples where log(mu)=a+b*x or 1/mu=a+b*x are very natural models for the data: e.g. Strong, D. R., A. V. Whipple, A. L. Child, and B. Dennis. 1999. Model selection for a subterranean trophic cascade: root-feeding caterpillars and entomopathogenic nematodes. Ecology 80: 2750-2761. Tiwari, Manjula, Karen A Bjorndal, Alan B Bolten, and Benjamin M Bolker. 2006. Evaluation of density-dependent processes and green turtle \em Chelonia mydas production at Tortuguero, Costa Rica. Marine Ecological Progress Series 326: 283-293. Berwin Turlach also pointed out off-list that binomial GLMs with identity links often have convergence and other fitting problems -- presumably this applies to inverse links as well. Ben Bolker signature.asc Description: OpenPGP digital signature __ 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] ggplot2: edge outlines on points
Hi Adam, The next version of ggplot2 supports the build-in R plotting symbols that have different fills and borders, so you can do something like: geom_point(aes(colour=TRT), fill=red, colour=black, shape=21) Otherwise in the current version you can do: ggplot(data.frame(x = runif(20), y = runif(20)), aes(x, y)) + geom_point(size = 3, colour = black) + geom_point(size = 2, colour = red) The key difference to your code is that it's all on one plot, and I'm manually setting the colours, rather than to using scales. I also just used a smaller point rather than the matching hollow glyph, which makes things a little easier (and reverses the orders of the colours). Hadley On Wed, Sep 10, 2008 at 9:37 AM, Adam Marsh [EMAIL PROTECTED] wrote: The graphic design elements in ggplot2 are so well done for color graphics. Thank you! For BW publication graphs, there are a few options I would like to be able to tweak, but can't seem to find the grob handles necessary OR the right plotting strategy. Here's one problem I've been puzzling over: Q How do you plot points with a grey fill and a black outline around the edge? I haven't been able to find the MatLab equivalent of MarkerEdgeColor so I've been working on trying to overlay two plots of the same points, one plotted with fills and the other plotted with edge outlines (here is my conceptual code): pfill - ggplot(data=DF, aes(x=X, y=Y)) + geom_point(aes(colour=TRT),size=4) + scale_colour_grey(end=0.8) + theme_bw pedge - ggplot(data=DF, aes(x=X, y=Y)) + geom_point(aes(colour=TRT),size=4) + scale_colour_grey(end=0.8) + scale_shape(solid=FALSE) + theme_bw However, I can't figure out the correct syntax, if this is even the right way to go about it. Any suggestions as to the best approach to achieve filled points with an edge outline would be greatly appreciated. --- Adam G. Marsh, Ph.D. Associate Professor Marine Biological Sciences University of Delaware Lewes, DE 19958 302.645.4367 [[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. -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] cluster/snow question
Many thanks, that is very helpful. Tolga Luke Tierney [EMAIL PROTECTED] 10/09/2008 14:05 To [EMAIL PROTECTED] cc [EMAIL PROTECTED], r-help@r-project.org Subject Re: [R] cluster/snow question ls() looks in its calling environment, which in this case would be the internals of the snow mechnism. If you want ls of the global environment use one of clusterEvalQ(cl, ls()) clusterCall(cl, ls, .GlobalEnv) luke On Wed, 10 Sep 2008, [EMAIL PROTECTED] wrote: Many thanks. Yes, weird, somehow ls does not show the variables in the environment, even though they are clearly there. It would be nice to understand why that is the case, just to be clear about what is going on. Thanks Markus, Tolga Markus Schmidberger [EMAIL PROTECTED] 10/09/2008 10:45 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc r-help@r-project.org Subject Re: [R] cluster/snow question Hi Tolga, I am not sure why ls() is showing only args and fun. But x is at the nodes. Try this: clusterEvalQ(cl,x-x+3) [[1]] [1] 4 [[2]] [1] 4 clusterCall(cl,function()x+5) [[1]] [1] 9 [[2]] [1] 9 Best Markus [EMAIL PROTECTED] schrieb: Dear R Users, Apologies for a somewhat basic cluster question. I am trying to come to grips with how variables are instantiated within the environment of each node in a cluster. When I run the following code, I expect to see the variable x in the environment of each node, but fail to do so. What am I doing wrong ? library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment, but get back the same result as in the call above stopCluster(cl) library(snow) noclusters-2 cl - makeCluster(noclusters, type = SOCK) clusterCall(cl,ls) [[1]] [1] args fun [[2]] [1] args fun x-1 clusterExport(cl,x) clusterCall(cl,ls) #expect to see x in the environment [[1]] [1] args fun [[2]] [1] args fun stopCluster(cl) Thanks in advance, Tolga Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such fund(s). All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to UK legal entities. [[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. -- Dipl.-Tech. Math. Markus Schmidberger Ludwig-Maximilians-Universit?? M??chen IBE - Institut f?? medizinische Informationsverarbeitung, Biometrie und Epidemiologie Marchioninistr. 15, D-81377 Muenchen URL: http://ibe.web.med.uni-muenchen.de Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de Tel: +49 (089) 7095 - 4599 Generally, this communication is for informational purposes only and it is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. In the event you are receiving the offering materials attached below related to your interest in hedge funds or private equity, this communication may be intended as an offer or solicitation for the purchase or sale of such
Re: [R] Problem with dir.create in windows servers
This sounds vaguely familiar to me. This could be reason for why I wrote mkdirs() of the R.utils package. mkdirs() does it's own (manual) recursive creation of directories. See if that does it for you. /Henrik On Wed, Sep 3, 2008 at 1:14 AM, Francisco Jose Sastre [EMAIL PROTECTED] wrote: Hello. I've being having problems to create directories in a windows server environment . It seems that the recursive argument is not working properly on the intranet, as it does in a local path. For example: dir.create(server/directory1/directory2) , this works fine, and creates the directory2, but If we want to create the directory3 and another directory called directory4 inside of it. dir.create(server/directory1/directory3/directory4, recursive=T) fails, and don't create any directory. The ShowWarning doesn't show any message. Any help please. Fran. __ 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] loop with splitted data
Hi R users, I have a question which is some what related to this thread. Here is the setup: z is a list of lists, with no names. zz is same is z, but with names. with names on zz, I can crawl on the data with lapply, but I don't know how do the same on z (without names). Can someone help? ### === here is the code, which explains more clear of my problem x - list(1:3,4:6) y - list(11:13,14:16) z - list(x,y) xx - x names(xx) - c(1,2) yy - y names(yy) - c(1,2) zz - list(xx,yy) lapply(zz, [[, 1) lapply(zz, [[, 2) # Question: how can I get the same thing from z? # i.e. lapply(z, [[, ???), what is ??? so that # I can get the same values as lapply(zz, [[, 1). # I tried ???=[[1]], ???=[1], ???=[[. They all don't work. # I feel that I need a string or something to tell lapply what I want. This is a simplify version of my problem; in my case, I can't name all the sub-lists, please help. Thanks in advance, Gary -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Tuesday, August 26, 2008 6:27 PM To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] loop with splitted data jim holtman wrote: Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 But maybe this is what he really wanted: lapply(splitted,[[, x) $`2` [1] 1 2 3 4 5 $`3` [1] 6 7 8 9 10 or even split(ma$x, ma$y) $`2` [1] 1 2 3 4 5 $`3` [1] 6 7 8 9 10 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. __ 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] Binning
Thanks Jim and S Ellison for your help This should do what you want. #--x - read.table('clipboard', header=TRUE, as.is=TRUE) # convert dates x$date - as.POSIXct(strptime(x$SampleDate, %m/%d/%Y)) # put ForkLength into bins x$bins - cut(x$ForkLength, breaks=c(32, 34, 37, 40), include.lowest=TRUE) # count the bins tapply(x$Count, x$bins, sum) # plot the data plot(x$date, x$ForkLength, col=c('green', 'red', 'orange')[x$bins]) Dear List: I have a dataset with over 5000 records and I would like to put the Count in bins based on the ForkLength. e.g. Forklength Count 32-34? 35-37? 38-40? and so on... and lastly I would like to plot (scatterplot) including the SampleDate along the X axis and ForkLength along the Y axis. I recently saw an example similar to this one here but I don't want a histogram I just want to see the ForkLength ranges with different colors. For example: ForkLength 32-34---green ForkLength 35-37---red ForkLength 38-40--Orange Thanks in advance SampleDate ForkLength Count 112/4/2007 32 2 212/6/2007 33 1 312/7/2007 33 2 412/7/2007 33 2 512/7/2007 34 1 612/9/2007 31 1 712/9/2007 33 2 8 12/10/2007 33 5 9 12/10/2007 34 1 10 12/11/2007 33 2 11 12/15/2007 34 1 12 12/16/2007 33 2 13 12/17/2007 35 1 14 12/19/2007 33 1 15 12/19/2007 35 1 16 12/20/2007 31 1 17 12/20/2007 32 1 18 12/20/2007 33 1 19 12/20/2007 34 3 20 12/21/2007 31 1 21 12/21/2007 32 3 22 12/21/2007 33 4 23 12/21/2007 3411 24 12/21/2007 3516 25 12/21/2007 36 3 26 12/21/2007 37 1 27 12/22/2007 32 1 28 12/22/2007 33 3 29 12/22/2007 34 1 30 12/22/2007 35 2 31 12/23/2007 32 1 32 12/23/2007 35 1 33 12/25/2007 32 1 34 12/25/2007 36 1 35 12/26/2007 34 1 36 12/26/2007 35 2 37 12/26/2007 36 1 38 12/27/2007 34 4 39 12/27/2007 35 2 40 12/27/2007 36 2 41 12/28/2007 32 1 42 12/28/2007 33 1 43 12/28/2007 34 1 44 12/28/2007 35 3 45 12/28/2007 36 4 46 12/28/2007 37 6 47 12/28/2007 38 2 48 12/28/2007 39 2 49 12/29/2007 34 1 50 12/29/2007 35 5 51 12/29/2007 36 2 52 12/29/2007 37 1 53 12/30/2007 33 3 54 12/30/2007 3410 55 12/30/2007 3510 56 12/30/2007 36 6 57 12/30/2007 3715 58 12/30/2007 38 3 59 12/31/2007 33 3 60 12/31/2007 34 8 61 12/31/2007 35 9 62 12/31/2007 36 6 63 12/31/2007 37 3 64 12/31/2007 38 1 651/1/2008 34 6 661/1/2008 35 6 671/1/2008 35 1 681/1/2008 36 6 691/1/2008 37 9 701/1/2008 38 1 711/2/2008 34 2 721/2/2008 34 1 731/2/2008 35 2 741/2/2008 36 2 751/2/2008 37 2 761/2/2008 39 1 771/3/2008 34 3 781/3/2008 35 3 791/3/2008 36 2 801/3/2008 37 3 811/8/2008 32 1 821/8/2008 33 7 831/8/2008 34 6 841/8/2008 3510 851/8/2008 3616 861/8/2008 37 7 871/8/2008 38 1 881/8/2008 39 1 891/9/2008 33 1 901/9/2008 3420 911/9/2008 3549 921/9/2008 3649 931/9/2008 3739 941/9/2008 37 1 951/9/2008 3818 961/9/2008 39 1 971/9/2008 40 1 98 1/10/2008 32 3 99 1/10/2008 3313 100 1/10/2008 3456 101 1/10/2008 3533 102 1/10/2008 3624 103 1/10/2008 3718 104 1/10/2008 39 1 105 1/11/2008 33 7 106 1/11/2008 3446 107 1/11/2008 3541 108 1/11/2008 3628 109 1/11/2008 3729 Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA
[R] request: most repeated component of a list
Dear R community I have stored the results of arrays in a list consist of J-components (say 200 components). Each component containing same no of columns but may be different no of rows. e.g [[1]] [,1] [,2] [,3] [,4] [,5] [1,]40000 [2,]43400 [3,]43400 [4,]43000 [[2]] [,1] [,2] [,3] [,4] [,5] [1,]40000 [2,]44300 [3,]44300 [4,]44000 [5,]44000 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]40000 [2,]44100 [3,]44100 [4,]44000 For 200 components i want to make a frequency table. How can i make a frequency table of these components or the most repeated component out of all? Any help in this regard will be appreciated. Muhammad Azam [[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] loop with splitted data
Is this what you want: lapply(z, '[[', 1) [[1]] [1] 1 2 3 [[2]] [1] 11 12 13 lapply(z, '[[', 2) [[1]] [1] 4 5 6 [[2]] [1] 14 15 16 On Wed, Sep 10, 2008 at 11:43 AM, Ling, Gary (Electronic Trading) [EMAIL PROTECTED] wrote: Hi R users, I have a question which is some what related to this thread. Here is the setup: z is a list of lists, with no names. zz is same is z, but with names. with names on zz, I can crawl on the data with lapply, but I don't know how do the same on z (without names). Can someone help? ### === here is the code, which explains more clear of my problem x - list(1:3,4:6) y - list(11:13,14:16) z - list(x,y) xx - x names(xx) - c(1,2) yy - y names(yy) - c(1,2) zz - list(xx,yy) lapply(zz, [[, 1) lapply(zz, [[, 2) # Question: how can I get the same thing from z? # i.e. lapply(z, [[, ???), what is ??? so that # I can get the same values as lapply(zz, [[, 1). # I tried ???=[[1]], ???=[1], ???=[[. They all don't work. # I feel that I need a string or something to tell lapply what I want. This is a simplify version of my problem; in my case, I can't name all the sub-lists, please help. Thanks in advance, Gary -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Tuesday, August 26, 2008 6:27 PM To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] loop with splitted data jim holtman wrote: Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 But maybe this is what he really wanted: lapply(splitted,[[, x) $`2` [1] 1 2 3 4 5 $`3` [1] 6 7 8 9 10 or even split(ma$x, ma$y) $`2` [1] 1 2 3 4 5 $`3` [1] 6 7 8 9 10 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] request: most repeated component of a list
If want you want is the summary from all of them, then 'rbind' the data together into one matrix and analyze it: totalMat - do.call(rbind, listOfMatrices) On Wed, Sep 10, 2008 at 11:49 AM, Muhammad Azam [EMAIL PROTECTED] wrote: Dear R community I have stored the results of arrays in a list consist of J-components (say 200 components). Each component containing same no of columns but may be different no of rows. e.g [[1]] [,1] [,2] [,3] [,4] [,5] [1,]40000 [2,]43400 [3,]43400 [4,]43000 [[2]] [,1] [,2] [,3] [,4] [,5] [1,]40000 [2,]44300 [3,]44300 [4,]44000 [5,]44000 [[3]] [,1] [,2] [,3] [,4] [,5] [1,]40000 [2,]44100 [3,]44100 [4,]44000 For 200 components i want to make a frequency table. How can i make a frequency table of these components or the most repeated component out of all? Any help in this regard will be appreciated. Muhammad Azam [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] loop with splitted data
YES! many many thanks, Jim. I know it'd be simple, yet I can't believe it's that simple. =) -gary -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 11:55 AM To: Ling, Gary (Electronic Trading) Cc: Peter Dalgaard; r-help@r-project.org Subject: Re: [R] loop with splitted data Is this what you want: lapply(z, '[[', 1) [[1]] [1] 1 2 3 [[2]] [1] 11 12 13 lapply(z, '[[', 2) [[1]] [1] 4 5 6 [[2]] [1] 14 15 16 On Wed, Sep 10, 2008 at 11:43 AM, Ling, Gary (Electronic Trading) [EMAIL PROTECTED] wrote: Hi R users, I have a question which is some what related to this thread. Here is the setup: z is a list of lists, with no names. zz is same is z, but with names. with names on zz, I can crawl on the data with lapply, but I don't know how do the same on z (without names). Can someone help? ### === here is the code, which explains more clear of my problem x - list(1:3,4:6) y - list(11:13,14:16) z - list(x,y) xx - x names(xx) - c(1,2) yy - y names(yy) - c(1,2) zz - list(xx,yy) lapply(zz, [[, 1) lapply(zz, [[, 2) # Question: how can I get the same thing from z? # i.e. lapply(z, [[, ???), what is ??? so that # I can get the same values as lapply(zz, [[, 1). # I tried ???=[[1]], ???=[1], ???=[[. They all don't work. # I feel that I need a string or something to tell lapply what I want. This is a simplify version of my problem; in my case, I can't name all the sub-lists, please help. Thanks in advance, Gary -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Tuesday, August 26, 2008 6:27 PM To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] loop with splitted data jim holtman wrote: Is this what you want: y = c(rep(2,5),rep(3,5)) ma - data.frame(x = 1:10, y=y ) splitted - split(ma, ma$y) for (counter in (min(ma$y):max(ma$y))) + { + cat(counter, :, splitted[[as.character(counter)]]$x, '\n') + } 2 : 1 2 3 4 5 3 : 6 7 8 9 10 But maybe this is what he really wanted: lapply(splitted,[[, x) $`2` [1] 1 2 3 4 5 $`3` [1] 6 7 8 9 10 or even split(ma$x, ma$y) $`2` [1] 1 2 3 4 5 $`3` [1] 6 7 8 9 10 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] test for a single variance
If you are trying to test the hypotheses: H0: sigma^2 == sigma[0]^2 Ha: sigma^2 != sigma[0]^2 i.e. is the variance of the distribution from which the data came different from the hypothesized value? Then the normal theory test can be done fairly simply (I don't know of any prepackaged equivalents) by something like: pchisq( var(y)*(length(y)-1)/sigma0, length(y)-1, lower.tail= var(y) sigma0 ) * 2 Assuming sigma0 is the hypothesized variance and I remember the formula correctly. However, this is only valid if the data comes from a distribution that is very close to a normal distribution. Inference on the mean is robust to normality assumptions, but not the variance, hence this is not used much in practice. If you are really interested in the test on the variance (a good thing, many problems really should look at the variance as the 1st outcome of interest, rather than as a nuisance variable), then a possibly better approach would be to calculate a confidence interval on the variance using something that does not depend on distributional assumptions (bootstrap could be one option) and compare that to the hypothesized value. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edna Bell Sent: Tuesday, September 09, 2008 4:31 PM To: [EMAIL PROTECTED] Subject: [R] test for a single variance Dear R Gurus: Is there a test for a single variance available in R, please? Thanks, Edna Bell __ 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] FW: RE: arima and xreg
hi: you should probably send below to R-Sig-Finance because there are some econometrics people over there who could also possibly give you a good answer and may not see this email ? Also, there's package called mar ( I think that's the name ) that may do what you want ? Finally, I don't know how to do it but I think there are ways of converting a multivariate arima into the equivalent state space form and then you could estimate it that way using dse, dlm etc but that's as far as i'll go there because the univariate conversion case is complicated enough and i've never considered the multivariate case. good luck. On Wed, Sep 10, 2008 at 10:36 AM, Jose Capco wrote: Dear R-help-archive.. I am trying to figure out how to make arima prediction when I have a process involving multivariate time series input, and one output time series (output is to be predicted) .. (thus strictly speaking its an ARMAX process). I know that the arima function of R was not designed to handle multivariate analysis (there is dse but it doesnt handle arma multivariate analysis, only simulations). But there is this beautiful xreg as parameter for arima and I was wondering.. for the case of one output series I can actually trick R in doing multivariate time series for me no?.. because I saw in the documentation, xreg can be inputed as a ---matrix--- with output.len (length of output data) number of rows.. So in fact I can let the different columns of xreg to actually be the different input time series I need! Is anyone familiar in how arima with xreg as given estimate models? .. how is the model assumed? supposing I write : arima(y, xreg=U, order=c(3,0,2)) how is y_t calculated? (supposing U has 2 columns, with U[1] being first column and U[2] second column) is it y_t = theta_(t-1)y_t-1 + + theta_t-3 y_t-3 + intercept + U[1]_t + psi[1]_t-1 U[1]_t-1 + psi[1]_t-2 U[1]_t-2 + + psi[2]U[2]_t-2 + e_t + phi_t-1 e_t-1 + phi_t-2 e_t-2 ?? e_t .. etc. are the white noise series of the model. the documentation is totally vague when it comes to xreg. I hope it is like above :) Would appreciate any remarks or comments. Thanks in advance. Sincerely, Jose __ 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] printing all rows
Are you really going to look at all the rows? Probably better options for what you want are to look at functions like 'head', 'tail', 'subset', and 'View' that will let you look at specific parts of the data rather than printing out much more information than you are likely to care about, then need to search through it all for the pieces of interest. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ANJAN PURKAYASTHA Sent: Tuesday, September 09, 2008 9:13 AM To: r-help@r-project.org Subject: [R] printing all rows Hi, my data table has 38939 rows. R prints the first 1 columns and then prints an error message:[ reached getOption(max.print) -- omitted 27821 rows ]]. is it possible to set the maxprint parameter so that R prints all the rows? tia, anjan -- = anjan purkayastha, phd bioinformatics analyst whitehead institute for biomedical research nine cambridge center cambridge, ma 02142 purkayas [at] wi [dot] mit [dot] edu 703.740.6939 [[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] MA coefficients
Hi everyone, I am performing the time series regression analysis on a series of data sets. A few data sets followed an ARMA(1,1) process. However, they all had a same value of moving average MA coefficients = -1, constantly, from output of function arima . Example: arima(residuals, order=c(1,0,1)) Call: arima(residuals, order = c(1, 0, 1)) Coefficients: ar1 ma1 intercept 0.3139 -1. 0e+00 s.e. 0.0871 0.0298 1e-04 sigma^2 estimated as 0.0002067: log likelihood = 336.72, aic = -665.43 arima(residuals, order=c(2,1,1)) Call: arima(residuals, order = c(2,1, 1)) Coefficients: ar1 ar2 ma1 -0.4196 -0.3328 -1. s.e. 0.0861 0.0857 0.0215 sigma^2 estimated as 0.0002529: log likelihood = 320.83, aic = -633.66 (a) Did this indicate a nonstationary/noninvertible process? (b) Did the algorithm converge? Would you trust the fit?? (c) What would you do next? Best, Ricardo [[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] comparing a list and vector and returnig the listname
hi, I have list of length 5453 and vector of length 14318.I need to compare the vector with the list and return the list name if matched.I am thinking of using an lapply but how to retrive the listname is wat i am puzzled abt. kindly let me know how to go abt it. Ramya -- View this message in context: http://www.nabble.com/comparing-a-list-and-vector-and-returnig-the-listname-tp19415038p19415038.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] setting history file
Dear R Gurus: I would like to set the number of commands in the history file as 50 rather than 25. I would do this in the .First function. How do I set this, please? I tried history(max=50) and it prints what it has. I just want to set the size in .First. Thanks in advance, Sincerely, Edna __ 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] comparing a list and vector and returnig the listname
If I understand, try this: names(l[l %in% v]) where l is your list and v is your vector. On Wed, Sep 10, 2008 at 1:38 PM, Rajasekaramya [EMAIL PROTECTED]wrote: hi, I have list of length 5453 and vector of length 14318.I need to compare the vector with the list and return the list name if matched.I am thinking of using an lapply but how to retrive the listname is wat i am puzzled abt. kindly let me know how to go abt it. Ramya -- View this message in context: http://www.nabble.com/comparing-a-list-and-vector-and-returnig-the-listname-tp19415038p19415038.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 [[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] Mode value
Others showed you how to find the mode in a dataset, I just want to point out that if your data is from a continuous distribution (or near continuous), then the mode of the data is more likely to be the result of a quirk of rounding than representative of anything useful. If the data is discrete, then the mode of the data may be meaningful, but looking at the entire table of frequencies, or a plot of them, will give you the mode information along with additional information that may help determine if that mode value is meaningful. If you really want to make inference about the mode of a continuous distribution then you should either use something like fitdistr (from the MASS package) to fit the data to a specific distribution, then use the theory/likelihood of that distribution to find the mode, or use the density function or the logspline package to fit a density to the data (less dependent upon assumptions about the distribution) and look at the mode(s) from those estimates. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Morales Sent: Saturday, September 06, 2008 11:24 AM To: r-help@r-project.org Subject: [R] Mode value Hello everyone, I would like to know if there is any function to calculate the mode value, or I have to build one to do it. Thanks so much Carlos __ 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] : writeMat
Hi, that's the information about R and R.matlab: *R version 2.6.2 (2008-02-08) x86_64-pc-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] R.matlab_1.2.3R.oo_1.4.5R.methodsS3_1.0.3 MASS_7.2-44 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 * The matlab's version i'm using is* Matlab.7.6.0. *and the error matlab gives me is: *??? Error using == load Unable to read MAT-file /home/erola/Dades/Saccharomyces cerevisiae/A.mat File may be corrupt.* I tried to put in matlab preferences -v6 saving, but it doesn't work. I have the same Matlab's version that a month ago, I thought that it was all the same but I have a problem with my computer and I have to reinstall all again, and somethimg is been changed, but I don't know what. Thank you. On Tue, Sep 9, 2008 at 8:58 PM, Henrik Bengtsson [EMAIL PROTECTED]wrote: Hi, On Tue, Sep 9, 2008 at 9:53 AM, erola pairo [EMAIL PROTECTED] wrote: I write a .mat file using the writeMat() command, but when i try to load it in Matlab it says that file may be corrupt. I did it a month ago and it worked. It exists any option that I can change for making the file readable to Matlab? A - c(1:10) dim(A) - c(2,5) library(R.matlab) writeMat('A.mat', A=A) And what matlab say is: file may be corrupt you need to provide much more information that this. Please see the posting guides for the list (see footer), and provide sessionInfo() so we know what version of R and R.matlab you are using. What version of Matlab are you using? If it worked a month ago, what have you changed since then? Cheers Henrik (author of R.matlab) Regards [[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] setting history file
On Wed, 10 Sep 2008, Edna Bell wrote: Dear R Gurus: I would like to set the number of commands in the history file as 50 rather than 25. It is neither of those. That is the default value of max.show, not of the size of the file. I would do this in the .First function. How do I set this, please? I tried history(max=50) and it prints what it has. Yes, but that is the number shown, not the number saved. You failed to follow the posting guide and tell us *anything* about your OS etc. But probably ?history tells you how to set the size of the history file via environment variable R_HISTSIZE. I just want to set the size in .First. Thanks in advance, Sincerely, Edna __ 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. PLEASE do. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] Color coding plotted numbers
Hi all, I have run a pca and want to plot the samples multivariate space using the sample numbers. In addition, I would like to color code the sample numbers by group, but can't find a way to color-code the sample numbers by group. So, I have to do it in two separate steps: plot(bulbil.pca, col=as.numeric(group.bulbil[,3]), pch=as.numeric(group.bulbil[,3])) # group.bulbil[,3] is grouping plot(x_w,y_w,type=n) text(x_w,y_w,labels=group.bulbil[,1]) ##group.bulbil[,1] contains sample numbers Is there a way to plot the sample numbers and color-code them on one graph? Thanks for any help. Wade [[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] many correlations
Stephen and Jorge, Perhaps a simpler solution is to use the which function test.data - Harman74.cor$cov#a test data set td - test.data * lower.tri(test.data) #this will examine only the lower off diagonal elements td.1 - which(abs(td).6,arr.ind=TRUE) # the critical pairs td.2 - td[which(abs(td).6)] # the values td.row - colnames(test.data)[td.1[,1]] #get the row names td.col - colnames(test.data)[td.1[,2]] #and the column names td.df - data.frame(td.row,td.col,correl = td.2) #put it all together Bill At 12:57 PM -0400 9/3/08, Jorge Ivan Velez wrote: Dear Stephen, Perhaps thishttp://www.nabble.com/Re:-applying-cor.test-to-a-(m,-n)-matrix---SUMMARY-to17150239.html#a17150239post could helps. In general: # Function correl.stats=function(X, method = pearson, use = complete , conf.level = 0.95){ require(forward) combs=t(fwd.combn(colnames(X), 2)) temp=t(apply(combs,1, function(x){ Y=X[,as.character(x)] res=cor.test(Y[,1],Y[,2], use = use, method = method, conf.level = conf.level) temp2=c(res$estimate, res$statistic, res$p.value, res$conf.int[1:2]) names(temp2)=c('rho','statistic','pvalue','lower','upper') rm(res) temp2 } ) ) rownames(temp)=paste(combs[,1],combs[,2],sep=) temp } # Data set set.seed(123) m - matrix(rnorm(10*5), ncol=5); colnames(m)=paste(m,1:ncol(m),sep=) # Correlations res=correl.stats(m) res rho statistic pvalue lower upper m1m2 0.57761512 2.00137666 0.08034470 -0.08173768 0.88528096 m1m3 -0.40595930 -1.25641472 0.24441138 -0.82477175 0.30046722 m1m4 0.67301956 2.57371995 0.03293644 0.07530295 0.91493950 m1m5 -0.34863673 -1.05210481 0.32348990 -0.80217657 0.36001727 m2m3 -0.56734869 -1.94869211 0.08716815 -0.88193296 0.09688755 m2m4 0.27131880 0.79731302 0.44828479 -0.43212763 0.76949303 m2m5 -0.25201740 -0.73658790 0.48241166 -0.76090564 0.44882739 m3m4 -0.43726491 -1.37521060 0.20634394 -0.83657173 0.26544083 m3m5 0.02265933 0.06410673 0.95045815 -0.61575185 0.64311043 m4m5 0.07453706 0.21141075 0.83785303 -0.58242262 0.67259801 # Filtering res[res[,'rho']0.6,] rho statistic pvalue lower upper 0.67301956 2.57371995 0.03293644 0.07530295 0.91493950 HTH, Jorge On Wed, Sep 3, 2008 at 11:04 AM, stephen sefick [EMAIL PROTECTED] wrote: I have one hundred and six independent variable that I would like to preform a correlation analysis on. Is there anyway to only get the values that are abolute value 0.6 or greater. thanks -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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. -- William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Attend ISSID/ARP:2009 http://issid.org/issid.2009/ __ 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] xls to csv conversion via WinXP's context menu?
There are at least 2 more packages which can handle the conversion. xlsReadWrite (only available on Windows) allows you to read Excel files directly in R. At the moment xls, but not xlsx and xlsm, AFAIK. RExcel (available via RExcelInstaller on CRAN) is an Excel addin which allows you to transfer data between R and Excel from within Excel. It works in Excel version 2002, 2003 and 2007, so it also allows transfer of xlsx and xlsm files. It does much more, e.g. it also allows you to call R functions in spreadsheet cell formulas. More information on rcom.univie.ac.at. Erich Neuwirth Footnote: I am not connected with xlsReadWrite, and I am the author or RExcel. Jorge Ivan Velez wrote: Dear Mark, I think you don't need to convert your xls files into csv files to read them using R. There are several ways to read them such as the RODBC package and ?read.xls in gdata. Now, if you really want to do the conversion, try ?xls2csv in gdata as well. HTH, Jorge On Fri, Sep 5, 2008 at 6:45 PM, Mark Na [EMAIL PROTECTED] wrote: Frequently I need to convert a .xls to a .csv (for import into R) and I do this by opening the file in excel and saving it as a csv. I would rather do this using WinXP's context menu (right click the xls, choose convert to csv) but I don't know of a utility that does this. Any ideas? Thanks, Mark __ 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. -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ 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] setting history file
I am using R-2.7.2 on Windows XP. Sorry for the problems. Sincerely, Edna On Wed, Sep 10, 2008 at 11:54 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 10 Sep 2008, Edna Bell wrote: Dear R Gurus: I would like to set the number of commands in the history file as 50 rather than 25. It is neither of those. That is the default value of max.show, not of the size of the file. I would do this in the .First function. How do I set this, please? I tried history(max=50) and it prints what it has. Yes, but that is the number shown, not the number saved. You failed to follow the posting guide and tell us *anything* about your OS etc. But probably ?history tells you how to set the size of the history file via environment variable R_HISTSIZE. I just want to set the size in .First. Thanks in advance, Sincerely, Edna __ 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. PLEASE do. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] : writeMat
Hi, I've managed to reproduce the error with R.matlab v1.2.2 and Matlab v7.4.0.287 (R2007a). There seems to be a bug introduced in R.matlab v1.2.2 (2008-07-12). In this version we tried to optimize the speed of writeMat(), and something failed (although all tests show the generated files loads fine with readMat() in R). You have probably updated R.matlab to this version, which is why it worked before. Until I identify and fix the bug, you can roll back to an earlier version that I have verified works. Start a fresh R session and install R.matlab v.1.2.1 as follows: source(http://www.braju.com/R/hbLite.R;); installPackages(http://www.braju.com/R/repos/R.matlab_1.2.1.tar.gz;); (Windows users should replace *.tar.gz with *.zip). Let me know if this helps and thanks for reporting the bug Henrik PS. It's time to update your R installation. DS. On Wed, Sep 10, 2008 at 9:47 AM, erola pairo [EMAIL PROTECTED] wrote: Hi, that's the information about R and R.matlab: R version 2.6.2 (2008-02-08) x86_64-pc-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] R.matlab_1.2.3R.oo_1.4.5R.methodsS3_1.0.3 MASS_7.2-44 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 The matlab's version i'm using is Matlab.7.6.0. and the error matlab gives me is: ??? Error using == load Unable to read MAT-file /home/erola/Dades/Saccharomyces cerevisiae/A.mat File may be corrupt. I tried to put in matlab preferences -v6 saving, but it doesn't work. I have the same Matlab's version that a month ago, I thought that it was all the same but I have a problem with my computer and I have to reinstall all again, and somethimg is been changed, but I don't know what. Thank you. On Tue, Sep 9, 2008 at 8:58 PM, Henrik Bengtsson [EMAIL PROTECTED] wrote: Hi, On Tue, Sep 9, 2008 at 9:53 AM, erola pairo [EMAIL PROTECTED] wrote: I write a .mat file using the writeMat() command, but when i try to load it in Matlab it says that file may be corrupt. I did it a month ago and it worked. It exists any option that I can change for making the file readable to Matlab? A - c(1:10) dim(A) - c(2,5) library(R.matlab) writeMat('A.mat', A=A) And what matlab say is: file may be corrupt you need to provide much more information that this. Please see the posting guides for the list (see footer), and provide sessionInfo() so we know what version of R and R.matlab you are using. What version of Matlab are you using? If it worked a month ago, what have you changed since then? Cheers Henrik (author of R.matlab) Regards [[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] Woring message in as.yearmon()
I have following dataset: res [,1] [,2] [,3] [1,] 19464 1.27 [2,] 19465 1.27 [3,] 19466 1.27 [4,] 19467 1.27 [5,] 19468 1.52 [6,] 19469 1.52 [7,] 1946 10 1.52 [8,] 1946 11 1.52 [9,] 1946 12 1.62 [10,] 19471 1.62 [11,] 19472 1.62 [12,] 19473 1.62 [13,] 19474 1.87 [14,] 19475 1.87 [15,] 19476 1.87 Now I write following code : as.yearmon(paste(res[,1], res[,2], sep=-)) [1] Apr 1946 May 1946 Jun 1946 Jul 1946 Aug 1946 Sep 1946 Oct 1946 Nov 1946 Dec 1946 [10] Jan 1947 Feb 1947 Mar 1947 Apr 1947 May 1947 Jun 1947 Warning message: In if (nch == 1) %Y-%m else %Y-%m-%d : the condition has length 1 and only the first element will be used Can anyone please tell me why this warning message is coming and what is the remedy? Regards, __ 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] xls to csv conversion via WinXP's context menu?
The main difference is that read.xls and xls2csv in the gdata package use a perl program which works on all platforms whereas the others require Windows but may have advantages there. On Wed, Sep 10, 2008 at 1:40 PM, Erich Neuwirth [EMAIL PROTECTED] wrote: There are at least 2 more packages which can handle the conversion. xlsReadWrite (only available on Windows) allows you to read Excel files directly in R. At the moment xls, but not xlsx and xlsm, AFAIK. RExcel (available via RExcelInstaller on CRAN) is an Excel addin which allows you to transfer data between R and Excel from within Excel. It works in Excel version 2002, 2003 and 2007, so it also allows transfer of xlsx and xlsm files. It does much more, e.g. it also allows you to call R functions in spreadsheet cell formulas. More information on rcom.univie.ac.at. Erich Neuwirth Footnote: I am not connected with xlsReadWrite, and I am the author or RExcel. Jorge Ivan Velez wrote: Dear Mark, I think you don't need to convert your xls files into csv files to read them using R. There are several ways to read them such as the RODBC package and ?read.xls in gdata. Now, if you really want to do the conversion, try ?xls2csv in gdata as well. HTH, Jorge On Fri, Sep 5, 2008 at 6:45 PM, Mark Na [EMAIL PROTECTED] wrote: Frequently I need to convert a .xls to a .csv (for import into R) and I do this by opening the file in excel and saving it as a csv. I would rather do this using WinXP's context menu (right click the xls, choose convert to csv) but I don't know of a utility that does this. Any ideas? Thanks, Mark __ 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. -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ 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] Woring message in as.yearmon()
I can't reproduce that. When I run it I get no warning. Check your versions: Lines - 19464 1.27 + 19465 1.27 + 19466 1.27 + 19467 1.27 + 19468 1.52 + 19469 1.52 + 1946 10 1.52 + 1946 11 1.52 + 1946 12 1.62 + 19471 1.62 + 19472 1.62 + 19473 1.62 + 19474 1.87 + 19475 1.87 + 19476 1.87 res - read.table(textConnection(Lines)) library(zoo) Warning message: closing unused connection 3 (Lines) as.yearmon(paste(res[, 1], res[, 2], sep = -)) [1] Apr 1946 May 1946 Jun 1946 Jul 1946 Aug 1946 Sep 1946 [7] Oct 1946 Nov 1946 Dec 1946 Jan 1947 Feb 1947 Mar 1947 [13] Apr 1947 May 1947 Jun 1947 R.version.string # Windows Vista [1] R version 2.7.2 (2008-08-25) packageDescription(zoo)$Version [1] 1.5-4 On Wed, Sep 10, 2008 at 2:15 PM, Megh Dal [EMAIL PROTECTED] wrote: I have following dataset: res [,1] [,2] [,3] [1,] 19464 1.27 [2,] 19465 1.27 [3,] 19466 1.27 [4,] 19467 1.27 [5,] 19468 1.52 [6,] 19469 1.52 [7,] 1946 10 1.52 [8,] 1946 11 1.52 [9,] 1946 12 1.62 [10,] 19471 1.62 [11,] 19472 1.62 [12,] 19473 1.62 [13,] 19474 1.87 [14,] 19475 1.87 [15,] 19476 1.87 Now I write following code : as.yearmon(paste(res[,1], res[,2], sep=-)) [1] Apr 1946 May 1946 Jun 1946 Jul 1946 Aug 1946 Sep 1946 Oct 1946 Nov 1946 Dec 1946 [10] Jan 1947 Feb 1947 Mar 1947 Apr 1947 May 1947 Jun 1947 Warning message: In if (nch == 1) %Y-%m else %Y-%m-%d : the condition has length 1 and only the first element will be used Can anyone please tell me why this warning message is coming and what is the remedy? Regards, __ 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] Color coding plotted numbers
Hi all, I realized what I was doing wrong and aplogize about posting before thinkg about it for long enough. If I try to plot the pca results directly (bulbil.pca), I can't do it. But if I extract the axes 1 and 2 and plot directly, I can add col=as.numeric(group.bulbil[,3]) to the text() function and it works the way I want it to work. On Wed, Sep 10, 2008 at 1:23 PM, Wade Wall [EMAIL PROTECTED] wrote: Hi all, I have run a pca and want to plot the samples multivariate space using the sample numbers. In addition, I would like to color code the sample numbers by group, but can't find a way to color-code the sample numbers by group. So, I have to do it in two separate steps: plot(bulbil.pca, col=as.numeric(group.bulbil[,3]), pch=as.numeric(group.bulbil[,3])) # group.bulbil[,3] is grouping plot(x_w,y_w,type=n) text(x_w,y_w,labels=group.bulbil[,1]) ##group.bulbil[,1] contains sample numbers Is there a way to plot the sample numbers and color-code them on one graph? Thanks for any help. Wade [[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] WG: Re: NMDS and varimax rotation
On Wed, 2008-09-10 at 14:24 +0200, Bernd Panassiti wrote: hello, thanks a lot for your help. @ Stephen: In my opinion the proscrutes rotation is more used to compare the alignment of different ordination methods. But maybe I'm wrong. @ Bill: Thanks for the comprehensive description. That was the information I was looking for. Isn't Varimax rotation what is done in PCA? If so, metaMDS() does this rotation by default (via postMDS() and it's 'pc' argument). So this feature may already be implemented in the metaMDS wrapper to MASS::isoMDS that you mention. G Greetings, Bernd Panassiti __ 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] Mixed effects model with binomial errors - problem
RFTW l.temarvelde at nioo.knaw.nl writes: ok, the model does run now! but, dont i need the method=ML when i want to compare this model with a reduced model using anova(model1, model2)? The R-Book tells me that REML is not good for that (p.635) maximum likelihood (ML) is the default [and only!] estimation method for generalized linear mixed models (GLMMs, or in other words lmer with a family argument) in lmer. It is correct that you shouldn't compare REML fits with different fixed effects, but unfortunately it's almost as bad (not theoretically wrong, but very unreliable for small to moderate sample sizes) to use likelihood ratio tests (as in anova(model1,model2)) for these tests. See http://www.zoo.ufl.edu/bolker/glmm_rev-26aug.pdf for more information ... Ben Bolker __ 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] trouble printing from graphics device in R 2.7.2
Hi, I've been using R for many years and have always tried to keep my R version up to date, and when I switched from 2.7.1 to 2.7.2 I'm suddenly having trouble printing from the graphics device. I have Windows XP, and installed both versions of R from the binaries. If I start 2.7.2 and simply do: plot(1:10) the default R Graphics Device window opens as usual. However, when I use the menu in that window to File - Print, the graph that is printed is cut off below ~2 on the y-axis and ~10 on the x-axis if I don't resize the Graphics window; resizing the window bigger does result in more of the graph printed, but it's still cut off on the y-axis. Everything prints fine in R 2.7.1 (sessionInfo()s below), and all other versions of R I've had on this exact same computer for the last 3 years printing to the same printer, which is why I think it's something with R 2.7.2. I even tried un-installing and re-installing 2.7.2, but the problem persisted. Using the menu to save the graphic in various formats seems to work fine - the entire graph is visible in the .png, .pdf, etc. files. I didn't see anything in the changes or the archives about this... so what's going on and how do I fix it so I can continue to use 2.7.2? Thanks, Jenny sessionInfo() R version 2.7.2 (2008-08-25) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base sessionInfo() R version 2.7.1 (2008-06-23) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base Jenny Drnevich, Ph.D. Functional Genomics Bioinformatics Specialist W.M. Keck Center for Comparative and Functional Genomics Roy J. Carver Biotechnology Center University of Illinois, Urbana-Champaign 330 ERML 1201 W. Gregory Dr. Urbana, IL 61801 USA ph: 217-244-7355 fax: 217-265-5066 e-mail: [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to install rpy under mac os x?
Hi to all, there are some binary .dmg packages to install easly rpy under mac os x? I'm tryin' to install Rpy under Mac Os X but I receive the following message: host46-209-dynamic:rpy usernone$ python setup.py install running install running build running build_py running build_ext building 'rpy2.rinterface.rinterface' extension gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk - fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd - fno-common -dynamic -DNDEBUG -g -O3 -DR_INTERFACE_PTRS=1 - DCSTACK_DEFNS=1 -DRIF_HAS_RSIGHAND=1 -I/Library/Frameworks/R.framework/ Resources/include -Irpy/rinterface -I/Library/Frameworks/ Python.framework/Versions/2.5/include/python2.5 -c rpy/rinterface/ array.c -o build/temp.macosx-10.3-fat-2.5/rpy/rinterface/array.o rpy/rinterface/array.c:103: error: syntax error before ‘*’ token rpy/rinterface/array.c: In function ‘array_struct_get’: rpy/rinterface/array.c:105: error: ‘self’ undeclared (first use in this function) rpy/rinterface/array.c:105: error: (Each undeclared identifier is reported only once rpy/rinterface/array.c:105: error: for each function it appears in.) rpy/rinterface/array.c:105: warning: initialization makes pointer from integer without a cast rpy/rinterface/array.c:103: error: syntax error before ‘*’ token rpy/rinterface/array.c: In function ‘array_struct_get’: rpy/rinterface/array.c:105: error: ‘self’ undeclared (first use in this function) rpy/rinterface/array.c:105: error: (Each undeclared identifier is reported only once rpy/rinterface/array.c:105: error: for each function it appears in.) rpy/rinterface/array.c:105: warning: initialization makes pointer from integer without a cast lipo: can't figure out the architecture type of: /var/folders/Gn/ GnW---9nFjaAsf9--XHVvU+++TI/-Tmp-//ccYnQar1.out error: command 'gcc' failed with exit status 1 OS: Mac OS X 10.5 Python 2.5 R 2.7.2 GUI 1.25 (5217) Thanks to alls! -- View this message in context: http://www.nabble.com/How-to-install-rpy-under-mac-os-x--tp19418094p19418094.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 flecting a line
Suppose x and y are numeric vectors of the same length. plot(x,y) #scatterplot lmObj1 - lm(y~x) # best fit line abline(lmObj1) # good lmObj2 - lm(x~y) #get best fit but with axes interchanged abline(lmObj2) # not what I want. I want the correct line, drawn on the same graph, but with # response and predictor variables interchanged One way to proceed would be to extract the intercept and slope from lmObj2 and then do the arithmetic to draw the correct line. I'm hoping for a more streamlined method. Is there one? Thanks David -- View this message in context: http://www.nabble.com/reflecting-a-line-tp19422091p19422091.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] re flecting a line
Hi David, I don´t know if I got what you are looking for. But see the code below. x-1:100 y-x+(runif(100)*x) plot(y~x) mymod-glm(y~x) my.coefs-coef(mymod) my.coefs curve(my.coefs[1]+my.coefs[2]*x, lwd=2, col=red, add=T) Cheers, mitinho astronauta brazil On Wed, Sep 10, 2008 at 6:06 PM, David Epstein [EMAIL PROTECTED]wrote: Suppose x and y are numeric vectors of the same length. plot(x,y) #scatterplot lmObj1 - lm(y~x) # best fit line abline(lmObj1) # good lmObj2 - lm(x~y) #get best fit but with axes interchanged abline(lmObj2) # not what I want. I want the correct line, drawn on the same graph, but with # response and predictor variables interchanged One way to proceed would be to extract the intercept and slope from lmObj2 and then do the arithmetic to draw the correct line. I'm hoping for a more streamlined method. Is there one? Thanks David -- View this message in context: http://www.nabble.com/reflecting-a-line-tp19422091p19422091.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] RSiteSearch for words ``as one entity''.
I tried to search for a string of words ``as one entity'' following the example in the help file: RSiteSearch({logistic regression}) and got the error message: 2008-09-11 08:55:41.356 open[823] No such file: /Users/rturner/http:/ search.r-project.org/cgi-bin/namazu.cgi?query={logistic+regression} max=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxn ame=docs My session info is: sessionInfo() R version 2.7.2 (2008-08-25) i386-apple-darwin8.11.1 locale: C attached base packages: [1] datasets utils stats graphics grDevices methods base other attached packages: [1] misc_0.0-6 fortunes_1.3-5 MASS_7.2-44 loaded via a namespace (and not attached): [1] tools_2.7.2 Is this a Mac-only issue, or does it happen elsewise? What if anything can I do about it? cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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] Two way clustering
Hi R users, I am trying to do two-way clustering (using information of both observation and variables). Is there any package available in R. Another querry, if somebody can provide related information (website) regarding this statistics, it will be great. Thanks in advance. Regards, Ram Kumar Basnet, Wageningen University. [[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] RSiteSearch for words ``as one entity''.
Seems that one of the slashed is dropped after the protocol prefix, i.e. http:/search.r-project.org/... should be http://search.r-project.org/... Someone else has to take it from here. /Henrik On Wed, Sep 10, 2008 at 2:03 PM, Rolf Turner [EMAIL PROTECTED] wrote: I tried to search for a string of words ``as one entity'' following the example in the help file: RSiteSearch({logistic regression}) and got the error message: 2008-09-11 08:55:41.356 open[823] No such file: /Users/rturner/http:/search.r-project.org/cgi-bin/namazu.cgi?query={logistic+regression}max=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxname=docs My session info is: sessionInfo() R version 2.7.2 (2008-08-25) i386-apple-darwin8.11.1 locale: C attached base packages: [1] datasets utils stats graphics grDevices methods base other attached packages: [1] misc_0.0-6 fortunes_1.3-5 MASS_7.2-44 loaded via a namespace (and not attached): [1] tools_2.7.2 Is this a Mac-only issue, or does it happen elsewise? What if anything can I do about it? cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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] RSiteSearch for words ``as one entity''.
on 09/10/2008 04:03 PM Rolf Turner wrote: I tried to search for a string of words ``as one entity'' following the example in the help file: RSiteSearch({logistic regression}) and got the error message: 2008-09-11 08:55:41.356 open[823] No such file: /Users/rturner/http:/search.r-project.org/cgi-bin/namazu.cgi?query={logistic+regression}max=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxname=docs For some reason, it appears to be looking locally, rather than to the net. On my system: R version 2.7.2 Patched (2008-08-25 r46438) running on F9: RSiteSearch({logistic regression}) A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly and then it takes me to the search engine page. Does this only happen with the above incantation using the braces, or does it happen without them as well? Even if I directly use browseURL(), which is the relevant function in RSiteSearch(), I cannot get it to behave in the way you have above, even if I only use a single slash in the http:/ part of the URL. Somehow it is paste()ing your $HOME folder as a prefix. You might want to try it with R --vanilla, just to see if something is amiss in your R session. You might also want to post to the sig-mac list in case this is Mac specific. 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] re flecting a line
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Epstein Sent: Wednesday, September 10, 2008 1:06 PM To: r-help@r-project.org Subject: [R] re flecting a line Suppose x and y are numeric vectors of the same length. plot(x,y) #scatterplot lmObj1 - lm(y~x) # best fit line abline(lmObj1) # good lmObj2 - lm(x~y) #get best fit but with axes interchanged abline(lmObj2) # not what I want. I want the correct line, drawn on the same graph, but with # response and predictor variables interchanged One way to proceed would be to extract the intercept and slope from lmObj2 and then do the arithmetic to draw the correct line. I'm hoping for a more streamlined method. Is there one? Thanks David Is something like this what you are looking for? x - 1:100 y - 10 + x + 10*rnorm(100) plot(y~x) fit1.lm - lm(y~x) abline(fit1.lm, col='blue') fit2.lm - lm(x~y) abline(-coef(fit2.lm)[1]/coef(fit2.lm)[2], 1/coef(fit2.lm)[2], col='red') Hope this is helpful, Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204 __ 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] RSiteSearch for words ``as one entity''.
On Wed, 10 Sep 2008, Henrik Bengtsson wrote: Seems that one of the slashed is dropped after the protocol prefix, i.e. http:/search.r-project.org/... should be http://search.r-project.org/... Someone else has to take it from here. /Henrik On Wed, Sep 10, 2008 at 2:03 PM, Rolf Turner [EMAIL PROTECTED] wrote: I tried to search for a string of words ``as one entity'' following the example in the help file: RSiteSearch({logistic regression}) and got the error message: 2008-09-11 08:55:41.356 open[823] No such file: /Users/rturner/http:/search.r-project.org/cgi-bin/namazu.cgi?query={logistic+regression}max=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxname=docs That's not much like what I get on Mac OS (10.5.4, from the command line), where it works for me, as it does on Windows, Linux and Solaris. I get /usr/bin/open http://search.r-project.org/cgi-bin/namazu.cgi?query={logistic+regression}max=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxname=docs; (on one line). Something has messed up the query, and debug(browseURL) or debug(RSiteSearch) might help track down what. My session info is: sessionInfo() R version 2.7.2 (2008-08-25) i386-apple-darwin8.11.1 locale: C attached base packages: [1] datasets utils stats graphics grDevices methods base other attached packages: [1] misc_0.0-6 fortunes_1.3-5 MASS_7.2-44 loaded via a namespace (and not attached): [1] tools_2.7.2 Is this a Mac-only issue, or does it happen elsewise? What if anything can I do about it? Ask on R-sig-mac? cheers, Rolf Turner -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] binomial(link=inverse)
On Wed, 10 Sep 2008, Prof Brian Ripley wrote: As to why the list of links known by name is as it is, that seems history. in part the White Book history of S. I've always thought it an error that 'log' was a standard link for binomial, as the range does not match the specification of probabilities (and S did not do so, MASS Table 7.1 ). I think I added binomial(log): log-binomial regression is quite popular and useful in epidemiology (where effect sizes are small enough that keeping away from the boundary may be less of a problem than people's inability to understand odds ratios). As a side note, in (some versions of) S, due to partial matching, binomial(log) is valid -- it just does logistic regression. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ 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] mixed model MANCOVA
Hi Erika, I have not tried this before, and I hope that somebody will correct me if I'm wrong, but the glmer function in the lme4 library appears to do what you want. From examples(lmer): lmer (gm1 - glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = cbpp)) ...I guess that this will do what you want it to because it has multiple variables on the LHS and both continuous and categorical variables on the RHS, along with an explicit grouping structure. In your case, you probably want to leave the family= argument out, as noted in ?glmer, If 'family' is missing then a linear mixed model is fit; otherwise a generalized linear mixed model is fit. ...MANCOVA tend to be generalized linear models. Once again, though, I have not used this system personally, haven't seen your data, and don't know what output to expect. Hopefully somebody else can confirm or deny this solution's efficacy. --Adam On Mon, 8 Sep 2008, Erika Crispo wrote: Hello, I need to perform a mixed-model (with nesting) MANCOVA, using Type III sums of squares. I know how to perform each of these types of tests individually, but I am not sure if performing a mixed-model MANCOVA is possible. Please let me know. Erika Erika Crispo, PhD candidate McGill University, Department of Biology http://www.biology.mcgill.ca/grad/erika/index.htm [[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] RSiteSearch for words ``as one entity''.
On 11/09/2008, at 9:29 AM, Marc Schwartz wrote: on 09/10/2008 04:03 PM Rolf Turner wrote: I tried to search for a string of words ``as one entity'' following the example in the help file: RSiteSearch({logistic regression}) and got the error message: 2008-09-11 08:55:41.356 open[823] No such file: /Users/rturner/http:/search.r-project.org/cgi-bin/namazu.cgi?query= {logistic+regression} max=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsi dxname=docs For some reason, it appears to be looking locally, rather than to the net. The question is, how do I *stop it* from looking locally? :-) On my system: R version 2.7.2 Patched (2008-08-25 r46438) running on F9: RSiteSearch({logistic regression}) A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly and then it takes me to the search engine page. Does this only happen with the above incantation using the braces, or does it happen without them as well? It only happens with the incantation using the braces; without the braces, RSiteSearch() works like a dream. Even if I directly use browseURL(), which is the relevant function in RSiteSearch(), I cannot get it to behave in the way you have above, even if I only use a single slash in the http:/ part of the URL. Somehow it is paste()ing your $HOME folder as a prefix. You might want to try it with R --vanilla, just to see if something is amiss in your R session. Tried that just now --- same error occurred. You might also want to post to the sig-mac list in case this is Mac specific. Probably is ... but one shouldn't cross-post, they say. And I thought I'd get more feed-back from the general R-help list. Thanks for your suggestions. cheers, Rolf ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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] making spearman correlation cor() call fail with log(0) as input
Hi, How can I make the cor(x, y, method=spearman) call to produce an error when the input to it (x, y) produces an error? Here is a simple example: a - c(0, 1, 2) b - c(100, 2, 4) ## error: log(a) [1] -Inf 0.000 0.6931472 ## error, as expected: cor(log(a), log(b), method=pearson) [1] NaN ## not an error any more (not expected): cor(log(a), log(b), method=spearman) [1] -0.5 cor(log(a), log(b), method=spearman, use=all.obs) [1] -0.5 sessionInfo() R version 2.6.1 (2007-11-26) i686-pc-linux-gnu locale: LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=en_US;LC_COLLATE=en_US;LC_MONETARY=en_US;LC_MESSAGES=en_US;LC_PAPER=en_US;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base Thank you for your help. Best regards, Timur Shtatland __ 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] binomial(link=inverse)
Thomas Lumley wrote: As a side note, in (some versions of) S, due to partial matching, binomial(log) is valid -- it just does logistic regression. ouch! signature.asc Description: OpenPGP digital signature __ 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-pkgs] STAR (Spike Train Analysis with R) uploaded on CRAN
Hi all, I've uploaded STAR (Spike Train Analysis with R) on CRAN two days ago. The package is designed to analyze neuronal spike (action potential) trains. It uses S3 classes and methods and makes heavy use of other CRAN packages like gss, R2HTML, mgcv, survival. * Analysis of both spontaneous and stimulus evoked activity is implemented for single neuron spike trains as well as for many neurons recorded simultaneously. * Several bi variate duration distribution can be automatically fitted to spontaneous spike trains. Tests for renewal processes are implemented. * A non-parametric, smoothing spline based, approach to the estimation of the conditional intensity of the trains is also available (this feature is under development). * The full collection of Ogata's tests (1988, JASA, 83:9) for point-process models is implemented and the data set used by him (table 1 of the paper) is made available. * A new goodness of fit test for point-process is also proposed based on the fact that the martingale of the process plotted as a function of the integrated conditional intensity starts behaving very quickly as a standard Wiener process (if the model is correct). By the way I have no clean and formal proof of the latter statement so anyone able (and wiling) to give me some help on that is invited to send me an email. * Many data sets are included as well as vignette (covering only part of the present functionalities) and several demos. Any feed-back, comment, critic, is welcome. Christophe -- A Master Carpenter has many tools and is expert with most of them. If you only know how to use a hammer, every problem starts to look like a nail. Stay away from that trap. Richard B Johnson. -- Betweeen May and October I'll be mainly staying in the Peter Kloppenburg's lab in Cologne, You can call me there at: +49 (0)221 470 5207 Christophe Pouzat Laboratoire de Physiologie Cerebrale CNRS UMR 8118 UFR biomedicale de l'Universite Paris-Descartes 45, rue des Saints Peres 75006 PARIS France tel: +33 (0)1 42 86 38 28 fax: +33 (0)1 42 86 38 30 mobile: +33 (0)6 62 94 10 34 web: http://www.biomedicale.univ-paris5.fr/physcerv/C_Pouzat.html sip:[EMAIL PROTECTED] ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ 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.