Re: [R] dissimilarity matrices
On Thu, 2006-11-09 at 17:50 +, Kris Lockyear wrote: Dear All, I have a dissimilarity matrix which I happily convert to a distance object by running: X - as.dist(Y) and I can happily now run either hclust(X) or agnes(X). So that the various bits of output are labelled correctly I would dearly like to be able to give names to the columns and rows of X, as would happen if I ran: mydata-read.table(clipboard,header=T) mydata2-t(mydata) mydists-dist(mydata2) I assume Y doesn't have column/row names then? So give Y some col/row names before you convert it to a dist object: mat - matrix(seq(0.1, 0.9, by = 0.1), ncol = 3) diag(mat) - 0 mat [,1] [,2] [,3] [1,] 0.0 0.4 0.7 [2,] 0.2 0.0 0.8 [3,] 0.3 0.6 0.0 distmat - as.dist(mat) distmat 1 2 2 0.2 3 0.3 0.6 rownames(mat) - colnames(mat) - LETTERS[1:3] distmat - as.dist(mat) distmat A B B 0.2 C 0.3 0.6 or you can modify the Labels attribute of your object X, *after* you have done as.dist(Y), e.g. following on from the above example: attr(distmat, Labels) - paste(Samp, 1:3, sep = ) distmat Samp1 Samp2 Samp2 0.2 Samp3 0.3 0.6 HTH G Many thanks for your help. Best wishes, Kris Lockyear. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT [w] http://www.freshwaters.org.uk/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] PCA reconstruction funtion
Also new values can be easy calculated from prcomp object: Data - scale(iris[,1:4],center=TRUE,scale=TRUE) iris.pc - prcomp(Data) # Explained variation (iris.pc$sdev^2/sum(iris.pc$sdev^2))*100 # Loadings iric.pc$rotation #Scores iris.pc$x #Fitted Values for each PC # Xfit = T*P^t PCfit - function (i,pcdata) {PCI - pcdata$x[,i]%*%t(pcdata$rotation[,i])} Fitted - lapply (c(1:4),PCfit,pcdata=iris.pc) for ( i in c(1:4) ) { assign (paste(IrisPC,i,sep=),Fitted[[i]])} #Residuals EPC1 - round(Data - IrisPC1,3) EPC2 - round(Data - (IrisPC1+IrisPC2),3) EPC3 - round(Data - (IrisPC1+IrisPC2+IrisPC3),3) EPC4 - round(Data - (IrisPC1+IrisPC2+IrisPC3+IrisPC4),3)# 0 Andris Jankevics On Piektdiena, 10. Novembris 2006 05:58, Renaud Lancelot wrote: See ?rconst in package ade4. You will need to fit the PCA with dudi.pca (same package). Best, Renaud 2006/11/9, Poizot Emmanuel [EMAIL PROTECTED]: Dear all, I did performed a PCA analysis (using prcomp function) on a data matrix. Then I would like to reconstruction part of the original data set using only specifics and choosen eigenvectors. I would like to know if there is a function under R witch can perform this reconstruction. Regards -- Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] About using the boot function
Dear All, I tried to use the boot function, provided in the boot package, in such a simple task as to create a bootstrap distribution of the mean of a vector x. I wrote: b - boot(x, mean, R=200) Well, it doesn't work. I suspect it has something to do with what is called second argument of the statistic in the help page of boot. What is the second argument of mean? I don't understand. The whole description in the documentation about this second argument is somewaht cryptic and confusing. Will someone please help me? Sincerely, J. Marques de Sá [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About using the boot function
Joaquim, you have to write your own function that takes the data and the index, which is passed to it by boot(). try this ... x2 - c(2, 3, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 7, 2, 3, 4, 3, 4, 3, 5, 6, 7, 5) mean.boot - function(x, i) mean(x[i]) b1 -boot(x2, mean.boot, 999) b1 Cheers Andrew Dear All, I tried to use the boot function, provided in the boot package, in such a simple task as to create a bootstrap distribution of the mean of a vector x. I wrote: b - boot(x, mean, R=200) Well, it doesn't work. I suspect it has something to do with what is called second argument of the statistic in the help page of boot. What is the second argument of mean? I don't understand. The whole description in the documentation about this second argument is somewaht cryptic and confusing. Will someone please help me? Sincerely, J. Marques de S? [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Meta-regression with lmer() ? If so, how ?
I guess I'll chip in, since I wrote that function (which is going to be updated thoroughly in the near future -- I will probably expand it to an entire package). Have a look at MiMa at Wolfgang Viechtbauer's page. Is that what you are looking for? http://www.wvbauer.com/downloads.html As far as I can tell, mima does what I mean to do, but there are some limits : - mima works on effects, and therefore has an unusual form in R models The dependent variable to be used with the mima function can be any measure for which we have a known sampling variance (or approximately so) and that is (approximately) normally distributed. So, the dependent variable could be log odds ratios, log risk ratios, standardized mean differences, and so on. Are you looking for the option to input the results from each study arm individually? (e.g., the log odds for a control and a treatment group). You could also use mima then (with an appropriately coded moderator). However, it would then make more sense to assume a common (but random) intercept for all the arms from a single study. At this point, the function isn't set up that way, but I think I could rewrite it to do that. - as far as I can tell, mima allows to asses the effect of variables *nesting* studies, but not of variables *crossed* in each study ; therefore, ypou cannot directly test the effect of such variables ; I am not sure if I understand this point. I think this may relate to the fact that (if I understand it correctly), you want to input the results from each arm separately. - as far as I can tell, the variables of interest (moderators, in mima parlance) can be either two-level factors, booleans or numeric variables, i. e variables having a single regression coeffiient : mima builds an estimator for the regression coefficient of each variable and its variance, and tests by a Z-test. This is not applicable to n-valued factors (n2) or ordered factors, which could be tested by {variance|deviance} analysis. You can also test for blocks of moderators with the mima function. Let's say you have two dummy variables that are coded to indicate differences between three groups (e.g., low, medium, and high quality studies). Now you want to test if quality makes at all a difference (as opposed to testing the two dummy variables individually). Use the out=yes option and then do the following: 1) from $b, take the (2x1) subset of the parameter estimates corresponding to the two dummy variables; denote this vector with b.sub 2) from $vb, take the (2x2) subset from the variance-covariance matrix corresponding to the two dummy variables (i.e., their variances and the covariance); denote this vector with vb.sub 3) then t(b.sub) %*% solve(vb.sub) %*% b.sub is approximately chi-square distributed under H0 with 2 degrees of freedom. I am also going to add to the function the option to output the log likelihood value. Then likelihood ratio tests are a snap to do with full versus reduced models. But for now, the above should work. Feel free to get in touch with me via e-mail. Best, -- Wolfgang Viechtbauer Department of Methodology and Statistics University of Maastricht, The Netherlands http://www.wvbauer.com/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Command Line Prompt Symbol
On 11/10/2006 1:46 AM, [EMAIL PROTECTED] wrote: The simplest way to do this is to put options(prompt = R ) in your .Rprofile file. If you don't have an .Rprofile file, then persuading Windows to let you call a file by that name can be frustrating. The easiest way is probably to use the Save as... menu item in your favourite editor, and put the name in quotes, e.g. .Rprofile. This even works in Notepad, which is nobody's favourite editor. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
Charilaos Skiadas wrote: As a addendum to all this, this is one of the responses I got from one of my colleagues: The problem with R is that our students in many social science fields, are expected to know SPSS when they go to graduate school. Not having a background in SPSS would put these students at a disadvantage. Is this really the case? Does anyone have any such statistics? Unfortunately not statistics, but my experience in nearly every (psychology) research unit in which I have worked is that my colleagues initially expected me to use SPSS and reeled back in horror if I said that I preferred something else. They took anywhere from weeks to forever to realize that they were getting at least as good, and in many cases better, analyses of their data. For many people, statistical software is a belief, not an understanding. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] axis command and excel time format
Carmen, Gabor has already given you the detail you ask for, but might try the following plot to see what is going wrong: plot(times(tt), x, type='l') This does not give you the EXACT control of the axis you asked for, but this simple plot command gives you a fairly nice result. It illustrates that your code is failing becasue you are plotting x against the index of x rather than plotting x against time. At least this is what I think the misunderstanding is. Thank you Robert, this is nearly what I need, but my problem is that I need an empty window with axes. I am able to build this with any data but not with the time axis. I need for a special issue only horizontal lines with different colors and arrows, which will be inserted from a function. Maybe you could explain me what's the difference between library(zoo) library(chron) time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='n') - error in xy.coords(x, y, xlabel, ylabel, log) :'x' and 'y' lengths differ - the error is only with type='n' and not with type='l' and the example without errors library(zoo) library(chron) time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='l') It is not the type='n' every other combination of data types which i tried was working with the no plot option y - c(0,10) z - c(0,10) plot(z, y, type='n') Carmen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simplifying Sweave graphics
Dear all, I was wondering if it's possible to simplify graphs created with Sweave. I'm using in a document several plots with each about 4000 points (qqnorm(rnorm(4000))). It looks likes the information of each points is maintained in the graph. As a result of that the pdf filesize get's quite large (about 4,2 MB for a 23 page document.) Is there a way to reduce the complexity of these graphs? Like creating the graphs in a bitmap format instead of a vector format? Thanks, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.inbo.be http://www.inbo.be/ Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
Our first-year graduate statistics course (in psychology) is taught by Prof. Paul Rosenbaum, in the statistics department. Last year (according to my students), he discouraged students from using R for their homework. He told them it was too hard. Now he is again teaching the course, recommending R, and making the homework data available in an R-friendly format (i.e., not xls or JMP format). The student culture is changing too. They help each other. Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron Editor: Judgment and Decision Making (http://journal.sjdm.org) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Combining factors
Hi I know this is a basic question and I know I have done it before but I can't find the answer any more. I have a data set, say: F1, F2, Value F1 and F2 are Factors. I would like to plot plot(TheCombinationOf(F1, F2), Value) I remember there was a function for TheCombinationOf() but I don't remember the name. I could create a new factor based on F1 and F2, but I would prefer the other soluytion. Any help welcome, Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] missing symbols for mathplot
Hi all, I'm trying to write an axis label that sounds P( X | K and Xb ) (probability of X given K and Xb ) but I need the intersection symbol (the \cap in latex) Actually I did'nt find any cap symbol in plotmath, the only one is intersect(A[i],i==1,n) but is not my case because subscripts and arguments are mandatory. Anyone knows how to do? Thanks Andrea -- View this message in context: http://www.nabble.com/missing-symbols-for-mathplot-tf2607328.html#a7275849 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simplifying Sweave graphics
Hi. One guy of my team (Thibaut Jombart) wrote a driver to sweave in png (see http://tolstoy.newcastle.edu.au/R/devel/06/03/4599.html). The driver works very nice and is very useful for plots with many points, raster images... I thought that Friedrich Leisch would include it in the Sweave distribution, but it is not in the current distribution. I am sure that you can ask Thibaut (jombart_at_biomserv.univ-lyon1.fr) for the function. Sincerely. ONKELINX, Thierry wrote: Dear all, I was wondering if it's possible to simplify graphs created with Sweave. I'm using in a document several plots with each about 4000 points (qqnorm(rnorm(4000))). It looks likes the information of each points is maintained in the graph. As a result of that the pdf filesize get's quite large (about 4,2 MB for a 23 page document.) Is there a way to reduce the complexity of these graphs? Like creating the graphs in a bitmap format instead of a vector format? Thanks, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.inbo.be http://www.inbo.be/ Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Stéphane DRAY ([EMAIL PROTECTED] ) Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I 43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France Tel: 33 4 72 43 27 57 Fax: 33 4 72 43 13 88 http://biomserv.univ-lyon1.fr/~dray/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Combining factors
Peter Dalgaard wrote: Rainer M Krug [EMAIL PROTECTED] writes: Hi I know this is a basic question and I know I have done it before but I can't find the answer any more. I have a data set, say: F1, F2, Value F1 and F2 are Factors. I would like to plot plot(TheCombinationOf(F1, F2), Value) I remember there was a function for TheCombinationOf() but I don't remember the name. I could create a new factor based on F1 and F2, but I would prefer the other soluytion. Any help welcome, F1:F2 interaction(F1,F2) There are some differences so lookup the help page for the latter. Thanks a lot Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Combining factors
Rainer M Krug [EMAIL PROTECTED] writes: Hi I know this is a basic question and I know I have done it before but I can't find the answer any more. I have a data set, say: F1, F2, Value F1 and F2 are Factors. I would like to plot plot(TheCombinationOf(F1, F2), Value) I remember there was a function for TheCombinationOf() but I don't remember the name. I could create a new factor based on F1 and F2, but I would prefer the other soluytion. Any help welcome, F1:F2 interaction(F1,F2) There are some differences so lookup the help page for the latter. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
More impressions -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charilaos Skiadas Sent: Thursday, November 09, 2006 11:45 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] Making a case for using R in Academia John (and everyone else), On Nov 9, 2006, at 4:20 PM, John Fox wrote: Dear Charilaos, It's very difficult to give definitive answers to the questions that you pose because we don't have any good data (at least as far as I know) about how widely R is used. Yes it certainly isn't an easy question to answer, and I don't necessarily need complete data. The situation as presented to me by my colleagues in the Social Sciences is really that SPSS is the standard, so I am basically hoping for evidence to just shake this view (unless it is true, but I have to say I doubt it). I am more hoping for particular examples of cases in the Social Sciences, where SPSS is far from the standard, and the programs and schools you mention below are exactly the sort of thing I was looking for! I think it is not the standard -- often unheard of -- by the social science community in large research universities in the States where SAS dominates (unless you are in the Chicago area). So I agree with John. It is perhaps more popular among social scientists in Europe. For now unfortunately we will be sticking with SPSS, despite the considerable cost (which was mainly our problem at the moment, so SAS is not even being considered for that reason), but I am hoping to slowly build enough evidence of the extensive use of R for when all this comes up again. Even just a list of the universities and departments that use it would be very helpful, so any of you who would like to send such information about your departments or other departments you might know about, off the list, it would be extremely helpful to me. Perhaps it would be useful for such a list to exist somewhere online? (I guess you could say google, but I find it hard to use google to look up such information on R, for the obvious reason of the shortness of the name. [snip] Among social scientists the picture is not as clear. My impression is that SPSS is used very widely for low-levels methods courses taught to undergraduates, and not very extensively in the best social-science graduate programmes. I would expect that, at present, Stata use in social- science graduate programmes exceeds R, and that SAS and R would also be used fairly widely. In my opinion, these are the only reasonable choices -- I don't think that SPSS is sufficiently capable to compete with R, Stata, or SAS. There are, for example, several different packages used at the ICPSR Summer Program in Quantitative Methods for Social Research, but several relatively advanced courses now use R. Likewise, the Oxford Spring School, hosted by the Department of Politics and International Relations at Oxford, has mostly employed R and Stata. Thanks, I will be looking into those. I basically just need to look at various universities and their social sciences departments, and see what they use there. As other suggested, I will be looking into the number of books and papers in R and how it is increasing every year. Once again thank you all for your comments, this has been a very helpful discussion for me, and it's a great pleasure to find such a helpful and friendly mailing list. Of course, my own preference is for R. Regards, John Haris __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Marwan Khawaja, Ph.D. Professor Director Center for Research on Population Health American University of Beirut P.O. Box 11-0236, Riad El Solh Beirut 1107 2020 Lebanon Email: [EMAIL PROTECTED] Url: http://staff.aub.edu.lb/~mk36/ Tel: +961 1 35 00 00 ext. 4668 Fax: +961 1 74 44 70 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with as.data.frame when an extra attribute is present
It's quite intentional, as it is the documented behaviour of data.frame: Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by 'I' will be recycled a whole number of times if necessary. data.frame(a = structure(1, label=foo), b = c(2, 3)) Error in data.frame(a = structure(1, label = foo), b = c(2, 3)) : arguments imply differing number of rows: 1, 2 It is safe to replicate a vector without any attributes, but not safe to replicate this 'a': you will have to do it yourself if you know it is safe. How is anyone to know you meant 'label' to apply to the whole vector and not the single element of the vector (if you did)? On Thu, 9 Nov 2006, Frank E Harrell Jr wrote: I have a problem when one of the vectors in a list needs to be replicated to have the appropriate length, and an attribute is present. w - list(a=1, b=2:3) as.data.frame(w) a b 1 1 2 2 1 3 attr(w$a,'label') - 'foo' as.data.frame(w) Error in data.frame(a = 1, b = c(2, 3), check.names = TRUE) : arguments imply differing number of rows: 1, 2 I usually use the Hmisc label function to make a variable of class 'labelled' and define as.data.frame.labelled as as.data.frame.vector, but that also fails here. Any help appreciated. -Frank sessionInfo() R version 2.2.1, 2005-12-20, i486-pc-linux-gnu [also fails in 2.4.0] attached base packages: [1] methods stats graphics grDevices utils datasets [7] base -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with nlme function
Hello. I am trying to fit a nonlinear mixed model involving 3 parameters. I have successfully made a self-starting function. getInitial() correctly outputs the initial estimates. I can also use the nlsList with this function to get the separate nonlinear fits by group. However, I get an error message when using the nlme function. Here is the relevent code: fit-nlsList(photosynthesis~photo(irradiance,Q,Am,LCP)|species/plant/leaf,da ta=marouane.data, + na.action=na.omit) This works, showing that the function photo works as a self-starting function. nlme(model=photosynthesis~photo(irradiance,Q,Am,LCP), + data=marouane.data,fixed=Q+Am+LCP~1, + random=Q+Am+LCP~1|species,na.action=na.omit) Error: subscript out of bounds This is what happens when I use the nlme function. I don't know what subscript out of bounds means but I assume that there is something wrong with the syntax of my code. The data frame (marouane.data) has dimensions of 1000 and 9. The first three columns give the group structure (species, plants within species, leaves within plants). species is a factor while plants is coded 1 or 2 and leaves is also coded 1 or 2. The other columns give values of measured variables. Could someone explain what I am doing wrong? Alternatively, is there another text besides Pinheiro Bates that explains the basic syntax of the nlme function? Thanks. Bill Shipley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Confidence interval for relative risk
The concrete problem is that I am refereeing a paper where a confidence interval is presented for the risk ratio and I do not find it credible. I show below my attempts to do this in R. The example is slightly changed from the authors'. I can obtain a confidence interval for the odds ratio from fisher.test of course === fisher.test example === outcome - matrix(c(500, 0, 500, 8), ncol = 2, byrow = TRUE) fisher.test(outcome) Fisher's Exact Test for Count Data data: outcome p-value = 0.00761 alternative hypothesis: true odds ratio is not equal to 1 95 percent confidence interval: 1.694792 Inf sample estimates: odds ratio Inf === end example === but in epidemiology authors often prefer to present risk ratios. Using the facility on CRAN to search the site I find packages epitools and Epi which both offer confidence intervals for the risk ratio === Epi example === library(Epi) twoby2(outcome[c(2,1),c(2,1)]) 2 by 2 table analysis: -- Outcome : Col 1 Comparing : Row 1 vs. Row 2 Col 1 Col 2P(Col 1) 95% conf. interval Row 1 8 500 0.01570.0079 0.0312 Row 2 0 500 0.0. NaN 95% conf. interval Relative Risk:Inf NaN Inf Sample Odds Ratio:Inf NaN Inf Conditional MLE Odds Ratio:Inf1.6948 Inf Probability difference: 0.01570.0027 0.0337 Exact P-value: 0.0076 Asymptotic P-value: NaN -- === end example === So Epi gives me a lower limit of NaN but the same confidence interval and p-value as fisher.test === epitools example === library(epitools) riskratio(outcome) $data Outcome Predictor Disease1 Disease2 Total Exposed1 5000 500 Exposed2 5008 508 Total10008 1008 $measure risk ratio with 95% C.I. Predictor estimate lower upper Exposed11NANA Exposed2 Inf NaN Inf $p.value two-sided Predictor midp.exact fisher.exact chi.square Exposed1 NA NA NA Exposed2 0.00404821 0.007610478 0.004843385 $correction [1] FALSE attr(,method) [1] Unconditional MLE normal approximation (Wald) CI Warning message: Chi-squared approximation may be incorrect in: chisq.test(xx, correct = correction) === end example === And epitools also gives a lower limit of NaN. === end all examples === I would prefer not to have to tell the authors of the paper I am refereeing that I think they are wrong unless I can help them with what they should have done. Is there another package I should have tried? Is there some other way of doing this? Am I doing something fundamentally wrong-headed? Michael Dewey http://www.aghmed.fsnet.co.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which genetic optimization package allows customized crossover and mutation operation
No, I am not familiar with that project, actually never heard it before your reply.:) Anyway, I found some code later on from Claudio Agostinelli who developed this code for his teaching, I think. Unfortornuitly, his code does not work on my settings. And I do not want to send much time on the object oriented programing skill in R, so finally I went back to java for this GA work. Thanks anyway. Have a nice weekend. Sun - Original Message - From: Spencer Graves [EMAIL PROTECTED] To: sun [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Thursday, November 09, 2006 3:17 AM Subject: Re: [R] Which genetic optimization package allows customized crossover and mutation operation Are you familiar with www.bioconductor.org? They have a listserve with people who may know more about the question you asked. Spencer Graves sun wrote: Hi, I am looking for genetic optimization package that allow to define my own chromosome solution and crossover/mutation opoerations. I checked genoud and genopt, not with much effort of 'cause, with no luck. Any one can shed some light on this? thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Announcement: sciplot (includes functions for graphs w/ error bars)
The package sciplot is now available for download from CRAN. This package includes a collection of functions that create graphs with error bars for data collected from one-way or higher factorial designs, as well as a function to plot bifurcation diagrams resulting from analysis with XPPAUTO. The functions in this package replicate some of the functionality of plotmeans() from the package gplots, with differences in the treatment of two-way and higher designs. Example graphs can be seen at: http://mutualism.williams.edu/sciplot -- Manuel A. Morales http://mutualism.williams.edu signature.asc Description: This is a digitally signed message part __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question about error message - or is it a bug?
Hi to all ... the same code, but another question. I changed only the type='n' to type='l' and debugged the function xy.coords. with type = 'l' : there are the correct values of x and y inside the function xy.coords but the y value is filled with NA seems that the length is matching now because of the NAs with type = 'n' : there are the wrong values of x in the function xy.coords and the y value is not filled with NA So there is a length mismatch additionally to the wrong x values Maybe anybody could evaluate whether this is an error (some kind of misunderstanding) from me or a bug Regards Carmen see codes below #--- Code --- time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='n') #-- Debugging --- debug(xy.coords) plot(times(time), y, type='l') debug: if (is.null(y)) { ylab - xlab if (is.language(x)) { if (inherits(x, formula) length(x) == 3) { ylab - deparse(x[[2]]) xlab - deparse(x[[3]]) y - eval(x[[2]], environment(x), parent.frame()) x - eval(x[[3]], environment(x), parent.frame()) } else stop(invalid first argument) } else if (inherits(x, ts)) { y - if (is.matrix(x)) x[, 1] else x x - stats::time(x) xlab - Time } else if (is.complex(x)) { y - Im(x) x - Re(x) xlab - paste(Re(, ylab, ), sep = ) ylab - paste(Im(, ylab, ), sep = ) } else if (is.matrix(x) || is.data.frame(x)) { x - data.matrix(x) if (ncol(x) == 1) { xlab - Index y - x[, 1] x - seq_along(y) } else { colnames - dimnames(x)[[2]] if (is.null(colnames)) { xlab - paste(ylab, [,1], sep = ) ylab - paste(ylab, [,2], sep = ) } else { xlab - colnames[1] ylab - colnames[2] } y - x[, 2] x - x[, 1] } } else if (is.list(x)) { xlab - paste(ylab, $x, sep = ) ylab - paste(ylab, $y, sep = ) y - x[[y]] x - x[[x]] } else { if (is.factor(x)) x - as.numeric(x) xlab - Index y - x x - seq_along(x) } } Browse[1] debug: if (inherits(x, POSIXt)) x - as.POSIXct(x) Browse[1] debug: if (length(x) != length(y)) { if (recycle) { if ((nx - length(x)) (ny - length(y))) x - rep(x, length.out = ny) else y - rep(y, length.out = nx) } else stop('x' and 'y' lengths differ) } Browse[1] x [1] 0.1006944 0.1013889 0.1020833 0.1027778 0.1034722 0.1041667 0.1048611 0.106 0.1062500 [10] 0.1069444 0.1076389 0.108 0.1090278 0.1097222 0.1104167 0.111 0.1118056 0.1125000 [19] 0.1131944 0.1138889 0.1145833 0.1152778 0.1159722 0.117 0.1173611 0.1180556 0.1187500 [28] 0.119 0.1201389 0.1208333 0.1215278 0.122 0.1229167 0.1236111 0.1243056 0.125 [37] 0.1256944 0.1263889 0.1270833 0.128 0.1284722 0.1291667 0.1298611 0.1305556 0.1312500 [46] 0.1319444 0.1326389 0.133 0.1340278 0.1347222 attr(,format) [1] h:m:s Browse[1] y [1] 0 10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [31] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Browse[1] #-- debug(xy.coords) plot(times(time), y, type='n') debug: if (length(x) != length(y)) { if (recycle) { if ((nx - length(x)) (ny - length(y))) x - rep(x, length.out = ny) else y - rep(y, length.out = nx) } else stop('x' and 'y' lengths differ) } Browse[1] debug: if (recycle) { if ((nx - length(x)) (ny - length(y))) x - rep(x, length.out = ny) else y - rep(y, length.out = nx) } else stop('x' and 'y' lengths differ) Browse[1] Fehler in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ x [1] 2 1 0 0 0 1 0 0 0 3 3 3 y [1] 0 10 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Speed Optimization: Faster Way of Accessing data.frame in a Loop?
Hello, currently I am using code, which basically works like this: | | for (i in 1:20) { | for (j in 1:30) { | df[i, j, 20] - df[i,j,27] + df[i,j,30] | } | } df is: `data.frame: 360 obs. of 30 variables' Do you have any ideas whether I could get this code any faster? Regards, Sven C. Koehler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which genetic optimization package allows customized crossover and mutation operation
On 10 November 2006 at 16:19, sun wrote: | No, I am not familiar with that project, actually never heard it before your | reply.:) | | Anyway, I found some code later on from Claudio Agostinelli who developed | this code for his teaching, I think. Unfortornuitly, his code does not work | on my settings. And I do not want to send much time on the object oriented | programing skill in R, so finally I went back to java for this GA work. FWIW I did some recent work with the 'pgapack' C++ library, but I have no R package for show for that. Also, mail to your address bounces and you are not posting with a real name. Both practices are frowned upon, so you may get fewer helpful replies than you could otherwise expect. Cheers, Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rpad
Vittorio, Those files being missing is what's causing the errors. Try recopying them to your server home location. Those files should be under Rpad/basehtml/gui/* in your R library installation. If not, try reinstalling or extract the necessary files right out of the Rpad_1.1.1.tar.gz file. - Tom Tom Short EPRI Solutions, Inc. vittorio wrote: I've just compiled and installed Rpad from the sources under *nix (freeBSD 6.1) and R 2.4.0, and followed the suggested procedure to setup an Rpad server step by step. Now when I try to execute whatever .Rpad example file the IE browser hangs endlessly with a loading page pop-up and the following errors show up at the end of the html page: .. DEBUG: DEPRECATED: dojo.xml.domUtil is deprecated, use dojo.dom instead DEBUG: DEPRECATED: dojo.xml.htmlUtil is deprecated, use dojo.html instead DEBUG: failed loading gui/src/widget/SortableTable.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/src/widget.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/src/__package__.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/src.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/__package__.js with error: [SyntaxError: Errore di sintassi] FATAL: Could not load 'dojo.widget.SortableTable'; last tried '__package__.js' Page loading...DEBUG: [object Object] ... Now the various .js files cited in the debug list of errors (by the way Errore di sintassi means Syntax error, i.e. exactly the same thing!!!) are actually missing in the ../basehtml/src/ directory. Besides, what should I do as far as dojo.xml.domUtil is deprecated is concerned? Ciao Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/-R--Rpad-tf2608079.html#a7280434 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] axis command and excel time format
You should look at ?plot.default ?times You need to supply an x vector (time) along with a y value vector of the same length. Your error message tells you that you vectors were not of equal length. You are repeatedly supplying different length vectors. times() takes a text vector and translates it into an object of class time. Try the following to see if it unscrambles things for you. You can go on to suppress axis labels, etc. by using other arguments as necessary . xrange=times(c(2:25:00,3:14:00)) yrange=c(0,10) plot(xrange,yrange,type='n') - Original Message - From: Carmen Meier [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, November 10, 2006 5:13 AM Subject: Re: [R] axis command and excel time format Carmen, Gabor has already given you the detail you ask for, but might try the following plot to see what is going wrong: plot(times(tt), x, type='l') This does not give you the EXACT control of the axis you asked for, but this simple plot command gives you a fairly nice result. It illustrates that your code is failing becasue you are plotting x against the index of x rather than plotting x against time. At least this is what I think the misunderstanding is. Thank you Robert, this is nearly what I need, but my problem is that I need an empty window with axes. I am able to build this with any data but not with the time axis. I need for a special issue only horizontal lines with different colors and arrows, which will be inserted from a function. Maybe you could explain me what's the difference between library(zoo) library(chron) time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='n') - error in xy.coords(x, y, xlabel, ylabel, log) :'x' and 'y' lengths differ - the error is only with type='n' and not with type='l' and the example without errors library(zoo) library(chron) time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='l') It is not the type='n' every other combination of data types which i tried was working with the no plot option y - c(0,10) z - c(0,10) plot(z, y, type='n') Carmen __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problems with plot and X11 in ubuntu
Davide, It looks to be an issue in the /etc/X11/xorg.conf file of Edgy. The paths to the X11 fonts are wrong, you've got to change them to the right one. I'm not in my Ubuntu box, but I think the part of the Font paths should have been /usr/share/fonts/X11 and it was /usr/share/X11/fonts in the config file. Change those occurrences in the config file, reboot and that should fix it. Just encountered that last night or early mornng I should say :-). Regards, Mon On 11/10/06, Bagatti Davide [EMAIL PROTECTED] wrote: Hello, I am an italian student, who is trying to use R 2.3.1 with Ubuntu 6.10(last version). When I try to use the plot command, I get the error: could not find any X11 fonts Check that the Font Path is correct How can I solve this problem? Thank you very much Davide [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question about error message - or is it a bug?
Carmen Meier said the following on 11/10/2006 9:46 AM: Hi to all ... the same code, but another question. I changed only the type='n' to type='l' and debugged the function xy.coords. with type = 'l' : there are the correct values of x and y inside the function xy.coords but the y value is filled with NA seems that the length is matching now because of the NAs with type = 'n' : there are the wrong values of x in the function xy.coords and the y value is not filled with NA So there is a length mismatch additionally to the wrong x values Maybe anybody could evaluate whether this is an error (some kind of misunderstanding) from me or a bug Regards Carmen see codes below Hi, Carmen The problem is not in xy.coords, but in chron:::plot.times. Why do you set y to c(0, 10)? This is not the same length as x which is why you are getting this error. Since it's not clear what type of plot you expect, it's difficult to comment further. Try: debug(chron:::plot.times) to see how your function call is being interpreted by the code. Also, in the future, please tell us where to find non-base functions such as times. Thanks, --sundar #--- Code --- time - c(2:25:00,2:26:00,2:27:00,2:28:00,2:29:00,2:30:00,2:31:00, 2:32:00,2:33:00,2:34:00,2:35:00,2:36:00,2:37:00,2:38:00, 2:39:00,2:40:00,2:41:00,2:42:00,2:43:00,2:44:00,2:45:00, 2:46:00,2:47:00,2:48:00,2:49:00,2:50:00,2:51:00,2:52:00, 2:53:00,2:54:00,2:55:00,2:56:00,2:57:00,2:58:00,2:59:00, 3:00:00,3:01:00,3:02:00,3:03:00,3:04:00,3:05:00,3:06:00, 3:07:00,3:08:00,3:09:00,3:10:00,3:11:00,3:12:00,3:13:00, 3:14:00) y - c(0,10) plot(times(time), y, type='n') #-- Debugging --- debug(xy.coords) plot(times(time), y, type='l') debug: if (is.null(y)) { ylab - xlab if (is.language(x)) { if (inherits(x, formula) length(x) == 3) { ylab - deparse(x[[2]]) xlab - deparse(x[[3]]) y - eval(x[[2]], environment(x), parent.frame()) x - eval(x[[3]], environment(x), parent.frame()) } else stop(invalid first argument) } else if (inherits(x, ts)) { y - if (is.matrix(x)) x[, 1] else x x - stats::time(x) xlab - Time } else if (is.complex(x)) { y - Im(x) x - Re(x) xlab - paste(Re(, ylab, ), sep = ) ylab - paste(Im(, ylab, ), sep = ) } else if (is.matrix(x) || is.data.frame(x)) { x - data.matrix(x) if (ncol(x) == 1) { xlab - Index y - x[, 1] x - seq_along(y) } else { colnames - dimnames(x)[[2]] if (is.null(colnames)) { xlab - paste(ylab, [,1], sep = ) ylab - paste(ylab, [,2], sep = ) } else { xlab - colnames[1] ylab - colnames[2] } y - x[, 2] x - x[, 1] } } else if (is.list(x)) { xlab - paste(ylab, $x, sep = ) ylab - paste(ylab, $y, sep = ) y - x[[y]] x - x[[x]] } else { if (is.factor(x)) x - as.numeric(x) xlab - Index y - x x - seq_along(x) } } Browse[1] debug: if (inherits(x, POSIXt)) x - as.POSIXct(x) Browse[1] debug: if (length(x) != length(y)) { if (recycle) { if ((nx - length(x)) (ny - length(y))) x - rep(x, length.out = ny) else y - rep(y, length.out = nx) } else stop('x' and 'y' lengths differ) } Browse[1] x [1] 0.1006944 0.1013889 0.1020833 0.1027778 0.1034722 0.1041667 0.1048611 0.106 0.1062500 [10] 0.1069444 0.1076389 0.108 0.1090278 0.1097222 0.1104167 0.111 0.1118056 0.1125000 [19] 0.1131944 0.1138889 0.1145833 0.1152778 0.1159722 0.117 0.1173611 0.1180556 0.1187500 [28] 0.119 0.1201389 0.1208333 0.1215278 0.122 0.1229167 0.1236111 0.1243056 0.125 [37] 0.1256944 0.1263889 0.1270833 0.128 0.1284722 0.1291667 0.1298611 0.1305556 0.1312500 [46] 0.1319444 0.1326389 0.133 0.1340278 0.1347222 attr(,format) [1] h:m:s Browse[1] y [1] 0 10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [31] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Browse[1] #-- debug(xy.coords) plot(times(time), y, type='n') debug: if (length(x) != length(y)) { if (recycle) { if ((nx - length(x)) (ny - length(y))) x - rep(x, length.out = ny) else y - rep(y, length.out = nx) } else stop('x' and 'y' lengths differ) }
Re: [R] Problems with plot and X11 in ubuntu
Change those occurrences in the config file, reboot and that should fix it. Why reboot? Rebuilding the font-cache and restart X is *largely* enough! Marco __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
On Fri, 10 Nov 2006, Jim Lemon wrote: Charilaos Skiadas wrote: Not having a background in SPSS would put these students at a disadvantage. Is this really the case? Does anyone have any such statistics? Unfortunately not statistics, but my experience in nearly every (psychology) research unit in which I have worked is that my colleagues initially expected me to use SPSS and reeled back in horror if I said that I preferred something else. They took anywhere from weeks to forever to realize that they were getting at least as good, and in many cases better, analyses of their data. [spacing added] For many people, statistical software is a belief, not an understanding. Another candidate for 'fortunes'? [...] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problems with plot and X11 in ubuntu
That is, of course, an option. I didn't know his level of familiarity with those things so I answered his question simply. Regards, Mon On 11/10/06, Scionforbai [EMAIL PROTECTED] wrote: Change those occurrences in the config file, reboot and that should fix it. Why reboot? Rebuilding the font-cache and restart X is *largely* enough! Marco [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simplifying Sweave graphics
On Fri, 10 Nov 2006, ONKELINX, Thierry wrote: Dear all, I was wondering if it's possible to simplify graphs created with Sweave. I'm using in a document several plots with each about 4000 points (qqnorm(rnorm(4000))). It looks likes the information of each points is maintained in the graph. As a result of that the pdf filesize get's quite large (about 4,2 MB for a 23 page document.) Is there a way to reduce the complexity of these graphs? Like creating the graphs in a bitmap format instead of a vector format? Reducing the 'bulkiness' of scatterplots was discussed in this thread: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/42111.html where techniques for removing overlapping points and alternatives to the simple scatterplot were discussed. [...] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with as.data.frame when an extra attribute is present
Prof Brian Ripley wrote: It's quite intentional, as it is the documented behaviour of data.frame: Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by 'I' will be recycled a whole number of times if necessary. data.frame(a = structure(1, label=foo), b = c(2, 3)) Error in data.frame(a = structure(1, label = foo), b = c(2, 3)) : arguments imply differing number of rows: 1, 2 It is safe to replicate a vector without any attributes, but not safe to replicate this 'a': you will have to do it yourself if you know it is safe. How is anyone to know you meant 'label' to apply to the whole vector and not the single element of the vector (if you did)? Thanks Brian for clarifying that. Is there a way to use a specially written as.data.frame.labelled function to do this? I assume there is no way to use I() here. Frank On Thu, 9 Nov 2006, Frank E Harrell Jr wrote: I have a problem when one of the vectors in a list needs to be replicated to have the appropriate length, and an attribute is present. w - list(a=1, b=2:3) as.data.frame(w) a b 1 1 2 2 1 3 attr(w$a,'label') - 'foo' as.data.frame(w) Error in data.frame(a = 1, b = c(2, 3), check.names = TRUE) : arguments imply differing number of rows: 1, 2 I usually use the Hmisc label function to make a variable of class 'labelled' and define as.data.frame.labelled as as.data.frame.vector, but that also fails here. Any help appreciated. -Frank sessionInfo() R version 2.2.1, 2005-12-20, i486-pc-linux-gnu [also fails in 2.4.0] attached base packages: [1] methods stats graphics grDevices utils datasets [7] base -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rpad
Tom, I've just downloaded Rpad_1.1.1.tar.gz file from CRAN and I can assure you that those files are ** ALL** missing in it . Ciao Vittorio Alle 16:35, venerdì 10 novembre 2006, tshort ha scritto: Vittorio, Those files being missing is what's causing the errors. Try recopying them to your server home location. Those files should be under Rpad/basehtml/gui/* in your R library installation. If not, try reinstalling or extract the necessary files right out of the Rpad_1.1.1.tar.gz file. - Tom Tom Short EPRI Solutions, Inc. vittorio wrote: I've just compiled and installed Rpad from the sources under *nix (freeBSD 6.1) and R 2.4.0, and followed the suggested procedure to setup an Rpad server step by step. Now when I try to execute whatever .Rpad example file the IE browser hangs endlessly with a loading page pop-up and the following errors show up at the end of the html page: .. DEBUG: DEPRECATED: dojo.xml.domUtil is deprecated, use dojo.dom instead DEBUG: DEPRECATED: dojo.xml.htmlUtil is deprecated, use dojo.html instead DEBUG: failed loading gui/src/widget/SortableTable.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/src/widget.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/src/__package__.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/src.js with error: [SyntaxError: Errore di sintassi] DEBUG: failed loading gui/__package__.js with error: [SyntaxError: Errore di sintassi] FATAL: Could not load 'dojo.widget.SortableTable'; last tried '__package__.js' Page loading...DEBUG: [object Object] ... Now the various .js files cited in the debug list of errors (by the way Errore di sintassi means Syntax error, i.e. exactly the same thing!!!) are actually missing in the ../basehtml/src/ directory. Besides, what should I do as far as dojo.xml.domUtil is deprecated is concerned? Ciao Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
On Wed, Nov 08, 2006 at 09:24:38PM -0500, Charilaos Skiadas wrote: Hi Charilaos, I would particularly like to hear from people who were not hard-core programmers before taking up R, so perhaps had originally some difficulties with it. How hard was it, and how quickly did it start paying off? Our main stumbling block I feel would be to get our colleagues to switch to using R, at least for their teaching, and most of them would probably have never really seen a programming language before. I am an economics graduate student at Princeton. I have used R before coming here, but I noticed that many of my classmates started using R in graduate school. I think this happened because they observed a few of our professors (eg Christopher Sims) using R not only for statistics, but for more general programming tasks (solving dynamic programming problems, perturbation methods, etc). The main advantage of R for me is that besides having amazing libraries, it is a very nice general language to program in for any kind of numerical calculations. Once you program your own algorithms (eg in Bayesian statistics, solving functional equations, etc) the need for a general programming language becomes apparent. My impression is that R is very popular among Bayesians (see textbooks An Introduction to Modern Bayesian Econometrics by Tony Lancaster and Bayesian Data Analysis, Second Edition by Andrew Gelman, John B. Carlin, Hal S. Stern, and Donald B. Rubin, both use R), and is slowly gaining acceptance among finance people and macroeconomists (packages for former are showing up on CRAN). I never had professors discouraging me from R, except once when a professor warned me that anything except STATA will choke on huge cross-sectional datasets (but he turned out to be wrong, R works find with SQL databases for that purpose). I think that the best way to persuade your colleagues to switch to R is by example. Demonstrate that while other languages are OK if you are using standard canned methods, programming something new and innovative is best done in R, and it is a pain in many widely used languages (STATA comes to my mind, but I may not know it well enough). Don't push R, because if they try it and get frustrated, they might abandon it for good. Just make them curious enough so that they will try it because of the amazing things you can do in R. HTH, Tamas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
As a student, I'll throw my two cents into this discussion. To preface my opinion, I am in a Joint Ph.D. program in Quantitative Psychology and Computer Science; I have a significant programming background and use R (or custom-built software that relies on R in some way) for the majority of my analyses. In our psychology department, the stats courses are taught with a variety of statistical packages (SPSS, SAS, R, HLM, Mplus, Mx, etc.) with the hope of exposing students to a wide range of software. Professors in the department use an even wider range of packages for their own analyses. The truth of the matter is that you'll never be able to prepare students for every software package that they might have to use someday in the future. With that said, you can prepare your students to be able to learn these possible software packages in an efficient and timely manner by providing them with a firm background in statistics and giving them the basics of learning how to learn (not a typo) a new package, as not all social science students have a computer science background. In this way, I personally believe R is currently the best choice to start students with. If students learn the basics of R, they're learning the basics of programming in a language similar to other non-statistical programming languages (for me, this alone is reason enough). Students will need to understand variables, functions, arguments, data types, data structures, loops, conditionals, etc. And if R is taught in a way that forces students to use the help function every once and a while and not have everything handed to them, they'll learn how to learn (again, not a typo) to use other packages (which may be another conversation entirely). Learning to use, read, and understand documentation is an under-taught and underestimated skill. Also, if students really understand the statistics and can use R, they should be able to use the point and click packages with ease (that's why people use packages like SPSS). And if it is really such a concern that students have names like SPSS on their CVs, then why not spend one lab at the end of the semester running through a list of analyses previously done in R in SPSS. The reverse would be much more difficult if you plan to ensure comprehension. I leave out all of the other reasons I'd choose R, because they've either been commented on or should be obvious (free, open-source, great community, grid-able, etc.) but one more thing Charilaos asked: I suppose one of the concerns in our case is whether people might be locked out so to speak in terms of being able to submit to certain journals or work with people who use one of these packages instead. Have any of you had any problems in that direction? As an academic, statistician, and computer scientist, I will be horrified to find out that a journal would lock out a paper because of the software used to garner results (unless it was something like the Journal of Point and Click Statistics). In the majority of social science analyses, I would think it unnecessary for people to mention the software used in the first place--it's the analyses and their details that should matter. With that said, my lack of experience in a wide range of published journals may be showing through. Regards, Jeff. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making a case for using R in Academia
I am just joining this thread. Regarding a tendency of journals to lock out the use of particular packages, there are rumours that SAS proc mixed has to be used for particular things. I wonder if whether R might displace SAS or proc mixed in such a role could depend on wether there the QA provided by the R contributed-packages system is felt to be as reliable as QA provided by something like SAS Institute. Farrar Jeffrey Robert Spies [EMAIL PROTECTED] wrote: As a student, I'll throw my two cents into this discussion. To preface my opinion, I am in a Joint Ph.D. program in Quantitative Psychology and Computer Science; I have a significant programming background and use R (or custom-built software that relies on R in some way) for the majority of my analyses. In our psychology department, the stats courses are taught with a variety of statistical packages (SPSS, SAS, R, HLM, Mplus, Mx, etc.) with the hope of exposing students to a wide range of software. Professors in the department use an even wider range of packages for their own analyses. The truth of the matter is that you'll never be able to prepare students for every software package that they might have to use someday in the future. With that said, you can prepare your students to be able to learn these possible software packages in an efficient and timely manner by providing them with a firm background in statistics and giving them the basics of learning how to learn (not a typo) a new package, as not all social science students have a computer science background. In this way, I personally believe R is currently the best choice to start students with. If students learn the basics of R, they're learning the basics of programming in a language similar to other non-statistical programming languages (for me, this alone is reason enough). Students will need to understand variables, functions, arguments, data types, data structures, loops, conditionals, etc. And if R is taught in a way that forces students to use the help function every once and a while and not have everything handed to them, they'll learn how to learn (again, not a typo) to use other packages (which may be another conversation entirely). Learning to use, read, and understand documentation is an under-taught and underestimated skill. Also, if students really understand the statistics and can use R, they should be able to use the point and click packages with ease (that's why people use packages like SPSS). And if it is really such a concern that students have names like SPSS on their CVs, then why not spend one lab at the end of the semester running through a list of analyses previously done in R in SPSS. The reverse would be much more difficult if you plan to ensure comprehension. I leave out all of the other reasons I'd choose R, because they've either been commented on or should be obvious (free, open-source, great community, grid-able, etc.) but one more thing Charilaos asked: I suppose one of the concerns in our case is whether people might be locked out so to speak in terms of being able to submit to certain journals or work with people who use one of these packages instead. Have any of you had any problems in that direction? As an academic, statistician, and computer scientist, I will be horrified to find out that a journal would lock out a paper because of the software used to garner results (unless it was something like the Journal of Point and Click Statistics). In the majority of social science analyses, I would think it unnecessary for people to mention the software used in the first place--it's the analyses and their details that should matter. With that said, my lack of experience in a wide range of published journals may be showing through. Regards, Jeff. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Variable limit in nlm?
Admittedly I am using an old version 1.7.1, but can anyone tell if this is or was a problem. I can only get nlm (nonlinear minimization) to adjust the first three components of function variable. No gradient or hessian is supplied. E.G.; fnoise function(y) { y[5]/(y[4]*sp2) * exp(-((x[,3]-y[1]-y[2]*x[,1]-y[3] *x[,2])/y[4])^2/2) + (1-y[5])/(y[9]*sp2) * exp(-((x[,3]-y[6]-y[7]*x[,1]-y[8] *x[,2])/y[9])^2/2) } nlm(sum(-log(fnoise(y))),c(5,1,1,10,.75,1,.2,.2,6),hessian=TRUE,print.level=2)) Thanks, Bob __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Meta-regression with lmer() ? If so, how ?
Wolfgang Vietchbauer wrote : The dependent variable to be used with the mima function can be any measure for which we have a known sampling variance (or approximately so) and that is (approximately) normally distributed. So, the dependent variable could be log odds ratios, log risk ratios, standardized mean differences, and so on. Are you looking for the option to input the results from each study arm individually? Yes : this might help when there is more than one effect to assess (e. g. comparison of three (or more) treatment option in a medical situation. You might have to assess medical treatment vs interventional treatment vs surgery, or surgery vs radiotherapy vs chemotherapy vs watchful waiting : all those are real-life examples...). In those cases, you are interested in more than one main effect : A vs B, A vs C, B vs C, etc... In fact, you are in an ANOVA-like situation. (e.g., the log odds for a control and a treatment group). You could also use mima then (with an appropriately coded moderator). Agreed. However, it would then make more sense to assume a common (but random) intercept for all the arms from a single study. Yes. And that's exactly why I thought lmer() might be helpful. At this point, the function isn't set up that way, but I think I could rewrite it to do that. That could be an option, or the job of a wrapper function (more on this later...). - as far as I can tell, mima allows to asses the effect of variables *nesting* studies, but not of variables *crossed* in each study ; therefore, ypou cannot directly test the effect of such variables ; I am not sure if I understand this point. I think this may relate to the fact that (if I understand it correctly), you want to input the results from each arm separately. Not exactly. What I have in mind is that nesting and crossed variables have different status and that their effects should be assessed differently. Let's have a real-life exeample : meta-analysis of clinical trials where the intervention is applied to a disease with two slightly different clinical presentations, all (or at least most of) the trials accruing patients with those two forms and reporting results according to the subgroups so defined. Furthermore, some of these trials might use a difficult blinded assessment of the results, while the rest might use unblinded assessment. There, you have two different moderator variables : - The clinical presentation is known, not controlled, but present in every trial : its (fixed) effect can be assessed in each of the trials ; its impact on the outcome is assessable on each trial (that's why I mean when I say it is cropssed witjh treatment) ; its interaction with the treatment factor is of great medical interest and is also assessable ; - The design factor, on the other hand, is partially counfounded with inter-study variations (the design variable nests the study variable) ; its (conceptually fixed) effect on the outcome is confounded with the (random) inter-study variability of said outcome (that's the bias of outcome assessment due to non-blinding) ; its interaction with the treatment effect is also of interest (bias in treatment effect estimation due to non-blinding), but much more difficult to assess. I don't see how to specify this with mima(). You can also test for blocks of moderators with the mima function. Let's say you have two dummy variables that are coded to indicate differences between three groups (e.g., low, medium, and high quality studies). Now you want to test if quality makes at all a difference (as opposed to testing the two dummy variables individually). Use the out=yes option and then do the following: 1. from $b, take the (2x1) subset of the parameter estimates corresponding to the two dummy variables; denote this vector with b.sub 2. from $vb, take the (2x2) subset from the variance-covariance matrix corresponding to the two dummy variables (i.e., their variances and the covariance); denote this vector with vb.sub 3. then t(b.sub) %*% solve(vb.sub) %*% b.sub is approximately chi-square distributed under H0 with 2 degrees of freedom. This I know, but I'd like to see it automated in a more standard way (see below...). I am also going to add to the function the option to output the log likelihood value. Then likelihood ratio tests are a snap to do with full versus reduced models. But for now, the above should work. That's would be *really* useful. IMHO, model comparison (therefore selection) *is* the point of statistical testing. Furthermore, it smooths out the technicalities entailed by the nature of the tested variable (boolean, nominal, ordered or numeric). However, I think that the right way to do this would be to have a function accepting the quasi-standard formula notation used in lm,
Re: [R] lattice: histogram of factor variable
On 11/10/06, Albrecht, Dr. Stefan (AZ Private Equity Partner) [EMAIL PROTECTED] wrote: Dear all, I am encountering a problem with lattice in the current version 0.14-13 with R version 2.4.0 on a Windows XP system. For example, histogram(~voice.part, singer) is not labeling the x labels according to the factor levels of voice.part, which it should do (and has done in former versions of lattice, as far as I remember). I will fix that, but you shouldn't really be using histograms for factors. Use barchart instead, e.g. barchart(table(voice.part) ~ levels(voice.part), singer, origin = 0) -Deepayan In addition, I get the warnings Warning messages: 1: arguments 'include.lowest', 'right' are not made use of in: hist.default(x, breaks = breaks, plot = FALSE, include.lowest = include.lowest, 2: arguments 'include.lowest', 'right' are not made use of in: hist.default(x, breaks = breaks, plot = FALSE, include.lowest = include.lowest, which are a bit annoying, but (hopefully) not a real problem. Does anybody have a simple help (for the x labels)? Many thanks and best regards, Stefan Dr. Stefan Albrecht, CFA Allianz Private Equity Partners GmbH Giselastr. 4 | 80802 Munich | Germany Phone: +49.(0)89.3800.18317 Fax: +49.(0)89.3800.818317 EMail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Web: www.apep.com http://www.apep.com/ Please note my new email address: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://www.stat.wisc.edu/~deepayan/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] history in Mac
Hi, my history in Mac for R does not work. I found the solution is GNU readline and re-installation from source. is there any other way to solve this? i really do not want to re-install: which means I need to install many packages, blabla... i used to use JGR (which solved that problem) but found sooo many bugs with it... -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Selective subsetting
Hi all, Here's an interesting (for me, at least!) problem I came across: I have a correlation matrix, let's say with 6 variables, A to F, as column headings and the same 6 as row headings. The matrix is filled with correlation coefficients. Therefore, the diagonal is all 1's, and each of the two triangles formed by the diagonal has the same 15 correlation coefficients. I need to extract these 15 coefficients from this. I don't want the 1's and I don't want redundant values. I tried converting the matrix to a list, using c(m) and then I'm stuck. Does something like b = a[x, x+1:n] exist in R? SAS will do it. x can be looped to go from 1 to n (n here is 6, of course) and it will select the required values, but I cannot make it work. Please help. Many thanks, -DS. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Position as professor of statistics availabe
Dear R community, The Department of Statistics, Umeå University, Sweden, is searching for a Professor of Statistics (deadline December 7, 2006). We would appreciate applications from people on this list! More information is available at http://www.stat.umu.se/index_eng.shtml Welcome with your application! Göran -- Göran Broström Head, Department of Statistics Umeå University, Umeå, Sweden __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Selective subsetting
A=matrix(1:9,3) A[lower.tri(A)] b On Nov 10, 2006, at 4:50 PM, Davendra Sohal wrote: Hi all, Here's an interesting (for me, at least!) problem I came across: I have a correlation matrix, let's say with 6 variables, A to F, as column headings and the same 6 as row headings. The matrix is filled with correlation coefficients. Therefore, the diagonal is all 1's, and each of the two triangles formed by the diagonal has the same 15 correlation coefficients. I need to extract these 15 coefficients from this. I don't want the 1's and I don't want redundant values. I tried converting the matrix to a list, using c(m) and then I'm stuck. Does something like b = a[x, x+1:n] exist in R? SAS will do it. x can be looped to go from 1 to n (n here is 6, of course) and it will select the required values, but I cannot make it work. Please help. Many thanks, -DS. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Selective subsetting
try this: cor.mat - cor(iris[1:4]) cor.mat[lower.tri(cor.mat)] I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting Davendra Sohal [EMAIL PROTECTED]: Hi all, Here's an interesting (for me, at least!) problem I came across: I have a correlation matrix, let's say with 6 variables, A to F, as column headings and the same 6 as row headings. The matrix is filled with correlation coefficients. Therefore, the diagonal is all 1's, and each of the two triangles formed by the diagonal has the same 15 correlation coefficients. I need to extract these 15 coefficients from this. I don't want the 1's and I don't want redundant values. I tried converting the matrix to a list, using c(m) and then I'm stuck. Does something like b = a[x, x+1:n] exist in R? SAS will do it. x can be looped to go from 1 to n (n here is 6, of course) and it will select the required values, but I cannot make it work. Please help. Many thanks, -DS. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Selective subsetting
Look at the functions tril() and triu() in the Matrix package Regards Francisco Davendra Sohal wrote: Hi all, Here's an interesting (for me, at least!) problem I came across: I have a correlation matrix, let's say with 6 variables, A to F, as column headings and the same 6 as row headings. The matrix is filled with correlation coefficients. Therefore, the diagonal is all 1's, and each of the two triangles formed by the diagonal has the same 15 correlation coefficients. I need to extract these 15 coefficients from this. I don't want the 1's and I don't want redundant values. I tried converting the matrix to a list, using c(m) and then I'm stuck. Does something like b = a[x, x+1:n] exist in R? SAS will do it. x can be looped to go from 1 to n (n here is 6, of course) and it will select the required values, but I cannot make it work. Please help. Many thanks, -DS. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dr. Francisco J. Zagmutt College of Veterinary Medicine and Biomedical Sciences Colorado State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] count data with nested mixed effects
Dear R-Pros, I have count data in which 6-10 points are nested within 17 larger units (which are nested within 3 larger-still units) plus a number of covariates. It could be nested ANCOVA but for poisson family. Could someone kindly advise me 1) if lmer is the correct function for the analysis? and 2) what synax expresses the error structure? I have consulted the package HTML documentation but am not experienced enough to get it. Many thanks, Deborah __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] count data with nested mixed effects
Hi Deborah, A very good source for hands-on information on mixed models in S is: Mixed-effects models in S and S-PLUS by Pinheiro and Bates Incidentally, it's available in your university's library http://toroprod.library.utoronto.ca/uhtbin/cgisirsi/2XfWcMI0Ns/ROBARTS/140640080/2/1000 I believe the book does not explicitly cover the lme4 package (lmer is part if this package) but the principles can be easily applied to your needs. Regards, Francisco [EMAIL PROTECTED] wrote: Dear R-Pros, I have count data in which 6-10 points are nested within 17 larger units (which are nested within 3 larger-still units) plus a number of covariates. It could be nested ANCOVA but for poisson family. Could someone kindly advise me 1) if lmer is the correct function for the analysis? and 2) what synax expresses the error structure? I have consulted the package HTML documentation but am not experienced enough to get it. Many thanks, Deborah __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dr. Francisco J. Zagmutt College of Veterinary Medicine and Biomedical Sciences Colorado State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] missing symbols for mathplot
Try this: plot(0, main = quote(P(X ~ | ~ A ~ intersect(B On 11/10/06, stortignauz [EMAIL PROTECTED] wrote: Hi all, I'm trying to write an axis label that sounds P( X | K and Xb ) (probability of X given K and Xb ) but I need the intersection symbol (the \cap in latex) Actually I did'nt find any cap symbol in plotmath, the only one is intersect(A[i],i==1,n) but is not my case because subscripts and arguments are mandatory. Anyone knows how to do? Thanks Andrea -- View this message in context: http://www.nabble.com/missing-symbols-for-mathplot-tf2607328.html#a7275849 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] predict.lda is missing ?
I'm trying to classify some observations using lda and I'm getting a strange error. I loaded the MASS package and created a model like so: train - mod1[mod1$rand 1.7,] classify - mod1[mod1$rand = 1.7,] lda_res - lda(over_win ~ t1_scrd_a + t1_alwd_a, data=train, CV=TRUE) That works, and all is well until I try to do a prediction for the holdouts: lda_pred - predict(lda_res, classify)$class Error in predict(lda_res, classify) : no applicable method for predict If I try predict.lda specifically I get lda_pred - predict.lda(lda_res, classify)$class Error: could not find function predict.lda predict.lda Error: object predict.lda not found but i can get help for it by typing help(predict.lda), which says it's in the MASS package. If somebody could point out what I'm doing wrong I'd be grateful. thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] predict.lda is missing ?
i think you should use lda_res - lda(over_win ~ t1_scrd_a + t1_alwd_a, data=train, CV=F) loo should be disabled for predicting purpose. On 11/10/06, Larry White [EMAIL PROTECTED] wrote: I'm trying to classify some observations using lda and I'm getting a strange error. I loaded the MASS package and created a model like so: train - mod1[mod1$rand 1.7,] classify - mod1[mod1$rand = 1.7,] lda_res - lda(over_win ~ t1_scrd_a + t1_alwd_a, data=train, CV=TRUE) That works, and all is well until I try to do a prediction for the holdouts: lda_pred - predict(lda_res, classify)$class Error in predict(lda_res, classify) : no applicable method for predict If I try predict.lda specifically I get lda_pred - predict.lda(lda_res, classify)$class Error: could not find function predict.lda predict.lda Error: object predict.lda not found but i can get help for it by typing help(predict.lda), which says it's in the MASS package. If somebody could point out what I'm doing wrong I'd be grateful. thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Speed Optimization: Faster Way of Accessing data.frame in a Loop?
I don't see how this code can work at all. '[-.data.frame' does not accept three arguments, e.g. women[1,2,3] - 17 Error in `[-.data.frame`(`*tmp*`, 1, 2, 3, value = 17) : unused argument(s) (3) If df is in fact a three-dimensional array you can do df[1:20, 1:30, 20] - df[1:20, 1:30, 27] + df[1:20, 1:30, 30] BTW, df is the pdf of the F distribution in R, so not a good choice for a variable name. On Fri, 10 Nov 2006, Sven C. Koehler wrote: Hello, currently I am using code, which basically works like this: | | for (i in 1:20) { | for (j in 1:30) { | df[i, j, 20] - df[i,j,27] + df[i,j,30] | } | } df is: `data.frame: 360 obs. of 30 variables' Do you have any ideas whether I could get this code any faster? Regards, Sven C. Koehler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with as.data.frame when an extra attribute is present
On Fri, 10 Nov 2006, Frank E Harrell Jr wrote: Prof Brian Ripley wrote: It's quite intentional, as it is the documented behaviour of data.frame: Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by 'I' will be recycled a whole number of times if necessary. data.frame(a = structure(1, label=foo), b = c(2, 3)) Error in data.frame(a = structure(1, label = foo), b = c(2, 3)) : arguments imply differing number of rows: 1, 2 It is safe to replicate a vector without any attributes, but not safe to replicate this 'a': you will have to do it yourself if you know it is safe. How is anyone to know you meant 'label' to apply to the whole vector and not the single element of the vector (if you did)? Thanks Brian for clarifying that. Is there a way to use a specially written as.data.frame.labelled function to do this? I assume there is no way to use I() here. No, as the replication is done in data.frame after calling as.data.frame on each list component (and it has to be that way as there is no way to predict how many rows as.data.frame will return). I() is only relevant for character vectors of class AsIs (and not even for classes inheriting from AsIs). I toyed with the idea that we could try to make use of a rep() method here, but that could fall back to the default method and I don't see how to avoid letting unsafe cases through. Frank On Thu, 9 Nov 2006, Frank E Harrell Jr wrote: I have a problem when one of the vectors in a list needs to be replicated to have the appropriate length, and an attribute is present. w - list(a=1, b=2:3) as.data.frame(w) a b 1 1 2 2 1 3 attr(w$a,'label') - 'foo' as.data.frame(w) Error in data.frame(a = 1, b = c(2, 3), check.names = TRUE) : arguments imply differing number of rows: 1, 2 I usually use the Hmisc label function to make a variable of class 'labelled' and define as.data.frame.labelled as as.data.frame.vector, but that also fails here. Any help appreciated. -Frank sessionInfo() R version 2.2.1, 2005-12-20, i486-pc-linux-gnu [also fails in 2.4.0] attached base packages: [1] methods stats graphics grDevices utils datasets [7] base -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.