Re: [R] can R solve these paired equations
Hello [An answer was posted just now using numerical ideas; here is an answer from a symbolic perspective] These equations involve x^y in more than one unknown, so inverse functions cannot be used. I do not think you will be able to characterize even the number of solutions, let alone their nature. To see the difficulty, look at the Lambert W function. My advice would be to simplify, simplify, simplify your problem as far as possible; remove terms successively until you are left with a trivial system, then add *one* term and see if this produces any insights. HTH rksh On 17 Dec 2007, at 05:43, Xin wrote: Dear: I have a paired equation below. Can I solve (x,y) using R. Thanks! Xin A=327.727 B=9517.336 p=0.114^10 (1-p)*y*(1-x)/x/(1-x^y)=A A(1+(1-x)*(1+y)/x-A))=B [[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. -- Robin Hankin Uncertainty Analyst and Neutral Theorist, National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] convergence error code in mixed effects models
Thank you for your helpful answer. The only thing obout what I still wonder is that some of the analyses work with R some time and some time not without any changes in the data or commands. Your text (from both emails) is cut at the end, so that your information about the convergence error problem is not complete. Would you send it again? Than you for your help! Ilona --- Douglas Bates [EMAIL PROTECTED] schrieb: Thank you for sending the data. It is very helpful in understanding the nature of the problem. For example, in your original description of your study you referred to week as a factor, which is a completely reasonable term, but I mistakenly thought that you meant an object of class factor and that was why I replied that you would be estimating too many variances and covariances. I can tell you why you are having problems fitting a mixed-effects model. Strangely it is because there is too little variability in the patterns across the replicates, especially at the early times. The leaf number is discrete with a small range (all the leaffra observations in this example are 4, 5, 6, 7 or 8) and non-decreasing over time. (I assume the nature of the experiment is such that the leaf number is necessarily non-decreasing.) That doesn't allow for many patterns. I'm sure some clever person reading this will be able to tell us exactly how many different such patterns you could get but I will simply say not many. Notice that the first 10 lines show that the leaffra is 4 at week 4 in *every* replicate. There isn't a whole lot of variation here for the random effects to model. The best place to start is with a plot of the data. I changed the levels of the rep factor to f1-f5 and s1-s5 to indicate that each rep is at one level of the treat. (Those who are playing along at home should be careful of the ordering of the original levels because ID10, which I now call s5, occurs between ID1 and ID2.) With this set of labels the cross-tabulation and treat should be xtabs(~ rep + treat, leaf) treat rep pHf pHs f1 4 0 f2 4 0 f3 4 0 f4 4 0 f5 4 0 s1 0 4 s2 0 4 s3 0 4 s4 0 4 s5 0 4 Now look at lattice plots such as library(lattice) xyplot(heightfra ~ week | rep, leaf, type = c(g, p, r), layout = c(5,2), aspect = 'xy', groups = treat) (I enclose PDF files of these plots for each of the three responses.) First you can see that there is very little variation at the low end. Strangely enough, this causes a problem in fitting mixed-effects models because the mle's of the variances of the random effects for the intercept will be zero. The lme function does not handle this gracefully. The lmer function from the lme4 package does a better job on this type of model. Also, note that the pattern of heightfra over time is not linear. It is consistently concave down. Thuso a mixed-effects model that is linear in week will miss much of the structure in the data. The point of R is to encourage you to explore your data rather than subjecting it to a canned analysis. You could try fitting a mixed-effects model to these data in SAS PROC MIXED or SPSS MIXED and I have no doubt that those packages would give you estimates (not to mention p-values, something that the author of lmer has been woefully negligent in not providing :-) but you probably won't get much of a hint that the model doesn't make sense. I would prefer to start with the plot and see what the data have to say. The technical problem with convergence in lme is that the mle of the variance of the intercept term is zero. You can see that if you use lmer from the lme4 package instead to fit the model. the random effect for the intercept is estimate On Dec 14, 2007 4:40 AM, Ilona Leyer [EMAIL PROTECTED] wrote: Here an simple example: rep treat heightfra leaffra leafvim week ID1 pHf 1.544 4 4 ID2 pHf 1.494 4 4 ID3 pHf 1.574 5 4 ID4 pHf 1.484 4 4 ID5 pHf 1.574 4 4 ID6 pHs 1.294 5 4 ID7 pHs 0.974 5 4 ID8 pHs 2.064 4 4 ID9 pHs 0.884 4 4 ID10pHs 1.474 4 4 ID1 pHf 3.535 6 6 ID2 pHf 4.086 6 6 ID3 pHf 3.896 6 6 ID4 pHf 3.785 6 6 ID5 pHf 3.926 6 6 ID6 pHs 2.765 5 6 ID7 pHs 3.316 7 6 ID8 pHs 4.466 7 6 ID9 pHs 2.195 5 6 ID10pHs 3.835 5 6 ID1 pHf 5.077 7 9 ID2 pHf 6.427 8 9 ID3 pHf
[R] kernlab and gram matrix
Hi, this is a question about the R package kernlab. I use kernlab as a library in a C++ program. The host application defines a graph kernel (defined by me), generates a gram matrix and trains kernlab directly on this gram matrix, like this: regm-ksvm(K,y,kernel=matrix), where K is the n x n gram kernelMatrix of my kernel, and y is the R-vector of quantitative target values. So, to make sure you got it: I don't want kernlab to compute the kernel values by itself. Rather, this is a task for the host application. Learning (see above) works well, but how do I predict a new instance? I couldn't find any information in this respect in the manual. The only examples for prediction were concerned with data from the input space, which i don't have, since my input space consists of graphs. I tried the following: predict(regm,x,type=response) where x is the 1xn R-matrix containing kernel values between the instance to be predicted and my training points. This won't work: Error in as.matrix(Z) : object Z not found. I'm using the current CRAN version of kernlab. Any help by kernlab users who had a similar task to do would be appreciated. Best regards, Andreas Maunz -- http://www.maunz.de Yoda of Borg are we: Futile is resistance. Assimilate you, we will. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Function for AUC?
Hi Armin, Do you know the rocr package ? This is very easy to draw ROC curves and to calculate AUC with it. http://rocr.bioinf.mpi-sb.mpg.de/ Hope this will help. Nael On Dec 17, 2007 2:58 AM, Stephen Weigand [EMAIL PROTECTED] wrote: RSiteSearch(AUC) would lead you to http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46416.html On Dec 13, 2007 12:38 PM, Armin Goralczyk [EMAIL PROTECTED] wrote: Hello Is there an easy way, i.e. a function in a package, to calculate the area under the curve (AUC) for drug serum levels? Thanks for any advice -- Armin Goralczyk, M.D. -- Universitätsmedizin Göttingen Abteilung Allgemein- und Viszeralchirurgie Rudolf-Koch-Str. 40 39099 Göttingen -- Dept. of General Surgery University of Göttingen Göttingen, Germany -- http://www.chirurgie-goettingen.de __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Two repeated warnings when runing gam(mgcv) to analyze my dataset?
What mgcv version are you running (and on what platform)? n Thursday 13 December 2007 17:46, zhijie zhang wrote: Dear all, I run the GAMs (generalized additive models) in gam(mgcv) using the following codes. m.gam -gam(mark~s(x)+s(y)+s(lstday2004)+s(ndvi2004)+s(slope)+s(elevation)+disbin ary,family=binomial(logit),data=point) And two repeated warnings appeared. Warnings: 1: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : Algorithm did not converge 2: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : fitted probabilities numerically 0 or 1 occurred Q1: For warning1, could it be solved by changing the value of mgcv.toloptions for gam.control(mgcv.tol=1e-7)? Q1: For warning2, is there any impact for the results if the fitted probabilities numerically 0 or 1 occurred ? How can i solve it? I didn't try the possible solutions for them, because it took such a longer time to run the whole programs. Could anybody suggest their solutions? Any help or suggestions are greatly appreciated. Thanks. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] paste dependent variable in formula (rpart)?
Christian Schulz wrote: Hello, i'm trying to replace different target variables in rpart with a function. The data.frame getting always the target variable as last column. Try below, i get the target variable in the explained variables, too!? Have anybody an advice to avoid this. rp1 - rpart(eval(parse(text=paste(names(train[length(train)] ~ . , I guess you want something along the following example: train - iris form - as.formula(paste(names(train)[length(train)], ~ .)) rpart(form, data = iris) or some data.frame method for rpart yes ,many thanks! Christian Uwe Ligges data=train,cp=0.0001) regards many thanks Christian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Function for AUC?
Hi all On Dec 17, 2007 9:57 AM, N. Lapidus [EMAIL PROTECTED] wrote: Hi Armin, Do you know the rocr package ? This is very easy to draw ROC curves and to calculate AUC with it. http://rocr.bioinf.mpi-sb.mpg.de/ Hope this will help. I know ROCR although I am not familiar with ROC. I have seen the AUC function of ROCR, but are you sure that this is applicable to the stated problem, i.e. calculate AUC of serum levels of a drug over time?! ROC seems to handle completely different problems. I have been reading the following post (thanks for the hint Stephen): On Dec 17, 2007 2:58 AM, Stephen Weigand [EMAIL PROTECTED] wrote: RSiteSearch(AUC) would lead you to http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46416.html I tried it: y-c(1,2,3,4,5);x-c(10,15,10,5,0) trap.rule - function(x,y) sum(diff(x)*(y[-1]+y[-length(y)]))/2 trap.rule(x,y) [1] -45 It is not the correct value, but the formula seems applicable and I changed it to auc - function(x,y) sum((x[-length(x)] + x[-1]) * (y[-1]-y[-length(y)]))/2 auc(x,y) [1] 35 which seems to be correct. I hope everyone agees. I didn't know it's that simple. I guess I don't need another function. Thank's for all the help and all the suggestions. -- Armin Goralczyk, M.D. -- Universitätsmedizin Göttingen Abteilung Allgemein- und Viszeralchirurgie Rudolf-Koch-Str. 40 39099 Göttingen -- Dept. of General Surgery University of Göttingen Göttingen, Germany -- http://www.chirurgie-goettingen.de __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Rd files with unknown encoding?
Here's a slightly cleaner version: showNonASCII - function(x) { ind - is.na(iconv(x, latin1, ASCII)) xxx - iconv(x[ind], latin1, ASCII, sub=byte) if(any(ind)) cat(which(ind), : , xxx, \n, sep=) } used as showNonASCII(readLines(foo.Rd)) On Sat, 15 Dec 2007, Spencer Graves wrote: Dear Prof. Ripley: Thanks very much. I did as you suggested, which I'll outline here to make it easier for anyone else who might have a similar problem: * Read the offending *.Rd file in R using 'readLines' * Applied 'iconv' to the character vector, following the last example in the help file. This translated all offending characters into a multi-character sequence starting with ''. * Used 'regexpr' to find all occurrences of ''. The latter identified other uses of '' but produced a sufficiently short list that I was able to find the problems fairly easily. Thanks again. Spencer Graves p.s. And in the future, I will refer 'Rd' questions to 'R-devel', per your suggestion. Prof Brian Ripley wrote: On Wed, 12 Dec 2007, Spencer Graves wrote: How can I identify the problem generating a warning in R CMD check for Rd files with unknown encoding? Google identified an email from John Fox with a reply from Brian Ripley about this last 12 Jun 2007. But not on this list: https://stat.ethz.ch/pipermail/r-devel/2007-June/046055.html R-devel would have been more appropriate for this too. This suggests that I may have accidentally entered some possibly non-printing character into the offending Rd file. The message tells me which file, but I don't know which lines in the file. Is there some way of finding the offending character(s) without laboriously running R CMD check after deleting different portions of the file until I isolate the problem? I did say so in that thread: https://stat.ethz.ch/pipermail/r-devel/2007-June/046061.html You can do much the same in R via iconv(, C, sub=byte), provided you can read the file in (it may not be representable in your current locale, but you could run R in a Latin-1 locale, if your OS has one). -- 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] RMySQL installation problem - partially solved
I think you should use the newest DBI Version with 2.6.1. regards, christian It seems to be an 2.6.1 Version problem. I tried to use http://umfragen.sowi.uni-mainz.de/CRAN/bin/windows/contrib/2.2/DBI_0.1-10.zip with 2.6.1 and 2.2.0 It is working with 2.2.0 (build under R Version 2.2.1) Knut __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RMySQL installation problem - partially solved
Christian Schulz schrieb: I think you should use the newest DBI Version with 2.6.1. regards, christian I run *actualice packages*, this should update to the newest DBI, shouldn't it? Knut __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Parse Expression
livia wrote: Hello everyone, I would like to construct a datafram with the following command. eval(parse(text=paste(df=data.frame(, cmd, ), sep=))) But it comes out Error in parse(file, n, text, prompt, srcfile, encoding) : syntax error, unexpected $undefined, expecting ',' in df=data.frame(cbcDummy10to12 = 1,cbcForeWrld_Ret = 1,cbcYC10-2_ cmd is a character string I obtained before, it is like: cmd [1] cbcDummy10to12 = 1,cbcForeWrld_Ret = 1,cbcYC10-2_wld = 1 Could anyone give me some advice? Many thanks. You can't have a hyphen - in a variable name, i.e. cbcYC10-2_wld is not legal. It is treated as a subtraction. I think the $undefined refers to 2_wld; the parser has no idea what that is supposed to be. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Two repeated warnings when runing gam(mgcv) to analyze my dataset?
Dear Simon, Sorry for an incomplete listing of the question. #mgcv version is 1.3-29, R 2.6.1, windows XP #m.gam-gam(mark~s(x)+s(y)+s(lstday2004)+s(ndvi2004)+s(slope)+s(elevation)+disbinary,family=binomial(logit),data=point) The above program's the core codes in my following loop programs. It works well if i run the above codes only one time for my dataset, but warnings will occur if i run many times for the following loop. while (j1001) { + index=sample(ID, replace=F) + m.data$x=coords[index,]$x + m.data$y=coords[index,]$y + # For each permutation, we run the GAM using the optimal span for the above model m.gam + s.gam -gam(mark~s(x)+s(y)+s(lstday2004)+s(ndvi2004)+s(slope)+s(elevation)+disbinary,,sp=c( 5.582647e-07,4.016504e-02,2.300424e-04,1.274065e+03,9.558236e-09, 1.868827e-08),family=binomial(logit),data=m.data) + permresults[,i]=predict.gam(s.gam) + i=i+1 + if (j%%100==0) print(i) + j=j+1 + } [1] 101 [1] 201 [1] 301 [1] 401 [1] 501 [1] 601 [1] 701 [1] 801 [1] 901 [1] 1001 warnings() over 50 warnings() 1: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : fitted probabilities numerically 0 or 1 occurred .. 14: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : Algorithm did not converge .. On Dec 17, 2007 4:54 PM, Simon Wood [EMAIL PROTECTED] wrote: What mgcv version are you running (and on what platform)? n Thursday 13 December 2007 17:46, zhijie zhang wrote: Dear all, I run the GAMs (generalized additive models) in gam(mgcv) using the following codes. m.gam -gam(mark~s(x)+s(y)+s(lstday2004)+s(ndvi2004)+s(slope)+s(elevation)+disbin ary,family=binomial(logit),data=point) And two repeated warnings appeared. Warnings$B!'(B 1: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : Algorithm did not converge 2: In gam.fit(G, family = G$family, control = control, gamma = gamma, ... : fitted probabilities numerically 0 or 1 occurred Q1: For warning1, could it be solved by changing the value of mgcv.toloptions for gam.control(mgcv.tol=1e-7)? Q1: For warning2, is there any impact for the results if the fitted probabilities numerically 0 or 1 occurred ? How can i solve it? I didn't try the possible solutions for them, because it took such a longer time to run the whole programs. Could anybody suggest their solutions? Any help or suggestions are greatly appreciated. Thanks. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 -- With Kind Regards, oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [***] Zhi Jie,Zhang ,PHD Tel:+86-21-54237149 Dept. of Epidemiology,School of Public Health,Fudan University Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 Email:[EMAIL PROTECTED] Website: www.statABC.com [***] oooO: (..): :\.(:::Oooo:: ::\_)::(..):: :::)./::: ::(_/ : [[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] polygon class in splancs package
Dear forum, I would like to use the kernel2d or spkernel2d in the Splancs-package, but it does not recognize my polygon data. Error in kernel2d(as.points(ptsbin), polygonprov, h0 = 2, nx = 100, : is the error message. Invalid poly argument The data are defined as follows: polgonprov-list(x=polyprov$X, y=polyprov$Y) with X and Y coordinates in the Lambert1972 notation. The points are defined in the same coordinate system and it does recognize them, so I don't suppose that is the problem. I can also draw the province polygon by: plot(c(192800,254100),c(154100,221800),type=n) polygon(polyprov$X,polyprov$Y) Can someone help me with this? Or explain to me how exactly is the polygon class defined in splancs? I also tried with Polygonprov-Polygon(list(x=polyprov$X,y:polyprov$Y)) but that does not seem to work either. Thanks already in advance. Kind regards, Elke __ Elke Moons, PhD Transportation Research Institute Belgium E-mail: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] [[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] How to create a mixed col.names?
Hello, I have a vector of names, say : names - c(Factor 1, Factor 2, Factor 3) I am creating a dataframe and I want the column names to be mixed like this: Factor 1 Sign Factor 1 Factor 2 Sign Factor 2 Factor 3 Sign Factor 3 How can I automate the creation of such a mixed vector? I tried with rep but did not succeed. Could someone please suggest a solution to this problem? Thanks in advance! Regards, JM -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Analyzing Publications from Pubmed via XML
On Dec 15, 2007 6:31 PM, David Winsemius [EMAIL PROTECTED] wrote: After quite a bit of hacking (in the sense of ineffective chopping with a dull ax), I finally came up with: pm.srch- function (){ srch.stem-http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmedterm=; query-readLines(con=file.choose()) query-gsub(\\\,,x=query) doc-xmlTreeParse(paste(srch.stem,query,sep=),isURL = TRUE, useInternalNodes = TRUE) return(sapply(c(//Id), xpathApply, doc = doc, fun = xmlValue) ) } pm.srch() #choosing the search-file //Id [1,] 18046565 [2,] 17978930 [3,] 17975511 [4,] 17935912 [5,] 17851940 [6,] 17765779 [7,] 17688640 [8,] 17638782 [9,] 17627059 [10,] 17599582 [11,] 17589729 [12,] 17585283 [13,] 17568846 [14,] 17560665 [15,] 17547971 [16,] 17428551 [17,] 17419899 [18,] 17419519 [19,] 17385606 [20,] 17366752 I tried the example above, but only the first 20 PMIDs will be returned. How can I circumvent this (I guesss its a restraint from pubmed)? -- Armin Goralczyk, M.D. -- Universitätsmedizin Göttingen Abteilung Allgemein- und Viszeralchirurgie Rudolf-Koch-Str. 40 39099 Göttingen -- Dept. of General Surgery University of Göttingen Göttingen, Germany -- http://www.chirurgie-goettingen.de __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 create a mixed col.names?
paste(rep(c(Factor, Sign Factor), 5), rep(1:5, each=2)) Replace '5' with the desired number, Gabor On Mon, Dec 17, 2007 at 03:08:09PM +0100, Jonas Malmros wrote: Hello, I have a vector of names, say : names - c(Factor 1, Factor 2, Factor 3) I am creating a dataframe and I want the column names to be mixed like this: Factor 1 Sign Factor 1 Factor 2 Sign Factor 2 Factor 3 Sign Factor 3 How can I automate the creation of such a mixed vector? I tried with rep but did not succeed. Could someone please suggest a solution to this problem? Thanks in advance! Regards, JM -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Must be obvious but not to me : problem with regular expression
Hi, I have a vector called nfichiers of 138 names of file whose extension is .P0 or P1 ... to P8. The script is not the same when the extension is P0 or P(1 to 8). Examples of file names : [128] Output0.P0 [129] Output0.P1 [130] Output0.P2 [131] Output01102007.P0 [132] Output01102007.P1 [133] Output01102007.P2 [134] Output01102007.P3 [135] Output01102007.P4 To extract the names of file with .P0 extension I wrote : nfichiers[grep(.P0, nfichiers)] For the other extensions : nfichiers[grep(.P[^0], nfichiers)] But for the last, I get a length of 138 that is the length of the initial vector although I have 130 files with .P0 extension. So I tried manually with a small vector : s [1] aa.P0 bb.P0 cc.P1 dd.P2 s[grep(.P[^0], s)] [1] cc.P1 dd.P2 It works !!! Has someone an idea to solve this small problem ? Thanks in advance, Ptit Bleu. -- View this message in context: http://www.nabble.com/Must-be-obvious-but-not-to-me-%3A-problem-with-regular-expression-tp14370723p14370723.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] rcom close Excel problem
Thank you, getobject is a roundabout, but solves the issue. BTW I discovered that system(taskkill /f /im Excel.exe) # kills the process just fine. The second problem is not due to the backslash vs slash, you can try and see that using the forward slash works fine from ESS. The q. is how to submit a second argument to Close? Submitting a second argument to Open works fine as shown by the 0 below, but neither 1 nor -1 worked for Close. Very strange. Original Message From: [EMAIL PROTECTED] Date: 12/14/2007 18:57 To: stephen bond[EMAIL PROTECTED] Cc: r-help@r-project.org Subj: Re: [R] rcom close Excel problem I know it won't answer your question exactly, but using comGetObject instead of comCreateObject won't create new Excel instances, so at least you won't have more than one processes running, so this might solve some of your problems. As for your second problem, I would venture to guess you need your paths with double backslashes instead of slashes. The following just worked over here: wb-comInvoke(comGetProperty(obj,Workbooks),Open, C:\ \Documents and Settings\\Haris\\Desktop\\test1.xlsx) Haris Skiadas Department of Mathematics and Computer Science Hanover College On Dec 14, 2007, at 2:58 PM, stephen bond wrote: Hello, I just discovered that I cannot close the Excel application and task manager shows numerous copies of Excel.exe I tried both x$Quit() # shown in the rcom archive and x$Exit() and Excel refuses to die. Thank you very much. S. You can't kill me, I will not die Mojo Nixon I also have a problem with saving. It produces a pop-up dialog and does not take my second parameter: x-comCreateObject(Excel.Application) wb-comInvoke(comGetProperty(x,Workbooks),Open,G: /MR/Stephen/repo. xls, 0) sh-comGetProperty(wb,Worksheets,Market Data) range1 - comGetProperty(sh,Range,C10,I11) vals - comGetProperty(range1,Value) comInvoke(wb,Close,G:/MR/Stephen/repo.xls,True) # True is ignored Thank you All. Stephen __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Memory problem using predict function
I am trying to make a predicted vegetation map using the predict ( ) function and am running into an issue with memory size Specifically I am building a random forest classification (dataframe = vegmap.rf) using the randomForest library and then am trying to apply results from that to construct a predicted map (dataframe =testvegmap.pred ): testvegmap.pred -predict(vegmap.rf, veg) And when I try to run this I get a message of: cannot allocate vector of size 88.0Mb I have used the series of commands below to increase the memory size to 4000Mb (the largest I seemingly can expand to): memory.size(max=FALSE) memory.limit(size=4000) Any suggestions? Is my only option to reduce the size of the area I am trying to make a predicted map of? Thanks Brad [[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] Capture warning messages from coxph()
Hi, I want to fit multiple cox models using the coxph() function. To do this, I use a for-loop and save the relevant results in a separate matrix. In the example below, only two models are fitted (my actual matrix has many more columns), one gives a warning message, while the other does not. Right now, I see all the warning message(s) after the for-loop is completed but have no idea which model gave the warning message. Is there a way in which the warning message can be captured and saved (i.e. as a binary variable, having value 1 if there was a warning message and 0 otherwise)? I can't possibly fit the models one by one (and see if they give a warning message) as I have many of them to fit. library(survival) Loading required package: splines time= c(4,3,1,1,2,2,3,3,2) status=c(1,0,0,0,1,1,1,1,1) TIME=Surv(time,status) x= cbind(c(0,2,1,1,0,0,0,2,0),c(0,2,1,1,0,0,0,0,0)) results=matrix(NA,ncol=3,nrow=ncol(x)) colnames(results)=c(coef,se,p) for(i in 1:ncol(x)){ + fit=summary(coxph(TIME~x[,i])) + results[i,1]=fit$coef[1] + results[i,2]=fit$coef[3] + results[i,3]=fit$coef[5] + rm(fit) + } Warning message: Loglik converged before variable 1 ; beta may be infinite. in: fitter(X, Y, strats, offset, init, control, weights = weights, results coef sep [1,] -0.5117033 5.647385e-01 0.36 [2,] -10.2256937 1.146168e+04 1.00 #To see which model gave the warning message coxph(TIME~x[,1]) Call: coxph(formula = TIME ~ x[, 1]) coef exp(coef) se(coef) zp x[, 1] -0.512 0.60.565 -0.906 0.36 Likelihood ratio test=0.97 on 1 df, p=0.324 n= 9 coxph(TIME~x[,2]) Call: coxph(formula = TIME ~ x[, 2]) coef exp(coef) se(coef) zp x[, 2] -10.2 3.62e-0511462 -0.000892 1 Likelihood ratio test=2.51 on 1 df, p=0.113 n= 9 Warning message: Loglik converged before variable 1 ; beta may be infinite. in: fitter(X, Y, strats, offset, init, control, weights = weights, Thank you, Cindy Lin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Must be obvious but not to me : problem with regular expression
On 12/17/2007 9:34 AM, Ptit_Bleu wrote: Hi, I have a vector called nfichiers of 138 names of file whose extension is .P0 or P1 ... to P8. The script is not the same when the extension is P0 or P(1 to 8). Examples of file names : [128] Output0.P0 [129] Output0.P1 [130] Output0.P2 [131] Output01102007.P0 [132] Output01102007.P1 [133] Output01102007.P2 [134] Output01102007.P3 [135] Output01102007.P4 To extract the names of file with .P0 extension I wrote : nfichiers[grep(.P0, nfichiers)] For the other extensions : nfichiers[grep(.P[^0], nfichiers)] But for the last, I get a length of 138 that is the length of the initial vector although I have 130 files with .P0 extension. One problem above is that . is special in regular expressions. I'd also suggest adding $ at the end, to force the match to the end of the string. That is, code as grep(\\.P0$, nfichiers) and grep(\\.P[^0]$, nfichiers) I don't know what false matches you were seeing, but this should eliminate some. Duncan Murdoch So I tried manually with a small vector : s [1] aa.P0 bb.P0 cc.P1 dd.P2 s[grep(.P[^0], s)] [1] cc.P1 dd.P2 It works !!! Has someone an idea to solve this small problem ? Thanks in advance, Ptit Bleu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] cor.test formula
Hi everybody, I am interested in seeing how the p value is calculated for a t test for a correlation coefficient. I know that cor.test delivers the correlation coefficient and the t-test, p-value and the 95 confidence interval. I am interested in how the p-value is calculated. Usually if i type the name of the function i get explicitly the coding of that function, but if i type cor.testfunction (x, ...) UseMethod(cor.test)environment: namespace:stats So How can i get the coding to find out how the p-value is calculated for this function? Thanks, Monica _ [[replacing trailing spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Must be obvious but not to me : problem with regular expression
Ptit_Bleu wrote: Hi, I have a vector called nfichiers of 138 names of file whose extension is .P0 or P1 ... to P8. The script is not the same when the extension is P0 or P(1 to 8). Examples of file names : [128] Output0.P0 [129] Output0.P1 [130] Output0.P2 [131] Output01102007.P0 [132] Output01102007.P1 [133] Output01102007.P2 [134] Output01102007.P3 [135] Output01102007.P4 To extract the names of file with .P0 extension I wrote : nfichiers[grep(.P0, nfichiers)] For the other extensions : nfichiers[grep(.P[^0], nfichiers)] But for the last, I get a length of 138 that is the length of the initial vector although I have 130 files with .P0 extension. So I tried manually with a small vector : s [1] aa.P0 bb.P0 cc.P1 dd.P2 s[grep(.P[^0], s)] [1] cc.P1 dd.P2 I guess you want grep(\\.P0$, nfichiers) Otherwise you get XP0X as a positive as well. And for the others: grep(\\.P[^0]$, nfichiers) with .P[^0], you'd get XPXX as positive, for example... because you are looking for something that contains a P that is preceded by any character and followed by some non-zero character. Uwe Ligges It works !!! Has someone an idea to solve this small problem ? Thanks in advance, Ptit Bleu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fortune warning
fortune(help) ## or any quoted string gives a warning Warning message: In grep(which, fort, useBytes = TRUE) : argument 'useBytes = TRUE' will be ignored in version.string R version 2.6.1 (2007-11-26) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] cor.test formula
Monica Pisica wrote: Hi everybody, I am interested in seeing how the p value is calculated for a t test for a correlation coefficient. I know that cor.test delivers the correlation coefficient and the t-test, p-value and the 95 confidence interval. I am interested in how the p-value is calculated. Usually if i type the name of the function i get explicitly the coding of that function, but if i type cor.testfunction (x, ...) UseMethod(cor.test)environment: namespace:stats So How can i get the coding to find out how the p-value is calculated for this function? The following Google search finds coding for cor.test: cor.test site:https://svn.r-project.org/R/trunk/src/ From those 6 hits, it is a short trip to the following link: https://svn.r-project.org/R/trunk/src/library/stats/R/cor.test.R Thanks, Monica _ [[replacing trailing spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] cor.test formula
Hi, Thanks. I usually don't fail to google though .. I really appreciate your answer. It is exactly what i needed. Monica Date: Mon, 17 Dec 2007 10:50:30 -0500 From: [EMAIL PROTECTED] Subject: Re: [R] cor.test formula To: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Monica Pisica wrote: Hi everybody,I am interested in seeing how the p value is calculated for a t test for a correlation coefficient. I know that cor.test delivers the correlation coefficient and the t-test, p-value and the 95 confidence interval. I am interested in how the p-value is calculated.Usually if i type the name of the function i get explicitly the coding of that function, but if i typecor.testfunction (x, ...) UseMethod(cor.test)environment: namespace:statsSo How can i get the coding to find out how the p-value is calculated for this function? The following Google search finds coding for cor.test: cor.test site:https://svn.r-project.org/R/trunk/src/ From those 6 hits, it is a short trip to the following link: https://svn.r-project.org/R/tr! unk/src/library/stats/R/cor.test.R Thanks,Monica _ [[replacing trailing spam]][[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 _ Share life as it happens with the new Windows Live. 07 [[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] Capture warning messages from coxph()
One way is to turn the 'warnings' into 'errors' and then trap the error: library(survival) time= c(4,3,1,1,2,2,3,3,2) status=c(1,0,0,0,1,1,1,1,1) TIME=Surv(time,status) x= cbind(c(0,2,1,1,0,0,0,2,0),c(0,2,1,1,0,0,0,0,0)) results=matrix(NA,ncol=3,nrow=ncol(x)) colnames(results)=c(coef,se,p) old.warn - options(warn=2) for(i in 1:ncol(x)){ + + aa - try(fit - summary(coxph(TIME~x[,i]))) + if (class(aa) == try-error){ + print(paste(i =, i, had error)) + next # skip iteration + } + + results[i,1]=fit$coef[1] + results[i,2]=fit$coef[3] + results[i,3]=fit$coef[5] + rm(fit) + } Error in fitter(X, Y, strats, offset, init, control, weights = weights, : (converted from warning) Loglik converged before variable 1 ; beta may be infinite. [1] i = 2 had error options(old.warn) On Dec 17, 2007 10:16 AM, xinyi lin [EMAIL PROTECTED] wrote: Hi, I want to fit multiple cox models using the coxph() function. To do this, I use a for-loop and save the relevant results in a separate matrix. In the example below, only two models are fitted (my actual matrix has many more columns), one gives a warning message, while the other does not. Right now, I see all the warning message(s) after the for-loop is completed but have no idea which model gave the warning message. Is there a way in which the warning message can be captured and saved (i.e. as a binary variable, having value 1 if there was a warning message and 0 otherwise)? I can't possibly fit the models one by one (and see if they give a warning message) as I have many of them to fit. library(survival) Loading required package: splines time= c(4,3,1,1,2,2,3,3,2) status=c(1,0,0,0,1,1,1,1,1) TIME=Surv(time,status) x= cbind(c(0,2,1,1,0,0,0,2,0),c(0,2,1,1,0,0,0,0,0)) results=matrix(NA,ncol=3,nrow=ncol(x)) colnames(results)=c(coef,se,p) for(i in 1:ncol(x)){ + fit=summary(coxph(TIME~x[,i])) + results[i,1]=fit$coef[1] + results[i,2]=fit$coef[3] + results[i,3]=fit$coef[5] + rm(fit) + } Warning message: Loglik converged before variable 1 ; beta may be infinite. in: fitter(X, Y, strats, offset, init, control, weights = weights, results coef sep [1,] -0.5117033 5.647385e-01 0.36 [2,] -10.2256937 1.146168e+04 1.00 #To see which model gave the warning message coxph(TIME~x[,1]) Call: coxph(formula = TIME ~ x[, 1]) coef exp(coef) se(coef) zp x[, 1] -0.512 0.60.565 -0.906 0.36 Likelihood ratio test=0.97 on 1 df, p=0.324 n= 9 coxph(TIME~x[,2]) Call: coxph(formula = TIME ~ x[, 2]) coef exp(coef) se(coef) zp x[, 2] -10.2 3.62e-0511462 -0.000892 1 Likelihood ratio test=2.51 on 1 df, p=0.113 n= 9 Warning message: Loglik converged before variable 1 ; beta may be infinite. in: fitter(X, Y, strats, offset, init, control, weights = weights, Thank you, Cindy Lin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extending data.frame
Hi, I've got a long-running project whose data fits nicely into data.frame objects in R. As I accumulate more and more functions, I decided to switch to an OO approach so I can organize things better. Looking around at the various approaches to OO R, I came across R.oo, which seems nice. Where I'm currently stuck is getting my objects to be mutable. For example, in the following toy code, the addStuff() method has no effect: library(R.oo) R.oo v1.3.0 (2006-08-29) successfully loaded. See ?R.oo for help. setConstructorS3(Foo, function(...) { + frame - data.frame(foo=4, bar=3:5) + extend(frame, Foo) + }) setMethodS3(addStuff, Foo, function(this, ...) { this$field - 5 }) f - Foo(); f foo bar 1 4 3 2 4 4 3 4 5 addStuff(f); f foo bar 1 4 3 2 4 4 3 4 5 Can anyone offer any advice? I'm open to using a different OO system if that's deemed advisable, I'm not very familiar with any of them. Note that in my real (non-toy) application, I'll need arbitrary methods to be able to read write data to the object, so simple getField() and setField() accessors won't be sufficient. Thanks. -- Ken Williams Research Scientist The Thomson Corporation Eagan, MN __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fortune warning
On 12/17/2007 10:50 AM, Richard M. Heiberger wrote: fortune(help) ## or any quoted string gives a warning Warning message: In grep(which, fort, useBytes = TRUE) : argument 'useBytes = TRUE' will be ignored in version.string R version 2.6.1 (2007-11-26) This is a problem in a contributed package; I've cc'd the maintainer (Achim). Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fortune warning
On Mon, 17 Dec 2007, Duncan Murdoch wrote: On 12/17/2007 10:50 AM, Richard M. Heiberger wrote: fortune(help) ## or any quoted string gives a warning Warning message: In grep(which, fort, useBytes = TRUE) : argument 'useBytes = TRUE' will be ignored in version.string R version 2.6.1 (2007-11-26) This is a problem in a contributed package; I've cc'd the maintainer (Achim). Thanks for the pointer (which was already reported privately previously), but I didn't get round to fix it, yet. I'll try to fix it asap. Z Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Identity link in tweedie
Hi there, I'm using the tweedie distribution package and I cant figure out how to run a model using an identity link. I know I can use a log link by having link.power=0 and I think identity would be link.power=1, but I'm not sure. Furthermore when I try running it with link.power=1 it requires starting values which I cant manage to give appropriately so I'm not sure if its actually an identity link its using. I can't find this info on the help page and I was wondering if somebody could give me a hand. Thanks a lot. Cheers, Cristina. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] convert table
Dear R user, a very simple question: I have a table like this: coorv1 v2 v3 x1 12 33 123 x2 1 123 x3 12 x4 33 1 and I'd like to tranform this matrix in presence/absence data.frame coor1 12 33 123 x1 0 1 1 1 x2 1 0 0 1 x3 0 1 0 0 x4 1 0 1 0 Could you suggest me a direct way to do this? Thank you Giovanni __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Reproducibility of experiment
On Mon, 2007-12-17 at 16:27 +0100, [EMAIL PROTECTED] wrote: Dear Marc and R-list, thanks for your help. I have checked Bland-Altman help page about repeatability, and I learnt that instead of reproducibility, I was talking about repeatability. Although I am not sure whether they only focuse on agreement of two different measurement methods, and not on repeatability of one single method. To explain further on my topic, I have repeated ten times an experiment involving protein quantification(i.e. how much protein I have), giving me ten continuous values. All experimental settings are similar so there should be no variability due to day of experiment, operator or any batch effect. My aim is to know whether these ten observations are good enough so that I can conclude that the repeatability of my detection technique is good. But as I have learnt from Altman´s page, it is not possible to set a threshold to the repeatability score to say my experiment is repeatable. I guess I can obtain a 95% confidence interval for the protein quantification values, but I am not sure this will show how well my experiment performs. Putting it differently, something I would like to know is whether I can estimate beforehand how many times I need to run an experiment in order to be confident that it is repeatable. Thanks for your comments David snip David, There is information on Prof. Bland's pages pertaining to the questions you ask. If you have not reviewed his FAQ, please do so as it covers issues such as sample size calculations, etc. If the 10 measures are all of the same quantity, then a simple one sample t-test is all you need to determine whether or not the measured values are significantly different than a presumably known correct value and to get confidence intervals for the mean measurement. However, if all 10 values are of the same quantity, you will not answer the questions as to whether or not any measurement error is constant/linear over the range of possible values and whether that error is within acceptable limits. This is what the Bland-Altman methods address. My recommendation would be to solicit local expertise in the design of such studies, as in reality, all of this should have been specified a priori. In addition, both Profs. Bland and Altman participate in the MedStats group and that would be a better forum for your queries. More information here: http://groups.google.com/group/MedStats 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] convert table
I have a table like this: coor v1 v2 v3 x1 12 33 123 x2 1 123 x3 12 x4 33 1 and I'd like to tranform this matrix in presence/absence data.frame coor 1 12 33 123 x1 0 1 1 1 x2 1 0 0 1 x3 0 1 0 0 x4 1 0 1 0 #This uses the reshape package df = data.frame(coor = paste(x, 1:4, sep=), v1=c(12,1,12,33), v2=c(33,123,NA,1), v3=c(1,NA,NA,NA)) mdf = melt(df) with(mdf, table(coor, value)) Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] convert table
[EMAIL PROTECTED] wrote: I have a table like this: coor v1 v2 v3 x1 12 33 123 x2 1 123 x3 12 x4 33 1 and I'd like to tranform this matrix in presence/absence data.frame coor 1 12 33 123 x1 0 1 1 1 x2 1 0 0 1 x3 0 1 0 0 x4 1 0 1 0 #This uses the reshape package df = data.frame(coor = paste(x, 1:4, sep=), v1=c(12,1,12,33), v2=c(33,123,NA,1), v3=c(1,NA,NA,NA)) mdf = melt(df) with(mdf, table(coor, value)) Plain reshape() too: df = data.frame(coor = paste(x, 1:4, sep=), v1=c(12,1,12,33), + v2=c(33,123,NA,1), v3=c(123,NA,NA,NA)) mdf - reshape(df, direction=long, varying=c(v1,v2,v3), sep=) with(mdf, table(coor, v)) v coor 1 12 33 123 x1 0 1 1 1 x2 1 0 0 1 x3 0 1 0 0 x4 1 0 1 0 (actually, varying=-1 also works.) -- 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] read.table() and precision?
Hi, I'm currently working with data that has values as large as 99,000,000 but is accurate to 6 decimal places. Unfortunately, when I load the data using read.table(), it rounds everything to the nearest integer. Is there any way for me to preserve the information or work with arbitrarily large floating point numbers? Thank you, Wojciech -- Five Minutes to Midnight: Youth on human rights and current affairs http://www.fiveminutestomidnight.org/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] read.table() and precision?
Did you set the the character used in the file for decimal points? dec = . or dec = , Knut __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] read.table() and precision?
Wojciech Gryc wrote: Hi, I'm currently working with data that has values as large as 99,000,000 but is accurate to 6 decimal places. Unfortunately, when I load the data using read.table(), it rounds everything to the nearest integer. Is there any way for me to preserve the information or work with arbitrarily large floating point numbers? Thank you, Wojciech Are you sure? To my knowledge, read.table doesn't round anything, except when running out of bits to store the values in, and 13 decimal places should fit in ordinary double precision variables. Printing the result is another matter. Try playing with the print(mydata, digits=15) and the like. -- 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] regression towards the mean, AS paper November 2007
Dear friends, regression towards the mean is interesting in medical circles, and a very recent paper (The American Statistician November 2007;61:302-307 by Krause and Pinheiro) treats it at length. An initial example specifies (p 303): Consider the following example: we draw 100 samples from a bivariate Normal distribution with X0~N(0,1), X1~N(0,1) and cov(X0,X1)=0.7, We then calculate the p value for the null hypothesis that the means of X0 and X1 are equal, using a paired Student's t test. The procedure is repeated 1000 times, producing 1000 simulated p values. Because X0 and X1 have identical marginal distributions, the simulated p values behave like independent Uniform(0,1) random variables. This I did not understand, and simulating like shown below produced far from uniform (0,1) p values - but I fail to see how it is wrong. I contacted the authors of the paper but they did not answer. So, please, doesn´t the code below specify a bivariate N(0,1) with covariance 0.7? I get p values = 1 all over - not interesting, but how wrong? Best wishes Troels library(MASS) Sigma - matrix(c(1,0.7,0.7,1),2,2) Sigma res - NULL for (i in 1:1000){ ff -(mvrnorm(n=100, rep(0, 2), Sigma, empirical = TRUE)) res[i] - t.test(ff[,1],ff[,2],paired=TRUE)$p.value} -- Troels Ring - - Department of nephrology - - Aalborg Hospital 9100 Aalborg, Denmark - - +45 99326629 - - [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Array dimnames
I can't quite understand what you're having difficulty with (is it constructing the array, or coping with the different 'matrices' having different column names, or something else?) However, your sample data looks like it has a mixture of factor (region) and numeric data (Qty), so you're probably storing it in a data frame. AFAIK, there is no 3d object in R that can store mixed-type data like a data frame can. An array object in R has to have the same data type for every column etc. -- Tony Plate dave mitchell wrote: Dear all, Possibly a rudimentary question, however any help is greatly appreciated. I am sorting a large matrix into an array of dim(p(i),q,3). I put each entry into a corresponding matrix (1 of the 3) based on some criteria. I figure this will assist me in condensing code as I can loop through the 3rd dimension of the array instead of generating 3 separate matrices and using the same block of code 3 times. My question is how to get the colnames of the 3 nested matrices in the array to match the colnames of the data matrix. In other words... DATA: Exp region Qty Ct ...q 1 S CB 3.55 2.15 . 2 S TG 4.16 2.18 . 3 C OO 2.36 3.65 . 4 C . . . . . . . . . . . . . . . . . . p ... ARRAY 1 [,1] [,2][,3] [,4]...q 1 SOME DATA WILL FILL THIS . 2 . . .. 3 . . . . 4 .. . . . . . . . . . . .. . . . . . P(1) ... 2 [,1] [,2][,3] [,4]...q 1 SOME DATA WILL FILL THIS . 2 . . .. 3 . . . . 4 .. . . . . . . . . . . .. . . . . . P(2) ... 3 [,1] [,2][,3] [,4]...q 1 SOME DATA WILL FILL THIS . 2 . . .. 3 . . . . 4 .. . . . . . . . . . . .. . . . . . P(3) ... Again, how to get those [,1], [,2]... to read (and operate) in the same fashion as the column names in the data matrix? Also, am I interpreting the dimensions of the array incorrectly? Please feel free to post any helpful links on the subject, as I have found dimnames and array in the R-help documentation unhelpful. Any help is greatly appreciated. Dave Mitchell Undergraduate: Statistics and Mathematics, University of Illinois, Urbana-Champaign [[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] regression towards the mean, AS paper November 2007
On 12/17/2007 1:21 PM, Troels Ring wrote: Dear friends, regression towards the mean is interesting in medical circles, and a very recent paper (The American Statistician November 2007;61:302-307 by Krause and Pinheiro) treats it at length. An initial example specifies (p 303): Consider the following example: we draw 100 samples from a bivariate Normal distribution with X0~N(0,1), X1~N(0,1) and cov(X0,X1)=0.7, We then calculate the p value for the null hypothesis that the means of X0 and X1 are equal, using a paired Student's t test. The procedure is repeated 1000 times, producing 1000 simulated p values. Because X0 and X1 have identical marginal distributions, the simulated p values behave like independent Uniform(0,1) random variables. This I did not understand, and simulating like shown below produced far from uniform (0,1) p values - but I fail to see how it is wrong. I contacted the authors of the paper but they did not answer. So, please, doesn´t the code below specify a bivariate N(0,1) with covariance 0.7? I get p values = 1 all over - not interesting, but how wrong? Best wishes Troels library(MASS) Sigma - matrix(c(1,0.7,0.7,1),2,2) Sigma res - NULL for (i in 1:1000){ ff -(mvrnorm(n=100, rep(0, 2), Sigma, empirical = TRUE)) res[i] - t.test(ff[,1],ff[,2],paired=TRUE)$p.value} Specifying empirical=TRUE means that your sampled values are not independent, the means are guaranteed to match exactly, and the mean difference is exactly zero. Thus all of the t statistics are exactly zero, and the p-values are exactly 1. Set empirical=FALSE (the default), and you'll see more reasonable results. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RMySQL installation problem - partially solved
Knut Krueger wrote: Christian Schulz schrieb: I think you should use the newest DBI Version with 2.6.1. regards, christian I run *actualice packages*, this should update to the newest DBI, shouldn't it? Knut I'm not sure, perhaps you are on an old branch? Try for 2.6.1: http://umfragen.sowi.uni-mainz.de/CRAN/bin/windows/contrib/2.6/DBI_0.2-4.zip http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.6/RMySQL_0.6-0.zip good luck, Christian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Cannot grasp how to apply by here...
I have a data frame named database with panel data, a little piece of which looks like this: Symbol Name TrialFactor1 Factor2 External 1 548140 A 1-3.87 -0.32 0.01 2 547400 B 112.11 -0.68 0.40 3 547173 C 1 4.50 0.71-1.36 4 546832 D 1 2.59 0.00 0.09 5 548140 A 2 2.41 0.50-1.04 6 547400 B 2 1.87 0.32 0.39 What I want to do is to calculate correlation between each factor and external for each Symbol, and record the corr. estimate, the p.value, the name and number of observations in a vector named vector, then rbind these vectors together in results. When there are fewer than 5 observations for a particular symbol I want to put NAs in each column of vector. I tried with the following code, making assumption that by splits database into sort of smaller dataframes for each Symbol (that's the x): factor.names - c(Factor1, Factor2) factor.pvalue - c(SigF1, SigF2) results - numeric() vector - matrix(0, ncol=(length(factor.names)*2+2), nrow=1) colnames(vector) - c(No.obs, factor.names, factor.pvalue) application - function(x){ rownames(vector) - x$Name for(i in 1:length(factor.names)){ if(dim(x)[1]=5){ vector[1] - dim(x)[1] vector[i+1] - cor.test(x$External, x[,factor.names[i]], method=kendall)$estimate vector[i+3] - cor.test(x$External, x[,factor.names[i]], method=kendall)$p.value } else { vector - rep(NA, length(vector)) } } results - rbind(results, vector) } by(database, database$Symbol, application) This did not work. I get : Error in dimnames(x) - dn : length of 'dimnames' [1] not equal to array extent I used browser() and I see that the Name is not assigned to the row name of vector and then dim(x)[1] does not work. What am I doing wrong? Do not understand. :-( Thank you in advance for your help. Regards, JM -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Cannot grasp how to apply by here...
Obviously, A cannot assign a row name because the dimensions do not agree. I can use rownames(vector) - x$Name[1] though. then things get calculated (I saw it with browser()) but rbind does not do what I want it to do, results remains numeric(). why? -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Cannot grasp how to apply by here...
Dear Charilaos, Thanks, I see what you mean, but I just simplified the real code here and I made a mistake by putting +2, it is +1. :-) JM On Dec 17, 2007 8:02 PM, Charilaos Skiadas [EMAIL PROTECTED] wrote: On Dec 17, 2007, at 1:47 PM, Jonas Malmros wrote: factor.names - c(Factor1, Factor2) factor.pvalue - c(SigF1, SigF2) results - numeric() vector - matrix(0, ncol=(length(factor.names)*2+2), nrow=1) colnames(vector) - c(No.obs, factor.names, factor.pvalue) If you look at vector you'll see it has column dimension 6. You are trying to assign to it 5 colnames, which is not going to work. That's exactly what the error tells you, and it happens on the line above, the rest of your code is irrelevant to it. Haris Skiadas Department of Mathematics and Computer Science Hanover College -- Jonas Malmros Stockholm University Stockholm, Sweden -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Axes limits in rgl.surface.
I have looked through the documentation and have not been able to find a way of using an xlim, ylim, or zlim type option on rgl.surface. I know that persp3d has the option, but seems to only be able to expand the axes not reduce them. Is there anyone who has an idea of how to do this? Thank you for your time. [[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] Function for AUC?
Armin Goralczyk [EMAIL PROTECTED] [Mon, Dec 17, 2007 at 11:07:25AM CET]: [AUC] I tried it: y-c(1,2,3,4,5);x-c(10,15,10,5,0) Are you sure you don't have x and y wrong? Normally the x values should be monotonically increasing. -- Johannes H�sing There is something fascinating about science. One gets such wholesale returns of conjecture mailto:[EMAIL PROTECTED] from such a trifling investment of fact. http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] polygon class in splancs package
On 18/12/2007, at 2:33 AM, Elke Moons wrote: Dear forum, I would like to use the kernel2d or spkernel2d in the Splancs- package, but it does not recognize my polygon data. Error in kernel2d(as.points(ptsbin), polygonprov, h0 = 2, nx = 100, : is the error message. Invalid poly argument The data are defined as follows: polgonprov-list(x=polyprov$X, y=polyprov$Y) with X and Y coordinates in the Lambert1972 notation. The points are defined in the same coordinate system and it does recognize them, so I don't suppose that is the problem. I can also draw the province polygon by: plot(c(192800,254100),c(154100,221800),type=n) polygon(polyprov$X,polyprov$Y) Can someone help me with this? Or explain to me how exactly is the polygon class defined in splancs? I also tried with Polygonprov-Polygon(list(x=polyprov$X,y:polyprov$Y)) but that does not seem to work either. Not absolutely sure, but I infer from experimentation that ``poly'' should be a (2-column) matrix, not a list: plot(0:1,0:1,type=n,xlab=x,ylab=y) melvin - getpoly() # Clickety-clickety-clickety. str(melvin) clyde - csr(melvin,100) irving - kernel2d(clyde,melvin,h0=2) image(irving) HTH. 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.
Re: [R] Axes limits in rgl.surface.
On 12/17/2007 2:29 PM, Todd Remund wrote: I have looked through the documentation and have not been able to find a way of using an xlim, ylim, or zlim type option on rgl.surface. I know that persp3d has the option, but seems to only be able to expand the axes not reduce them. Is there anyone who has an idea of how to do this? Thank you for your time. You'll need to do the trimming yourself. There isn't currently any support for user-controlled clipping regions in rgl. That is: for the usual case where x and y are vectors, to limit x or y to a certain range, just take a subset of those values, and a subset of the rows or columns of z. To limit the range of z, set out of range entries to NA. It will probably look ugly because it will get a very ragged edge. It appears that the NA handling for the case where x or y is a matrix leaves something to be desired. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] margin between plot region and axes
Hi useRs, in the following graphic... http://www.survey4all.org/tmp/with_margin.png I drawed a function and added two axes afterwards with axis. I could not find a way to erase the margin between the axes and the plotting region, so I solved the problem with text and segments, which looks like this: http://www.survey4all.org/tmp/no_margin.png My question: is there a way to add axes the usual way (as tried for the first graphic), but to erase the margin, so that the axes start at point (0/0) in my case. thanks in advance for any help, Albert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] margin between plot region and axes
My question: is there a way to add axes the usual way (as tried for the first graphic), but to erase the margin, so that the axes start at point (0/0) in my case. Not really sure if this is what you ask, but maybe you should call your first plot() with xaxs=i and yaxs=i. It reduces the default 4% increase on data range on both axis. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Analyzing Publications from Pubmed via XML
On Dec 15, 2007 6:31 PM, David Winsemius [EMAIL PROTECTED] wrote: pm.srch- function (){ srch.stem -http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmedterm=; query -as.character(scan(file=,what=character)) doc -xmlTreeParse(paste(srch.stem,query,sep=),isURL = TRUE, useInternalNodes = TRUE) sapply(c(//Id), xpathApply, doc = doc, fun = xmlValue) } pm.srch() 1: laryngeal neoplasms[mh] 2: Read 1 item //Id [1,] 18042931 [2,] 18038886 [3,] 17978930 [4,] 17974987 [5,] 17972507 [6,] 17970149 [7,] 17967299 [8,] 17962724 [9,] 17954109 [10,] 17942038 [11,] 17940076 [12,] 17848290 [13,] 17848288 [14,] 17848287 [15,] 17848278 [16,] 17938330 [17,] 17938329 [18,] 17918311 [19,] 17910347 [20,] 17908862 I tried the above function with simple search terms and it worked fine for me (also more output thanks to Martin's post) but when I use search terms attributed to certain fields, i.e. with [au] or [ta], I get the following error message: pm.srch() 1: laryngeal neoplasms[mh] 2: Read 1 item Fehler in .Call(RS_XML_ParseTree, as.character(file), handlers, as.logical(ignoreBlanks), : error in creating parser for http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmedterm=laryngeal neoplasms[mh] I/O warning : failed to load external entity http%3A//eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb=pubmedterm=laryngeal%20neoplasms%5Bmh%5D What's wrong? Thanks for any help -- Armin Goralczyk, M.D. -- Universitätsmedizin Göttingen Abteilung Allgemein- und Viszeralchirurgie Rudolf-Koch-Str. 40 39099 Göttingen -- Dept. of General Surgery University of Göttingen Göttingen, Germany -- http://www.chirurgie-goettingen.de __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 Package - Clara w/ categorical variables
I'm running a cluster analysis with many observations (approx. 7,000) using both continuous and categorical variables. PAM is a theoretically appealing approach however I believe the number of observations makes its use untenable. CLARA, which uses the PAM algorithm seems like the algorithm to use however it requires a numeric data matrix or data frame with rows corresponding to cases and columns to variables. Since a dissimilarity matrix is not legitimate input (to CLARA) and since a data matrix with categorical variables is also inappropriate, it seems that CLARA may only be run on numeric data. If thats true, I'm wondering what the benefit is in using the PAM algorithm (a generalization of K-means which, in part, addresses inclusion of categorical variables). My guess is I'm missing something, any insight would be appreciated. Many thanks, Joe Retzer [[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] Dual Core vs Quad Core
Dear R-users, I use R to run spatial stuff and it takes up a lot of ram. Runs can take hours or days. I am thinking of getting a new desktop. Can R take advantage of the dual-core system? I have a dual-core computer at work. But it seems that right now R is using only one processor. The new computers feature quad core with 3GB of RAM. Can R take advantage of the 4 chips? Or am I better off getting a dual core with faster processing speed per chip? Thanks! Any advice would be really appreciated! K. - [[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] bar plot colors
All, I have a question regarding colors in bar plots. I want to stack a total of 18 cost values in each bar. Basically, it is six cost types and each cost type has three components- direct, indirect, and induced costs. I would like to use both solid color bars and bars with the slanted lines (using the density parameter). The colors would distinguish cost types and the lines would distinguish direct/indirect/induced. I want the cost types (i.e. colors) to be stacked together for each cost type. In other words, I don't want all of the solid bars at the bottom and all of the slanted lines at the top. So far, I have made a bar plot with all solid colors and then tried to overwrite that bar plot by calling barplot() again and putting the white slanted lines across the bars. However, I can't get this method to work while still grouping the cost types together. Thanks in advance for any help you can provide. David Winkel Applied Biology and Aerosol Technology Battelle Memorial Institute 505 King Ave. Columbus, Ohio 43201 614.424.3513 [[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] odd error messages coming from val.prob() {Design}
Hi, after upgrading my R install from 2.5 - 2.6.1 and performing multiple iterations of update.packages(), I am getting an odd error when trying to plot a calibration curve from the val.prob() function in package Design. when running this function (which used to work) I get the following error message: Error in .C(lowess, x = as.double(xy$x[o]), as.double(xy$y[o]), n, as.double(f), : C symbol name lowess not in DLL for package base Here is my relevent session info: R version 2.6.1 (2007-11-26) i686-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] e1071_1.5-17 class_7.2-38 lattice_0.17-2 Cairo_1.3-5ROCR_1.0-2 [6] gplots_2.3.2 gdata_2.3.1gtools_2.4.0 Design_2.1-1 survival_2.34 [11] Hmisc_3.4-3 loaded via a namespace (and not attached): [1] cluster_1.11.9 grid_2.6.1 rcompgen_0.1-17 Any ideas? cheers, Dylan -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] regression towards the mean, AS paper November 2007
This has nothing to do really with the question that Troels asked, but the exposition quoted from the AA paper is unnecessarily confusing. The phrase ``Because X0 and X1 have identical marginal distributions ...'' throws the reader off the track. The identical marginal distributions are irrelevant. All one needs is that the ***means*** of X0 and X1 be the same, and then the null hypothesis tested by a paired t-test is true and so the p-values are (asymptotically) Uniform[0,1]. With a sample size of 100, the ``asymptotically'' bit can be safely ignored for any ``decent'' joint distribution of X0 and X1. If one further assumes that X0 - X1 is Gaussian (which has nothing to do with X0 and X1 having identical marginal distributions) then ``asymptotically'' turns into ``exactly''. Another related issue is that uniform distributions don't look very uniform: hist(runif(100)) hist(runif(1000)) hist(runif(1)) Be sure to calibrate your eyes (and your bin width) before rejecting the hypothesis that the distribution is uniform. Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] bar plot colors
I have a question regarding colors in bar plots. I want to stack a total of 18 cost values in each bar. Basically, it is six cost types and each cost type has three components- direct, indirect, and induced costs. I would like to use both solid color bars and bars with the slanted lines (using the density parameter). The colors would distinguish cost types and the lines would distinguish direct/indirect/induced. I want the cost types (i.e. colors) to be stacked together for each cost type. In other words, I don't want all of the solid bars at the bottom and all of the slanted lines at the top. What are you trying to achieve with such a plot? A stacked bar chart only allows easy comparisons of cumulative totals (eg. cost 1, or cost 1 + 2, or cost 1 + 2 + 3) and it will be very difficult to compare individual cost types or components within a type. You might want to think about a series of line plots instead. Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] margin between plot region and axes
Am Montag, den 17.12.2007, 21:22 +0100 schrieb Scionforbai: My question: is there a way to add axes the usual way (as tried for the first graphic), but to erase the margin, so that the axes start at point (0/0) in my case. Not really sure if this is what you ask, but maybe you should call your first plot() with xaxs=i and yaxs=i. It reduces the default 4% increase on data range on both axis. thanks for your answer and sorry for the weak explanation of the problem. To put it another way: consider the following simple statement: hist(rnorm(100)) how can I influence drawing of the axis so that they lie directly on the edges of the bars? The solution on this I think could directly be applied to my problem. regards, Albert __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] names in Rscript -e
Hi, I seem to have a problem when passing named parameters to R via Rscript (R2.5.1, bash shell). As soon as I name elements of a list Rscript generates an error. I will appreciate if someone could point to me a correct way of doing this. Thanks, Vadim ## This works bash-3.2$ Rscript.exe -e 'list(1)' [[1]] [1] 1 # and these do not work bash-3.2$ Rscript.exe -e 'list(a=1)' Error in -args : invalid argument to unary operator Execution halted bash-3.2$ Rscript.exe -e 'list(\a\=1)' Error in -args : invalid argument to unary operator Execution halted [[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] Res: convert table
Ciao Giovanni, Try this. x-matrix(sample(0:4,25,replace=T),nc=5) x x[x0]-1 x Miltinho uno capoeirista brasiliano - Mensagem original De: giovanni bacaro [EMAIL PROTECTED] Para: [EMAIL PROTECTED] Enviadas: Segunda-feira, 17 de Dezembro de 2007 14:03:34 Assunto: [R] convert table Dear R user, a very simple question: I have a table like this: coorv1v2v3 x11233123 x21123 x312 x4331 and I'd like to tranform this matrix in presence/absence data.frame coor11233123 x10111 x21001 x30100 x41010 Could you suggest me a direct way to do this? Thank you Giovanni __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. para armazenamento! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Identity link in tweedie
Cristina I'm using the tweedie distribution package and I cant figure out how to run a model using an identity link. I know I can use a log link by having link.power=0 and I think identity would be link.power=1, but I'm not sure. Yes, that is correct. Furthermore when I try running it with link.power=1 it requires starting values which I cant manage to give appropriately Without any code to see, I will guess at what is happening. The trouble with using an identity link is that the predicted means, say mu, may be negative, where as the Tweedie distributions have mu greater than zero. In using the identity link, you may be asking R to fit the impossible. Perhaps the question you need to ask is this: Why do you need an identity link? P. -- Dr Peter Dunn | dunn at usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidentia...{{dropped:15}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] margin between plot region and axes
On 17/12/2007 4:19 PM, Albert Greinoecker wrote: Am Montag, den 17.12.2007, 21:22 +0100 schrieb Scionforbai: My question: is there a way to add axes the usual way (as tried for the first graphic), but to erase the margin, so that the axes start at point (0/0) in my case. Not really sure if this is what you ask, but maybe you should call your first plot() with xaxs=i and yaxs=i. It reduces the default 4% increase on data range on both axis. thanks for your answer and sorry for the weak explanation of the problem. To put it another way: consider the following simple statement: hist(rnorm(100)) how can I influence drawing of the axis so that they lie directly on the edges of the bars? The solution on this I think could directly be applied to my problem. That's what he was getting at: par(xaxs=i, yaxs=i) hist(rnorm(100)) Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Why is conversion not working?
I have a data frame, where two last columns - month and year - are character vectors. The year vector is made of two numbers (i.e. 97 for 1997, 07 for 2007, etc) What I want to do is to create a variable Year that is mode numeric and where each record is a four-figure number (1997, 2007,...) I have about 4 rows in the dataframe, the observations are for 10 years (so there are multiple rows for each year). I tried the following, but the program runs and runs, and if I abort it all the years in Year are 1997: for(i in 1:dim(database)[1]){ if(database$year[i]90) { database$Year[i] - as.numeric(database$year[i])+1900 } else { database$Year[i] - as.numeric(database$year[i])+2000 } } Thanks in advance for explanations. Regards, JM -- Jonas Malmros Stockholm University Stockholm, Sweden __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Analyzing Publications from Pubmed via XML
Armin Goralczyk [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: On Dec 15, 2007 6:31 PM, David Winsemius [EMAIL PROTECTED] wrote: pm.srch- function (){ srch.stem -http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pub medterm= query -as.character(scan(file=,what=character)) doc -xmlTreeParse(paste(srch.stem,query,sep=),isURL = TRUE, useInternalNodes = TRUE) sapply(c(//Id), xpathApply, doc = doc, fun = xmlValue) } pm.srch() 1: laryngeal neoplasms[mh] 2: Read 1 item //Id [1,] 18042931 snipped list of IDs I tried the above function with simple search terms and it worked fine for me (also more output thanks to Martin's post) but when I use search terms attributed to certain fields, i.e. with [au] or [ta], I get the following error message: pm.srch() 1: laryngeal neoplasms[mh] 2: Read 1 item Fehler in .Call(RS_XML_ParseTree, as.character(file), handlers, as.logical(ignoreBlanks), : error in creating parser for http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmedter m=laryngeal neoplasms[mh] I/O warning : failed to load external entity http%3A//eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi%3Fdb=pubme dterm=laryngeal%20neoplasms%5Bmh%5D What's wrong? I'm not sure. You included my simple example. rather than your search string that provoked an error. This is an example search that one can find on the how-to page for literature searches with /esearch: http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmedterm=PNAS[ta]+AND+97[vi]retstart=6retmax=6tool=biomed3 I am wondering if you used spaces, rather than +'s? If so then you may want your function to do more gsub-processing of the input string. When I use the search terms in NCBI's example I get: pm.srch- function (){ + srch.stem-http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmedterm=; + query-as.character(scan(file=,what=character)) + doc-xmlTreeParse(paste(srch.stem,query,sep=),isURL = TRUE, useInternalNodes = TRUE) + sapply(c(//Id), xpathApply, doc = doc, fun = xmlValue) + } doc.xml-pm.srch() 1: PNAS[ta]+AND+97[vi] 2: Read 1 item doc.xml //Id [1,] 16578858 [2,] 11186225 [3,] 11121081 [4,] 11121080 [5,] 11121079 [6,] 11121078 [7,] 11121077 [8,] 11121076 [9,] 11121075 [10,] 11121074 [11,] 11121073 [12,] 11121072 [13,] 11121071 [14,] 11121070 [15,] 11121069 [16,] 11121068 [17,] 11121067 [18,] 11121066 [19,] 11121065 [20,] 11121064 -- David Winsemius, MD Thanks for any help -- Armin Goralczyk, M.D. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Dual Core vs Quad Core
On Mon, 17 Dec 2007, Kitty Lee wrote: Dear R-users, I use R to run spatial stuff and it takes up a lot of ram. Runs can take hours or days. I am thinking of getting a new desktop. Can R take advantage of the dual-core system? I have a dual-core computer at work. But it seems that right now R is using only one processor. The new computers feature quad core with 3GB of RAM. Can R take advantage of the 4 chips? Or am I better off getting a dual core with faster processing speed per chip? Thanks! Any advice would be really appreciated! K. If I have my information right, R will use dual- or quad-cores if it's doing two (or four) things at once. The second core will help a little bit insofar as whatever else your machine is doing won't interfere with the one core on which it's running, but generally things that take a single thread will remain on a single core. As for RAM, if you're doing memory-bound work you should certainly be using a 64-bit machine and OS so you can utilize the larger memory space. -- Andrew J Perrin - andrew_perrin (at) unc.edu - http://perrin.socsci.unc.edu Associate Professor of Sociology; Book Review Editor, _Social Forces_ University of North Carolina - CB#3210, Chapel Hill, NC 27599-3210 USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Scatterplot Showing All Points
On 17/12/2007 8:14 PM, Wayne Aldo Gavioli wrote: Hello all, I'm trying to graph a scatterplot of a large (5,000 x,y coordinates) of data with the caveat that many of the data points overlap with each other (share the same x AND y coordinates). In using the usual plot command, plot(education, xlab=etc, ylab=etc) it seems that the overlap of points is not shown in the graph. Namely, there are 5,000 points that should be plotted, as I mentioned above, but because so many of the points overlap with each other exactly, only about 50-60 points are actually plotted on the graph. Thus, there's no indication that Point A shares its coordinates with 200 other pieces of data and thus is very common while Point B doesn't share its coordinates with any other pieces of data and thus isn't common at all. Is there anyway to indicate the frequency of such points on such a graph? Should I be using a different command than plot? The jitter() function can add a bit of noise to your data, so that repeated points show up as groupings instead of isolated points. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scatterplot Showing All Points
Wayne, I am fond of the bagplot (think 2D box plot) to replace scatter plots for large N. See http://www.wiwi.uni-bielefeld.de/~wolf/software/aplpack/ and aplpack in CRAN. -- HTH, Jim Porzak Responsys, Inc. San Francisco, CA http://www.linkedin.com/in/jimporzak On Dec 17, 2007 5:14 PM, Wayne Aldo Gavioli [EMAIL PROTECTED] wrote: Hello all, I'm trying to graph a scatterplot of a large (5,000 x,y coordinates) of data with the caveat that many of the data points overlap with each other (share the same x AND y coordinates). In using the usual plot command, plot(education, xlab=etc, ylab=etc) it seems that the overlap of points is not shown in the graph. Namely, there are 5,000 points that should be plotted, as I mentioned above, but because so many of the points overlap with each other exactly, only about 50-60 points are actually plotted on the graph. Thus, there's no indication that Point A shares its coordinates with 200 other pieces of data and thus is very common while Point B doesn't share its coordinates with any other pieces of data and thus isn't common at all. Is there anyway to indicate the frequency of such points on such a graph? Should I be using a different command than plot? Thanks, Wayne __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Res: Scatterplot Showing All Points
Hi Wayne, I have two suggestion to you. 1. You add some random noise on both x and y data or 2. You graph bubble points, where the size is proportional to the frequence of the xy combination. x-sample(1:10,1,replace=T) y-sample(1:10,1,replace=T) xy-cbind(x,y) x11(1400,800) par(mfrow=c(1,3)) plot(xy) xy.random-xy+rnorm(2,0.1,0.1) plot(xy.random,cex=0.1) xy.tab-data.frame(table(x,y)) xy.tab$x-as.numeric(as.character(xy.tab$x)) xy.tab$y-as.numeric(as.character(xy.tab$y)) min.freq-min(xy.tab$Freq) max.freq-max(xy.tab$Freq) plot(xy.tab$x,xy.tab$y,cex=(xy.tab$Freq-min.freq)/(max.freq-min.freq)*5) Kind regards, Miltinho Brazil - Mensagem original De: Wayne Aldo Gavioli [EMAIL PROTECTED] Para: r-help@r-project.org Enviadas: Segunda-feira, 17 de Dezembro de 2007 22:14:23 Assunto: [R] Scatterplot Showing All Points Hello all, I'm trying to graph a scatterplot of a large (5,000 x,y coordinates) of data with the caveat that many of the data points overlap with each other (share the same x AND y coordinates). In using the usual plot command, plot(education, xlab=etc, ylab=etc) it seems that the overlap of points is not shown in the graph. Namely, there are 5,000 points that should be plotted, as I mentioned above, but because so many of the points overlap with each other exactly, only about 50-60 points are actually plotted on the graph. Thus, there's no indication that Point A shares its coordinates with 200 other pieces of data and thus is very common while Point B doesn't share its coordinates with any other pieces of data and thus isn't common at all. Is there anyway to indicate the frequency of such points on such a graph? Should I be using a different command than plot? Thanks, Wayne __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. para armazenamento! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Analyzing Publications from Pubmed via XML
David Winsemius [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Armin Goralczyk [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: I tried the above function with simple search terms and it worked fine for me (also more output thanks to Martin's post) but when I use search terms attributed to certain fields, i.e. with [au] or [ta], I get the following error message: pm.srch() 1: laryngeal neoplasms[mh] 2: I am wondering if you used spaces, rather than +'s? If so then you may want your function to do more gsub-processing of the input string. I tried my theory that one would need +'s instead of spaces, but disproved it. Spaces in the input string seems to produce acceptable results on my WinXP/R.2.6.1/RGui system even with more complex search strings. -- David Winsemius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] read.table() and precision?
Dear List, Following the below question I have a question of my own: Suppose that I have large matrices which are produced sequentially and must be used sequentially in the reverse order. I do not have enough memory to store them and so I would like to write them to disk and then read them. This raises two questions: 1) what is the fastest (and the most economic space-wise) way to do this? 2) functions like write, write.table, etc. write the data the way it is printed and this may result in a loss of accuracy. Is there any way to prevent this, except for setting the digits option to a higher value or using format prior to writing the data? Is it possible to write binary files (similar to Fortran)? Any suggestion will be greatly appreciated. --- Wojciech Gryc [EMAIL PROTECTED] wrote: Hi, I'm currently working with data that has values as large as 99,000,000 but is accurate to 6 decimal places. Unfortunately, when I load the data using read.table(), it rounds everything to the nearest integer. Is there any way for me to preserve the information or work with arbitrarily large floating point numbers? Thank you, Wojciech -- Five Minutes to Midnight: Youth on human rights and current affairs http://www.fiveminutestomidnight.org/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] gam() in gam package
R-users E-mail: r-help@r-project.org I have a quenstion on gam() in gam package. The help of gam() says: 'gam' uses the _backfitting algorithm_ to combine different smoothing or fitting methods. On the other hand, lm.wfit(), which is a routine of gam.fit() contains: z - .Fortran(dqrls, qr = x * wts, n = n, p = p, y = y * wts, ny = ny, tol = as.double(tol), coefficients = mat.or.vec(p, ny), residuals = y, effects = mat.or.vec(n, ny), rank = integer(1), pivot = 1:p, qraux = double(p), work = double(2 * p), PACKAGE = base) It may indicate that QR decomposition is used to derive an additive model instead of backfitting. I am wondering if my guess is correct, or this the _backfitting algorithm has another meaning. E-mail: [EMAIL PROTECTED] * http://cse.naro.affrc.go.jp/takezawa/intro.html * [[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] Dual Core vs Quad Core
I ran a bayesian simulation sometime ago and it took me 1 week to finish on a debian box (Dell PE 2850 Dual Intel [EMAIL PROTECTED] 6GB). I think it depends on the setting of the experiment and whether the code can be parallelized. Simon Blomberg wrote: I've been running R on a quad-core using Debian Gnu/Linux since March this year, and I am very pleased with the performance. Simon. On Mon, 2007-12-17 at 20:13 -0500, Andrew Perrin wrote: On Mon, 17 Dec 2007, Kitty Lee wrote: Dear R-users, I use R to run spatial stuff and it takes up a lot of ram. Runs can take hours or days. I am thinking of getting a new desktop. Can R take advantage of the dual-core system? I have a dual-core computer at work. But it seems that right now R is using only one processor. The new computers feature quad core with 3GB of RAM. Can R take advantage of the 4 chips? Or am I better off getting a dual core with faster processing speed per chip? Thanks! Any advice would be really appreciated! K. If I have my information right, R will use dual- or quad-cores if it's doing two (or four) things at once. The second core will help a little bit insofar as whatever else your machine is doing won't interfere with the one core on which it's running, but generally things that take a single thread will remain on a single core. As for RAM, if you're doing memory-bound work you should certainly be using a 64-bit machine and OS so you can utilize the larger memory space. -- Andrew J Perrin - andrew_perrin (at) unc.edu - http://perrin.socsci.unc.edu Associate Professor of Sociology; Book Review Editor, _Social Forces_ University of North Carolina - CB#3210, Chapel Hill, NC 27599-3210 USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] R-users
R-users E-mail: r-help@r-project.org I have a quenstion on gam() in gam package. The help of gam() says: 'gam' uses the _backfitting algorithm_ to combine different smoothing or fitting methods. On the other hand, lm.wfit(), which is a routine of gam.fit() contains: z - .Fortran(dqrls, qr = x * wts, n = n, p = p, y = y * wts, ny = ny, tol = as.double(tol), coefficients = mat.or.vec(p, ny), residuals = y, effects = mat.or.vec(n, ny), rank = integer(1), pivot = 1:p, qraux = double(p), work = double(2 * p), PACKAGE = base) It may indicate that QR decomposition is used to derive an additive model instead of backfitting. I am wondering if my guess is correct, or this the _backfitting algorithm has another meaning. -- *[EMAIL PROTECTED]* http://cse.naro.affrc.go.jp/takezawa/intro.html [[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.