RE:RE: [R] Protocol for answering basic questions
How will I delete the reply without reading first unless I delete all replies? I've made it quite clear that some replies are useful, but some are unhelpful. I and other would like to see an improvement in r help; to just say take it or leave it, as many infer, is conceptually naive. I joined the community because I want technical assistance and I don't question the technical skills of many of the respondants, but the wider appreciation of needs of users i.e conceptual naivety. It's clear from this string that many beginners are leaving the forum and this should be a cause for concern if we are seriously concerned with propogating knowledge. Unfortuantely this string does seem to indicate this is not a major concern and so be it. -Original Message- From: Marwan Khawaja [mailto:[EMAIL PROTECTED] Sent: 01 December 2004 20:41 To: Robert Brown FM CEFAS; [EMAIL PROTECTED] Subject: RE: [R] Protocol for answering basic questions Well, if you do not like the way some people answer queries, why not just delete the reply without reading the response. Since we're not paying anyone for answering questions, we should be grateful to those who put their time in replying to our basic questions. And why join this community? -- if you think most are 'conceptually naïve'! Marwan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Brown FM CEFAS Sent: Wednesday, December 01, 2004 6:46 PM To: [EMAIL PROTECTED] Subject: [R] Protocol for answering basic questions I have been following the discussions on 'Reasons not to answer very basic questions in a straightforward way' with interest as someone who is also new to R and has had similar experiences. As such it with sadness that I note that most seem to agree with the present approach to the responses to basic questions. I must thank those respondants to my own questions who have been helpful, but there are some whose replies are in my opinion not only unhelpful but actually rude. Indeed I've now started using Splus instead of R so as to have access to a 'proper' support service. Indeed, the main thing I've learned from R is a new respect for the values of commercial software and a scepticism regarding free software. In the end my experience of r help is that you get what you pay for. Many of the so called socratic responses (in this list and the wider academic community) can be seen as simply way to avoid additional work of a complete reply. Experienced R users don't seem to understand how difficult the program can be to new users. Responding that the questioner should read the 'Introduction to R' or a similar document is like answering a question for directions to one's house with 'Buy a map'. Most likely both such questioners have already tried that and are asking because that approach failed. R is a language and like all languages it is simple to those that understand it and complex to those who do not. Every schoolboy in Spain speaks Spanish, but I know from experience that for most English people it is very difficult to learn Spanish and take years of study. If I'm asked a question from a novice of a language (be it Spanish or R) do I reply 'consult the dictionary'. I would hope not! I can tell repondants that whilst many of my basic questions may seem simple it is not for lack of studying the very sources they refer to. If only learning was so simple. I suspect that the same is true of most question! ers. I speak as someone with a PhD and many years as a researcher in my speciality as well as someone close to completing a masters in statistics with distinction. As such I am not a total novice and would suggest that if I'm having problems so are many; and it is not a result of lack of study as so many responses seem to suggest. Indeed it is revealing that several responses suggest that they want to discourage questions so they don't overwhelm r-help. Understandable but not a recipe to encourage the use of R by other than experts. The R community needs to decide of they really only want expert statisticians users and make this clear if it is the case. Alternatively if they are to encourage novices the present approach is not the way to do it. I can appreciate that many of the respondants are busy, but if that is the case it would be better if they didn't reply at all. I was taught many years ago that if you can't say anything nice/useful then to say nothing at all. Something similar could well be applied to this list. I must say that some respondants are very helpful; and I thank them. Leave these simple questions to such people. Indeed it seems surprising that some exteremely experienced R users choose to reply to these basic messages at all; and it seem it is mostly these people who are rude. I would have thought it might be better for them to
Re: [R] core dump during make check when building 64-bit R on Solaris8/9
CHAN Chee Seng [EMAIL PROTECTED] writes: Can you write/send me the standalone program to show the problem so I can send to some Sun people that I know? Not at this point, I was hoping you had the time. BTW, how did you run R under dbx? (Sorry but I am not familiar with using dbx.) I get this error: R -d dbx then run, etc... -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Combined variable names
Richard == Richard A O'Keefe [EMAIL PROTECTED] on Fri, 3 Dec 2004 14:53:04 +1300 (NZDT) writes: Richard I wrote about the perennial assign to V1 ... Vn problem: What I want to know is *WHY* people are doing this? Richard I failed to make myself clear. Richard What I meant was what happens NEXT? Once someone Richard has got past the stage of generating V1 ... V100 Richard (or whatever the magic number is), what do they Richard intend to DO with them? Richard I think this is the important question, and I think Richard that this is what the FAQ needs to give help with, Richard and once I understand what people are trying to Richard accomplish *overall* I will be happy to offer some Richard text for the FAQ. that would be very useful, thank you in advance. Richard I've used stats packages myself that let you Richard abbreviate a range of variables. The thing is that Richard this was supported by *analysis* methods (and Richard output methods), not just *input* methods. Now it Richard seems to me that pretty much everything I would Richard want to do with a bunch of separate variables like Richard this in such a package would mean in R that I Richard desperately wanted these things to be columns in a Richard data frame. or--more generally--named list components. -- important, e.g., when the v_j's have differing lengths. Richard Perhaps the next time someone asks this question we Richard can ask them what they intend to do with the Richard variables once they have them. On past history, we Richard shan't have to wait very long. good idea (and it may well have been implemented occasionaly in the past). Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A somewhat off the line question to a log normal distrib
(Ted Harding) wrote: Not quite sure of your point here, Thomas. I certainly wasn't writing on the basis that the boss had claimed that they were either independent or identically disitributed, and the paragraph you quote was in reposnse to: The aformentioned daily measurements follow a log-normal distribution when considered over the course of a year. Okay. He also tried to explain me that the monthly means (based on the daily measurements) must follow a log-normal distribution too then over the course of a year. which I interpreted as arguing that if daily data log-normal, then monthly means must consequently be log-normal, i.e. that the mean of log-normals is log-normal; and I was simply pointing out that this is a false implication (which would be the case even if the data are neither independent nor identically distributed, except in the extreme case where they are all copies of the one log-normal variable). Granted I later used i.i.d log-normals as examples; but then pointed out that the mean of log-normals could remain sufficiently skew that a log-normal could still be a useful distribution to adopt. Hello: Let me cut short it. The variables in questions are aerosol optical depth measurements (go to the NASA 'AERONET' site if you want to learn more about it). It is likely that not everybody knows what it is meant by it; but one can think on temperature measurements for a good proxy, though not directly related to my variables. My data base was not based on a single observing station; I have used 50 stations for my evaluation. The stations were located in Europe. Although, the data base was rather scattered because some stations didn't observe every day and every month, even. But thanks again for the useful tips (especially the link to the CLT). It is rather this: my paper had been rejected. But we know: we will struggle as long as the paper will eventually get accepted ( I have a colleague and friend with a good name at NASA who daily motivates me not to give up). There were other reasons too but one complaint from a reviewer actually was that there exists a paper that aerosol optical depths are rather skewed to the left. My argument actually was that my averaging removed quite a lot of outliers. Okay, honestly speaking: at that time I didn't know about the CLT. I recalculated the matter, based on a log normal distribution, and it turned out that after transforming the variables to a log-normal distribution the median and mean become similar and comparable to my heavy averaged former means. Surely, there is one difference to my former averaging: the 3. quantile and the maximum value is larger due to the log-normal distribution. Regards, Siegfried Gonzi __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help : the datail of Fortran subroutine that use in R
How can I see the datail of Fortran subroutine that use in R. for example I want to see detail of emn routine that wrote in Fortran. .Fortran(emn, s$d, old, start, tobs, s$p, s$psi, s$n, s$x, s$npatt, s$r, s$mdpst, s$nmdp, tmp, tmp, numeric(s$p), mle, tau, m, mu0, lambdainv)[[3]] it was in em.norm in norm package. With regards Sepideh Shokohi __ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] arima and optim error
Hi, I'm using the arima function in R to deal with timeseries data, accessing it from an external Java application. The connection to Java though, is not my problem. The problem is that often the arima function does not return a value, but instead throws the error: Error in optim ... initial value is not finite I've searched the net and help listings for a while now, and all I can find is that if the parameters for the ARIMA model are set wrong, then the function cannot create a stable model :-( Does this mean that I have to know beforehand which parameters I need for the model?!! I thought the whole idea was to create a model, see how it behaves, and THEN adapt the parameters. (I know that I can use AutoCorrelation and such to figure out more about the parameters, but anyway.) Thanks Johan Hedlund [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] multinomial probit
Hello All, I'm trying to run a multinomial probit on a dataset with 28 data points and five levels (0,1,2,3,4) in the latent choice involving response variable. I downloaded the latest mnp package to run the regression. It starts the calculation and then crashes the rpogram. I wish I could give the error message but it literally shuts down R without a warning. I'm using the R that's been ported to OS X. Is it possible that there are RAM restrictions and that when something computationally heavy goes through the program is cut off? As well, is there actually a probit method for polr from nnet package? All help appreciated as masters thesis topics are due soon. Charlie Sprenger UCL - student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] information
I would like to know if there exist any package on the profyle analysis, or on repeated measures, (AUC)... Thank for answering me, Anna Maria Paganoni Dipartimento di Matematica Politecnico di Milano piazza Leonardo da Vinci, 32 20133 Milano, Italy tel +39-0223994574 fax +39-0223994568 e-mail [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] organising the display in Trellis plots
Hallo, I would like to organise at my pleasure the layout of a trellis plot. Currently I have a 3x3 matrix display and 7 plots. Is it possible to choose which specific panels will stay empty? I tried index.perm to arrange the order. Then there is perm.cond which I could not understand if it can serve for my purpose since I cant really find which kind of data it accepts. Thank you for the help. Marco P.S. I attach some code. plot - Dotplot(algo~Cbind(y,lower,upper) | group,data=OUT, pch=3, method=bars,pch.bar=2,lwd=3, cex=0.8, par.strip.text=list(cex=1), panel=function(x,y,...) { print(attr(x,'other')) panel.abline(v=attr(x,'other'),lty=2,col=grey70) panel.Dotplot(x,y,...) }, scales = list(cex=1,rot=c(0,45), x=list(alternating=c(1,1,1,1),limits=c(1,nlevels(OUT$algo)),relation=same), y=list(at=c(1:nlevels(OUT$algo)),labels=levels(OUT$algo),alternating=c(1,1,1,1)) ), main=list(label=), xlab=list(cex=1,label=Average rank), ylab=, aspect=fill,as.table=FALSE, layout=c(3,3) ) print(plot) update(plot,perm.cond=c(3,2,1,4,5,6)) #this does not work update(plot,index.cond=c(3,2,1,4,5,6)) #this works it does not what I wish __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] vector to matrix transformation
Dear, Some analysis (linear regression) can only be done from a vectorized dataset whereas others require a matrix (Mantel tests). I use the two analyses and thus need to format my data in matrix and vector. I spent some time trying to solve the problem and I just gave up. Did anyone knows how to transform a matrix into a vector and back-transform a vector into a matrix? Thanks by advance, Gwenaël Jacob -- - Gwenaël JACOB Division Biodiversity Swiss Federal Research Institute WSL Zuercherstrasse 111/Postfach CH-8903 Birmensdorf SWITZERLAND Phone : ++41 1 7392 504 Fax: ++41 1 7392 215 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help : the datail of Fortran subroutine that use in R
On Fri, 3 Dec 2004, sepideh shokohi wrote: How can I see the datail of Fortran subroutine that use in R. for example I want to see detail of emn routine that wrote in Fortran. .Fortran(emn, s$d, old, start, tobs, s$p, s$psi, s$n, s$x, s$npatt, s$r, s$mdpst, s$nmdp, tmp, tmp, numeric(s$p), mle, tau, m, mu0, lambdainv)[[3]] Download the source package norm_1.0-9.tar.gz from your nearest CRAN mirror and unpack it in a suitable temporary directory. Look in the norm/src directory for the Fortran file containing the code for the emn subroutine. If you are using Windows, you have probably installed a pre-compiled version of the package; to read the Fortran/C/C++ code, you need the source package. it was in em.norm in norm package. With regards Sepideh Shokohi __ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: Computation of space-time empirical crosscovariances
Giovanna, space-time cross covariance has never seemed to me something that can be done simple, but package gstat at least offers you: 1. to include time as a third dimension, and model 3D anisotropy, 2. to calculate cross variograms between different moments in time, and proceed with cokriging. -- Edzer __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help : the datail of Fortran subroutine that use in R
sepideh shokohi wrote: How can I see the datail of Fortran subroutine that use in R. for example I want to see detail of emn routine that wrote in Fortran. .Fortran(emn, s$d, old, start, tobs, s$p, s$psi, s$n, s$x, s$npatt, s$r, s$mdpst, s$nmdp, tmp, tmp, numeric(s$p), mle, tau, m, mu0, lambdainv)[[3]] it was in em.norm in norm package. Download the source package norm and look into its sub-directory src. Uwe Ligges With regards Sepideh Shokohi __ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
R: [R] Re: Computation of space-time empirical crosscovariances
Thanks, I'm looking at gstat and trying to understand in which way it is appropriate to add time as the third dimension... Indeed the simple attribute is not for space-time problems :-) -Messaggio originale- Da: Edzer J. Pebesma [mailto:[EMAIL PROTECTED] Inviato: venerdì, 3. dicembre 2004 11:50 A: [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: [R] Re: Computation of space-time empirical crosscovariances Giovanna, space-time cross covariance has never seemed to me something that can be done simple, but package gstat at least offers you: 1. to include time as a third dimension, and model 3D anisotropy, 2. to calculate cross variograms between different moments in time, and proceed with cokriging. -- Edzer __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Getting R to emit an image file as a pipe or Base64 strea m: Mac OSX 10.3 - R 2.0.1
From: Yuandan Zhang If you want to call R from perl, why don't you do a simple system call like: $callR=/usr/loca/bin/R CMD BATCH plotscript.R; system ($callR); It is not necessary to start X display if anything can be done in background But the problem is jpeg()/png() are not available unless an X display is available to the R process (one of the FAQs). Andy On Fri, 3 Dec 2004 12:07:24 +1100 (EST) Thuan-Jin Kee [EMAIL PROTECTED] wrote: Hi All, Anybody know how to make R emit base64 encoded text in some way that perl can grab it, instead of planting a file on your harddrive when calling JPEG or PNG? I've managed to get these scripts to work and put a file on the harddisk #!/usr/bin/perl -Wall # by jin kee. a simple script to demonstrate # the needed steps to get R to emit a jpeg. use strict; my($callR, $callRold); # need to start X if is isn't already started. `open /Applications/Utilities/X11.app`; #need to get let the R program know where to look #for the display immediately before calling #the R executible. $callR =MARKER; DISPLAY=:0.0; export DISPLAY; /usr/bin/R --vanilla plotscript.R; MARKER system($callR); # end script #!/usr/bin/R peg(~/Desktop/test.jpg); plot(rnorm(100)); dev.off(); q(save = no); My sysadmin says that the apache user can't write to the disk due to security policy, so he wants to know if I can emit the jpeg as a base64 stream and embedd it into the dynamically generated tag using a DATA tag to inline the image. http://www.elf.org/essay/inline-image.html http://www.faqs.org/rfcs/rfc2397.html i've tried searching the R-project.org site and help.search() and no luck. Yours Jin __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Yuandan Zhang, PhD Animal Genetics and Breeding Unit The University of New England Armidale, NSW, Australia, 2351 E-mail: [EMAIL PROTECTED] Phone:(61) 02 6773 3786 Fax: (61) 02 6773 3266 http://agbu.une.edu.au AGBU is a joint venture of NSW Primary Industries and The University of New England to undertake genetic RD for Australia's Livestock Industries __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] help : the datail of Fortran subroutine that use in R
Download the package source from CRAN (it would be something like norm_x.y-z.tar.gz, where x.y-z is the version). Unpack it somewhere and look norm/src. Andy From: sepideh shokohi How can I see the datail of Fortran subroutine that use in R. for example I want to see detail of emn routine that wrote in Fortran. .Fortran(emn, s$d, old, start, tobs, s$p, s$psi, s$n, s$x, s$npatt, s$r, s$mdpst, s$nmdp, tmp, tmp, numeric(s$p), mle, tau, m, mu0, lambdainv)[[3]] it was in em.norm in norm package. With regards Sepideh Shokohi __ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] vector to matrix transformation
On Dec 3, 2004, at 5:39 AM, Gwenael Jacob wrote: Dear, Some analysis (linear regression) can only be done from a vectorized dataset whereas others require a matrix (Mantel tests). I use the two analyses and thus need to format my data in matrix and vector. I spent some time trying to solve the problem and I just gave up. Did anyone knows how to transform a matrix into a vector and back-transform a vector into a matrix? See ?as.vector and ?matrix. Do those answer your question? If not, perhaps you could give a bit more detail of what you have tried. Sean __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Text Mining with R
Hi, i didn't know anything and imho R is not the perfect basis for this , which i'm recognize when want doing a lot of text data manipulation. But with the open-sources software weka there exist some possibility's and subprojects related to text-mining. http://www.cs.waikato.ac.nz/ml/weka/ regards, christian Daniele Medri wrote: Dears, anyone has experiences with text mining and R? I'll be very greatfull for tutorial or examples. Thanks __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multinomial probit
I think the polr is in MASS and indeed has a probit method. Jean, On Fri, 3 Dec 2004, Charlie Sprenger wrote: Hello All, I'm trying to run a multinomial probit on a dataset with 28 data points and five levels (0,1,2,3,4) in the latent choice involving response variable. I downloaded the latest mnp package to run the regression. It starts the calculation and then crashes the rpogram. I wish I could give the error message but it literally shuts down R without a warning. I'm using the R that's been ported to OS X. Is it possible that there are RAM restrictions and that when something computationally heavy goes through the program is cut off? As well, is there actually a probit method for polr from nnet package? All help appreciated as masters thesis topics are due soon. Charlie Sprenger UCL - student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] vector to matrix transformation
On 3 Dec 2004 at 11:39, Gwenael Jacob wrote: Dear, Some analysis (linear regression) can only be done from a vectorized dataset whereas others require a matrix (Mantel tests). I use the two analyses and thus need to format my data in matrix and vector. I spent some time trying to solve the problem and I just gave up. Did anyone Hi Gwenael You probably gave up too early did you read ?as.matrix, ?as.vector x-matrix(1:6,3,2) x [,1] [,2] [1,]14 [2,]25 [3,]36 as.vector(x) [1] 1 2 3 4 5 6 y-as.vector(x) z-matrix(y,3,2) z [,1] [,2] [1,]14 [2,]25 [3,]36 Cheers Petr knows how to transform a matrix into a vector and back-transform a vector into a matrix? Thanks by advance, Gwenal Jacob -- - Gwenal JACOB Division Biodiversity Swiss Federal Research Institute WSL Zuercherstrasse 111/Postfach CH-8903 Birmensdorf SWITZERLAND Phone : ++41 1 7392 504 Fax: ++41 1 7392 215 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] How about a mascot for R?
I'd vote for the inchworm because what is more representative to stat? The Gauss curve, of course! What looks like a Gauss curve? The inchworm: http://www.floridanature.org/photos/Geometridae,_Tallahassee,_20011230.jpg http://www.daniellesplace.com/Images2/inchwormcoloractivity.gif Best, Philippe Grosjean __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: RE: [R] Protocol for answering basic questions
Apologies to those who are tired of these rather off-topic discussions. I'll try to be brief. From: Robert Brown FM CEFAS How will I delete the reply without reading first unless I delete all replies? I've made it quite clear that some replies are useful, but some are unhelpful. I and other would like to see an improvement in r help; to just say take it or leave it, as many infer, is conceptually naive. I believe what was meant is that if you find some posts rude/offensive/not-to-your-liking, just delete _all_ posts by those people w/o reading. For USENET newsgroup, some (all?) news readers allow you to create a `kill' list that automatically kill messages posted by people that annoy you. You can do that with most email clients, I believe. Of course, for those who find that unacceptable, they are free to unsubscribe. I joined the community because I want technical assistance and I don't question the technical skills of many of the respondants, but the wider appreciation of needs of users i.e conceptual naivety. It's clear from this string that many beginners are leaving the forum and this should be a cause for concern if we are seriously concerned with propogating knowledge. Unfortuantely this string does seem to indicate this is not a major concern and so be it. I will toss in my perspective, instead of speaking for others. To me, it's not how basic the questions are, but how they are being asked. It's been pointed out by several people: If you showed some effort in trying to solve the problem yourself (by describing what you have tried and how that failed), you will almost always get useful replies without being chastised. Those who received less than enthusiastic responses are generally those that do not show any apparent efforts in trying to solve the problem themselves. As been said ad nauseam before, R is a purely volunteer-based project, and people on this list help others out of their good will. It's rude and discourteous to abuse that. It's OK if you need some spoonfeeding (I need that quite often myself), but at least show how you have tried to use the spoon yourself, instead of just showing us your open mouth. For those who think commercial support is somehow `better', please have a look at a recent thread on the SUSE AMD64 mailing list on SUSE's installation support (Peter would know what I mean). BTW, that's also a prime example of how `gentle' R-help is compared to most other lists. I suspect those whose egos are buised by responses to their questions probably haven't had much experience with mailing lists. Also, I think it should be made clear that the R user community is (much?) larger than those who subscribe to R-help/R-devel/R-*/BioC lists. I know many who use R as their primary tool, yet do not subscribe to R-help. These people managed to get by just fine, either with help pages/manuals/books, or more experienced colleagues. Cheers, Andy -Original Message- From: Marwan Khawaja [mailto:[EMAIL PROTECTED] Sent: 01 December 2004 20:41 To: Robert Brown FM CEFAS; [EMAIL PROTECTED] Subject: RE: [R] Protocol for answering basic questions Well, if you do not like the way some people answer queries, why not just delete the reply without reading the response. Since we're not paying anyone for answering questions, we should be grateful to those who put their time in replying to our basic questions. And why join this community? -- if you think most are 'conceptually naïve'! Marwan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Brown FM CEFAS Sent: Wednesday, December 01, 2004 6:46 PM To: [EMAIL PROTECTED] Subject: [R] Protocol for answering basic questions I have been following the discussions on 'Reasons not to answer very basic questions in a straightforward way' with interest as someone who is also new to R and has had similar experiences. As such it with sadness that I note that most seem to agree with the present approach to the responses to basic questions. I must thank those respondants to my own questions who have been helpful, but there are some whose replies are in my opinion not only unhelpful but actually rude. Indeed I've now started using Splus instead of R so as to have access to a 'proper' support service. Indeed, the main thing I've learned from R is a new respect for the values of commercial software and a scepticism regarding free software. In the end my experience of r help is that you get what you pay for. Many of the so called socratic responses (in this list and the wider academic community) can be seen as simply way to avoid additional work of a complete reply. Experienced R users don't seem to understand how difficult the program can be to new users. Responding that the questioner should read the 'Introduction to R' or a similar document is like
Réf. : Re: [R] Choice modelling (was:(no subject))
I could incorporate indicators of choice availability as explanotary variables, but it does not seem a very good way to do it. Instead, for a logit model, I have coded a likelihood computation of the underlying model with varying choice set and I use optim function to get the maximum. Could you post the code? I can but will be ashamed of my coding... Something like the following : calcLikelihood-function(beta,x,y, S) { #beta : parameter to be estimated #S: 0/1 matrix of choices available for each individual #x matrix of choice caracteristic (only compute intercept) #beta[k] : intercept of choice k #y : choice made for each indiv logLikObs - 0 for (t in 1:length(y)) { #utility of choice at t u_ch_t= beta %*% x[y[t],] # overall utility of possible choices at t u_tot_t = sum( exp( beta %*% x )) + 1 logLikObs=logLikObs + (u_ch_t - log (u_tot_t) ) } return(logLikObs) } #Dummy exemple : calcProbfromUtil - function (utilVector) { v-exp(utilVector) return(v/sum(v)) } drawFromProb - function (probVector) { x-(1:length(probVector)) u-runif(1) if (u max(probVector)) { return(min(x[probVector==max(probVector)])) } else { return(min(x[probVector==min(probVector[probVectoru])])) } } nb_class-4 #nb of choices maxBeta - 5 minBeta - -maxBeta betaFree -round(runif(nb_class-1, min=minBeta, max=maxBeta),2) beta - c(0,betaFree) #parameter to be estimated x - diag(nb_class) T - (nb_class*5000) #nb of individuals S - array(ifelse(runif(nb_class*T)0.5,1,0),dim=c(T,nb_class)) #0/1 matrix of choices available for each individual util - t(apply(S,1,function(x) {x*beta})) #utility for each choices prob - t(apply(util,1,calcProbfromUtil)) #corresponding probability y - as.vector(apply(prob,1,drawFromProb)) #betaFree : paramètre libre de beta calcLikelihoodFromBetaFree - function(betaFree) { return(calcLikelihood(c(0,betaFree),x,0,y, S)) } #AND FINALLY resOptim - optim(par=rep(0,nb_class-1), fn=calcLikelihoodFromBetaFree, method=L-BFGS-B, lower=rep(minBeta*1.5,nb_class-1), upper=rep(maxBeta*1.5,nb_class-1), control=list(trace=0,fnscale=-1)) beta_est-c(0,resOptim$par) #of course , in order to do it right beta_est should be normalized... __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] vector to matrix transformation
In addition to Sean's reply look at ?dist and other ways of creating distance / similarity matrices for applications like Mantels Test. Package vegan might be particularly useful. HTH, Andy R x - rnorm(10) R y - dist(x) R str(x) num [1:10] -0.431 0.564 0.901 -1.407 -0.991 ... R str(y) Class 'dist' atomic [1:45] 0.995 1.332 0.977 0.560 0.909 ... ..- attr(*, Size)= int 10 ..- attr(*, Diag)= logi FALSE ..- attr(*, Upper)= logi FALSE ..- attr(*, method)= chr euclidean ..- attr(*, call)= language dist(x = x) R class(y) [1] dist R class(x) [1] numeric R -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Gwenael Jacob Sent: Friday, December 03, 2004 5:40 AM To: [EMAIL PROTECTED] Subject: [R] vector to matrix transformation Dear, Some analysis (linear regression) can only be done from a vectorized dataset whereas others require a matrix (Mantel tests). I use the two analyses and thus need to format my data in matrix and vector. I spent some time trying to solve the problem and I just gave up. Did anyone knows how to transform a matrix into a vector and back-transform a vector into a matrix? Thanks by advance, Gwenaël Jacob -- - Gwenaël JACOB Division Biodiversity Swiss Federal Research Institute WSL Zuercherstrasse 111/Postfach CH-8903 Birmensdorf SWITZERLAND Phone : ++41 1 7392 504 Fax: ++41 1 7392 215 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] combine two strings
Ben-Yang Liao wrote: Hello, I would like to combine two strings while using R. For instance, string1 - abcde string2 - WXYZ I'd like to combine string1 and string2 into Sting3; and string3 should be abcdeWXZY. paste(string1, string2, sep=) Would you please tell me how to do it? Thank you very much Ben-Yang [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multinomial probit
Charlie Sprenger wrote: Hello All, I'm trying to run a multinomial probit on a dataset with 28 data points and five levels (0,1,2,3,4) in the latent choice involving response variable. I downloaded the latest mnp package to run the regression. It starts MNP the calculation and then crashes the rpogram. I wish I could give the error message but it literally shuts down R without a warning. I am also struggling with this. could you give more details, also try very short runs (n.draws=1!), try different set.seed(), ... Kjetil I'm using the R that's been ported to OS X. Is it possible that there are RAM restrictions and that when something computationally heavy goes through the program is cut off? As well, is there actually a probit method for polr from nnet package? All help appreciated as masters thesis topics are due soon. Charlie Sprenger UCL - student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Computing the minimal polynomial or, at least, its degree
Hi, I would like to know whether there exist algorithms to compute the coefficients or, at least, the degree of the minimal polynomial of a square matrix A (over the field of complex numbers)? I don't know whether this would require symbolic computation. If not, has any of the algorithms been implemented in R? Thanks very much, Ravi. P.S. Just for the sake of completeness, a minimal polynomial is a monic polynomial (whose leading coefficient is unity) of least degree, which divides all the annihilating polynomial of A. In particular, the minimal polynomial divides the characteristic polynomial. Knowing the degree of the minimal polynomial is useful in characterizing the convergence properties of a certain class of numerical schemes for iteratively solving linear (and nonlinear) system of equations. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Univerisity Ph: (410) 502-2619 Fax: (410) 614-9625 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] applying data generating function
ebru apaydÿfdn wrote: Can you write an R function to generate from N samples from the given Gibbs algorithm. Also we must repeat the study for different N values and different L values .And plot iterations vs F1 and iteration vs F2. F1, F2 ~N2 (0, ( 1 L ) ) 1 L Did you hit the send button accidentally? Any way, maybe have a look at MCMCpack and the function MCMCmetrop1R Kjetil - Send a seasonal email greeting and help others. Do good. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] information
Anna Maria Paganoni wrote: I would like to know if there exist any package on the profyle analysis, or on repeated measures, (AUC)... I don't know about profyle analyses, but have a look at the packages nlme (or lme4) which can do repeated measures. Kjetil Thank for answering me, Anna Maria Paganoni Dipartimento di Matematica Politecnico di Milano piazza Leonardo da Vinci, 32 20133 Milano, Italy tel +39-0223994574 fax +39-0223994568 e-mail [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How about a mascot for R?
Philippe Grosjean wrote: I'd vote for the inchworm because what is more representative to stat? The Gauss curve, of course! What looks like a Gauss curve? The inchworm: Erling B. Andersen tells in his paper in Rasch Models: Foundations, Recent Developments, and Applications edited by G. H. Fischer and I. W. Molenaar: Georg Rasch had a very obvious animosity towards the normal distribution. At certain occasions, when we had all consumed a generous amount of alcohol, he would invite all persons present to a party on his front lawn to burn all books containing the word 'normal distribution'. Kjetil http://www.floridanature.org/photos/Geometridae,_Tallahassee,_20011230.jpg http://www.daniellesplace.com/Images2/inchwormcoloractivity.gif Best, Philippe Grosjean __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Computing the minimal polynomial or, at least, its degree
Hi, I would like to know whether there exist algorithms to compute the coefficients or, at least, the degree of the minimal polynomial of a square matrix A (over the field of complex numbers)? I don't know whether this would require symbolic computation. If not, has any of the algorithms been implemented in R? Thanks very much, Ravi. P.S. Just for the sake of completeness, a minimal polynomial is a monic polynomial (whose leading coefficient is unity) of least degree, which divides all the annihilating polynomial of A. In particular, the minimal polynomial divides the characteristic polynomial. Knowing the degree of the minimal polynomial is useful in characterizing the convergence properties of a certain class of numerical schemes for iteratively solving linear (and nonlinear) system of equations. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Univerisity Ph: (410) 502-2619 Fax: (410) 614-9625 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] [BASIC] Solution of combining two strings
You can try the following code: R string3 - paste(string1, string2, sep=) R ?paste Have a look at the following functions too which I found useful when I wanted to use 'paste': R ?assign R ?sub R ?gsub Please don't forget to read the posting guide. http://www.R-project.org/posting-guide.html John ps. I hope that you haven't received any vitriolic and curt responses to your basic question as some questioners sometimes do. --- Ben-Yang Liao [EMAIL PROTECTED] wrote: Hello, I would like to combine two strings while using R. For instance, string1 - abcde string2 - WXYZ I'd like to combine string1 and string2 into Sting3; and string3 should be abcdeWXZY. Would you please tell me how to do it? Thank you very much Ben-Yang __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multinomial probit
Dear Charlie, The multinomial probit model estimates the covariance matrix of the latent variables in addition to the coefficents. In your case with 5 alternatives, there are 9 parameters in the covariance matrix. This means that even if you only have intercepts in your model (no covariate), you will have a total of 13 parameters to estimate with only 28 data points. If you still want to fit the model, you need an informative prior. The default prior is quite diffuse, and so you need to adjust p.var, p.df, and p.scale arguments in mnp(). See the full documentation available at http://www.princeton.edu/~kimai/research/MNP.html and the paper for more details and examples: Imai, Kosuke, and David A. van Dyk. (2005). ``A Bayesian Analysis of the Multinomial Probit Model Using Marginal Data Augmentation.'' Journal of Econometrics, Vol. 124, No. 2 (February), pp. 311-334. Hope this helps, Kosuke - Kosuke Imai Office: Corwin Hall 041 Assistant Professor Phone: 609-258-6601 Department of PoliticseFax: 973-556-1929 Princeton University Email: [EMAIL PROTECTED] Princeton, NJ 08544-1012 http://www.princeton.edu/~kimai - From: Charlie Sprenger [EMAIL PROTECTED] Date: December 3, 2004 4:09:19 AM CST To: [EMAIL PROTECTED] Subject: [R] multinomial probit Reply-To: Charlie Sprenger [EMAIL PROTECTED] Hello All, I'm trying to run a multinomial probit on a dataset with 28 data points and five levels (0,1,2,3,4) in the latent choice involving response variable. I downloaded the latest mnp package to run the regression. It starts the calculation and then crashes the rpogram. I wish I could give the error message but it literally shuts down R without a warning. I'm using the R that's been ported to OS X. Is it possible that there are RAM restrictions and that when something computationally heavy goes through the program is cut off? As well, is there actually a probit method for polr from nnet package? All help appreciated as masters thesis topics are due soon. Charlie Sprenger UCL - student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Andrew D. Martin, Ph.D. Department of Political Science Washington University Campus Box 1063 One Brookings Drive St. Louis, MO 63130 (314) 935-5863 (Office) (314) 753-8377 (Cell) (314) 935-5856 (Fax) Office: Eliot Hall 326 Email: [EMAIL PROTECTED] WWW: http://adm.wustl.edu __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Computing the minimal polynomial or, at least, its degree
Have you looked at library(polynom)? Will that with unique(eigen(A)$values) allow you to compute what you want? hope this helps. spencer graves Ravi Varadhan wrote: Hi, I would like to know whether there exist algorithms to compute the coefficients or, at least, the degree of the minimal polynomial of a square matrix A (over the field of complex numbers)? I don't know whether this would require symbolic computation. If not, has any of the algorithms been implemented in R? Thanks very much, Ravi. P.S. Just for the sake of completeness, a minimal polynomial is a monic polynomial (whose leading coefficient is unity) of least degree, which divides all the annihilating polynomial of A. In particular, the minimal polynomial divides the characteristic polynomial. Knowing the degree of the minimal polynomial is useful in characterizing the convergence properties of a certain class of numerical schemes for iteratively solving linear (and nonlinear) system of equations. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Univerisity Ph: (410) 502-2619 Fax: (410) 614-9625 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD, Senior Development Engineer O: (408)938-4420; mobile: (408)655-4567 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] organising the display in Trellis plots
On Friday 03 December 2004 03:47, Marco Chiarandini wrote: Hallo, I would like to organise at my pleasure the layout of a trellis plot. Currently I have a 3x3 matrix display and 7 plots. Is it possible to choose which specific panels will stay empty? Well, you have already specified 'layout', so the only issues are what order to plot the panels in, and where to plot them. I'm not sure which of these issues you are interested in (perhaps both). To skip some panels, try 'skip', e.g., skip = c(F,F,F,T,F,T,F,F,F) To change the order, you need to use index.cond (see below). I tried index.perm to arrange the order. Then there is perm.cond which I could not understand if it can serve for my purpose since I cant really find which kind of data it accepts. Thank you for the help. Marco P.S. I attach some code. plot - Dotplot(algo~Cbind(y,lower,upper) | group,data=OUT, pch=3, method=bars,pch.bar=2,lwd=3, cex=0.8, par.strip.text=list(cex=1), panel=function(x,y,...) { print(attr(x,'other')) panel.abline(v=attr(x,'other'),lty=2,col=grey70) panel.Dotplot(x,y,...) }, scales = list(cex=1,rot=c(0,45), x=list(alternating=c(1,1,1,1),limits=c(1,nlevels(OUT$algo)),relation= same), y=list(at=c(1:nlevels(OUT$algo)),labels=levels(OUT$algo),alternating= c(1,1,1,1)) ), main=list(label=), xlab=list(cex=1,label=Average rank), ylab=, aspect=fill,as.table=FALSE, layout=c(3,3) ) print(plot) update(plot,perm.cond=c(3,2,1,4,5,6)) #this does not work From ?xyplot, perm.cond: numeric vector, a permutation of '1:n', where 'n' is the number of conditioning variables. ... In your case, n = 1, so this doesn't make sense. update(plot,index.cond=c(3,2,1,4,5,6)) #this works it does not what I wish index.cond needs to be a list of length n (one component for each conditioning variable), so you probably want update(plot,index.cond=list(c(3,2,1,4,5,6))) Deepayan __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How about a mascot for R?
Kjetil Brinchmann Halvorsen [EMAIL PROTECTED] writes: Philippe Grosjean wrote: I'd vote for the inchworm because what is more representative to stat? The Gauss curve, of course! What looks like a Gauss curve? The inchworm: Erling B. Andersen tells in his paper in Rasch Models: Foundations, Recent Developments, and Applications edited by G. H. Fischer and I. W. Molenaar: Georg Rasch had a very obvious animosity towards the normal distribution. At certain occasions, when we had all consumed a generous amount of alcohol, he would invite all persons present to a party on his front lawn to burn all books containing the word 'normal distribution'. However, Erling himself was (as you may know, he died in September, only just over a month away from his retirement) no stranger to models in which a Gaussian random effect was allowed in the Rasch model. And Rasch's life-long hobby horse was measurement methods, which sort of fits rather nicely with other aspects of the inchworm theme. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R program for row-column designs!
Xianggui QU wrote: Does anybody have an R program to generate row-column designs and to produce the incidence matrices? I would appreciate if you could share it with me! Thank you! Harvey. CRAN package crossdes has something for row-col design, but specifically for crossover designs, it seems. Is that what you need? Kjetil - [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] setGeneric(rm)
Hi, We are developing a package using S4 classes. The S4 classes are wrappers to C++ classes. So S4 classes contain an integer that is the memory address of one C++ object. If an user calls the rm() function, the C++ object must be deleted. But our generic rm() function apparently doesn't work. Here is the code: # The class setClass(component, representation(pointer=integer, VIRTUAL)) # The generic method setGeneric(rm, function(..., list = object, pos = -1, envir = as.environment(pos), inherits = FALSE) standardGeneric(rm)) setMethod(rm, component, function(list=object, pos, envir, inherits) { warning(object deleted) .Call(Rm);i }) We implemented generic methods for print(), show() and summary() succesfully. Best, Marcos Carrero __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sampling
Hi: I wonder if there is a way to resample paired value to do bootstrip? Thanks! __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] sampling
Yes, by bootstrapping the index. E.g., if the pairs are in x and y, you can do something like: ind - sample(length(x)) x.boot - x[ind] y.boot - y[ind] Andy From: su su Hi: I wonder if there is a way to resample paired value to do bootstrip? Thanks! __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Package dev: Depends, require, SaveImage best practices?
I'm trying to sort out some best practices for package development and understand some behavior of R CMD check that has me confused. Best practice question: If a package foo appears in the Depends field in the DESCRIPTION file of mypkg, should I refrain from using require(foo) in the R source files of mypkg? The Writing R Extensions manual says this about the Depends field: ... the list of packages which is specified will be attached before the current package, both when library is called and when saving an image or preparing for lazy-loading. I conclude that I need not require() a package that I've listed in Depends. However, this isn't always working for me. I have a package that has Ruuid in Depends. If I also have SaveImage: Yes, then R CMD check completes without error. However, if I omit SaveImage, then I get this: $ R CMD check graph WARNING: ignoring environment value of R_HOME * checking for working latex ... OK * using log directory * '/home/sfalcon/proj-svn-unix/graph-proj/graph.Rcheck' * checking for file 'graph/DESCRIPTION' ... OK * checking if this is a source package ... OK * Installing *source* package 'graph' ... ** libs make: `graph.so' is up to date. ** R ** data ** inst ** preparing package for lazy loading Error in assign(nullgraphID, getuuid()) : couldn't find function getuuid Execution halted ERROR: lazy loading failed for package 'graph' ERROR Installation failed. To conclude: what am I missing? Would it be better to just require(Ruuid)? Always use SaveImage? Much tanks, + seth __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Text Mining with R
On Thu, 2 Dec 2004 18:29:31 +0100 Daniele Medri [EMAIL PROTECTED] wrote: Dears, anyone has experiences with text mining and R? I'll be very greatfull for tutorial or examples. You may have a look at: http://wwwpeople.unil.ch/jean-pierre.mueller/ HTH, Tobias -- Daniele Medri - http://www.medri.org __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] New package: polycor
Dear list members, I've uploaded a new package, called polycor (version 0.5-0), to CRAN. The package has functions for computing polychoric and polyserial correlations, either by maximum-likelihood (in which case, standard errors are available) or by faster approximations. There's also a function to compute heterogeneous correlation matrices composed of product-moment, polychoric, and polyserial correlations, as appropriate to each pair of variables. Comments and suggestions would be appreciated. John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] setGeneric(rm)
On Fri, 3 Dec 2004, Marcos Aurélio Carrero wrote: Hi, We are developing a package using S4 classes. The S4 classes are wrappers to C++ classes. So S4 classes contain an integer that is the memory address of one C++ object. If an user calls the rm() function, the C++ object must be deleted. But our generic rm() function apparently doesn't work. Here is the code: # The class setClass(component, representation(pointer=integer, VIRTUAL)) # The generic method setGeneric(rm, function(..., list = object, pos = -1, envir = as.environment(pos), inherits = FALSE) standardGeneric(rm)) setMethod(rm, component, function(list=object, pos, envir, inherits) { warning(object deleted) .Call(Rm);i }) We implemented generic methods for print(), show() and summary() succesfully. I think that you may find reading the code written by Timothy Keitt in the rgdal package, especially R/gdal.R, useful. He defines a class with representation(handle = 'externalptr') which I think should be considered as an alternative to integer, because integer is a vector and externalptr is not - it is an external pointer and just that. In addition, his code shows how to use .setCollectorFun() as the collector calling reg.finalizer() in the body of the class definition. It may well be that you don't need an rm method for your object, I think reading Tim's code may help you to find a cleaner structure, and contribute to solving this question. Roger Best, Marcos Carrero __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how can I get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3
Hi, I would like to get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3. The result should be 1, 3, 6, 7, 6, 3, 1; How can I calculate in R? You help will be greatly appreciated. Peter [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Text Mining with R
Tobias, I just created a zip file from the tar, and used the install from zip option of the Rwin console. ttda is shown in the list of installed packages. However, when I try load packages, or the equivaent library(ttda), I get: Error in library(ttda) : 'ttda' is not a valid package -- installed 2.0.0? local({pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Error in library(pkg, character.only = TRUE) : 'ttda' is not a valid package -- installed 2.0.0? Do you know why? Thanks, -Jose On Fri, 3 Dec 2004 19:15:57 +, Tobias Verbeke [EMAIL PROTECTED] wrote: On Thu, 2 Dec 2004 18:29:31 +0100 Daniele Medri [EMAIL PROTECTED] wrote: Dears, anyone has experiences with text mining and R? I'll be very greatfull for tutorial or examples. You may have a look at: http://wwwpeople.unil.ch/jean-pierre.mueller/ HTH, Tobias -- Daniele Medri - http://www.medri.org __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- * I have finally put online an exhibition project with my newer paintings * http://lsa.colorado.edu/~quesadaj/FTexhibitionProject/ Jose Quesada, PhD. [EMAIL PROTECTED] Research associate http://lsa.colorado.edu/~quesadaj Dept. of Social and Decision Sciences http://www.andrew.cmu.edu/~jquesada Carnegie Mellon University Porter Hall Phone: 412 268 6011 office PH208-J Fax: 412 268 6938 5000 Forbes ave. 15213, Pittsburgh, PA __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how can I get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3
Use the 'polynom' library: p - as.polynomial(c(1,1,1)) p 1 + x + x^2 p^3 1 + 3*x + 6*x^2 + 7*x^3 + 6*x^4 + 3*x^5 + x^6 unclass(p^3) [1] 1 3 6 7 6 3 1 __ James HoltmanWhat is the problem you are trying to solve? Executive Technical Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] +1 (513) 723-2929 Peter Yang [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: Sent by: Subject: [R] how can I get the coefficients of x^0, x^1, x^2, . ,x^6 from [EMAIL PROTECTED] expansion of (1+x+x^2)^3 ath.ethz.ch 12/03/2004 14:56 Hi, I would like to get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3. The result should be 1, 3, 6, 7, 6, 3, 1; How can I calculate in R? You help will be greatly appreciated. Peter [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Protocol for answering basic questions
Hello, Liaw, Andy schrieb: Apologies to those who are tired of these rather off-topic discussions. I'll try to be brief. I will toss in my perspective, instead of speaking for others. To me, it's not how basic the questions are, but how they are being asked. It's been pointed out by several people: If you showed some effort in trying to solve the problem yourself (by describing what you have tried and how that failed), you will almost always get useful replies without being chastised. Those who received less than enthusiastic responses are generally those that do not show any apparent efforts in trying to solve the problem themselves. As been said ad nauseam before, R is a purely volunteer-based project, and people on this list help others out of their good will. It's rude and discourteous to abuse that. It's OK if you need some spoonfeeding (I need that quite often myself), but at least show how you have tried to use the spoon yourself, instead of just showing us your open mouth. Even if you did , but missed to get a look at R FAQ and other resources, you're pointed at the appropriate issue! I think that's quite okay with me! Well its not only a question of either getting a RTFM or being just ruffled by someone. AFAIR I sometimes got both..well that okay, and teaches you some decency regarding what questions might be raised to bother generally helpful people on this list. BTW, that's also a prime example of how `gentle' R-help is compared to most other lists. I suspect those whose egos are buised by responses to their questions probably haven't had much experience with mailing lists. There are many lists which don't give a dam about postings containing no meaningful subject or a proper description of your problem. It stunning to see that some people even don't care to make up their minds related to this issue (well, maybe only to the point when they start using the mail archive and give up on browsing too many no subjects-mails. Well, basically I am agree to your statement, Andy! Also, I think it should be made clear that the R user community is (much?) larger than those who subscribe to R-help/R-devel/R-*/BioC lists. I know many who use R as their primary tool, yet do not subscribe to R-help. These people managed to get by just fine, either with help pages/manuals/books, or more experienced colleagues. Hmm, maybe that is the hardcore way of doing things. I am sure there are lots of people who like this learning method, but not quite sure if this the majority With regard to this I (still) think that using R demands some far reaching skills, i.e. not entirely restricted to profound knowledge in statistics, but also related to OO programming. If you never did any programming even help pages, manuals and books are of limited usefulness. So, it takes time to get into and not all of your problems might me solved soon...hmm, where is this damned..heh...my..spoon... ah . Well to all beginners, like me, it takes time and some efforts to get into, sure that this investment will sum up to something good. I can recommend the mail archive of R-help, since I am sure that nearly almost (all) of my stupid beginners questions are already answered (beware this may only correct for a= 0.05 CI), the rest is found in R FAQ.. sincerely Thomas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Text Mining with R
On Fri, 3 Dec 2004, Jose Quesada wrote: On Fri, 3 Dec 2004 19:15:57 +, Tobias Verbeke wrote: You may have a look at: http://wwwpeople.unil.ch/jean-pierre.mueller/ I just created a zip file from the tar, and used the install from zip option of the Rwin console. ttda is shown in the list of installed packages. However, when I try load packages, or the equivaent library(ttda), I get: Error in library(ttda) : 'ttda' is not a valid package -- installed 2.0.0? local({pkg - select.list(sort(.packages(all.available = TRUE))) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) Error in library(pkg, character.only = TRUE) : 'ttda' is not a valid package -- installed 2.0.0? Do you know why? Converting from one archive format to another doesn't change the fact that it's still a source archive. The Windows install from zip is expecting a precompiled, binary archive. Unless you used the R development tools, it ain't gonna fly. -- SIGSIG -- signature too long (core dumped) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Odd underflow(?) error
I'm still trying to install R on my Irix machine. Now I have a new problem that crops up during the checks. I've found the root cause, and it's that R is returning zero for certain things for reasons I don't understand. 2.225073859e-308, entered directly into R, responds 2.225074e-308. 2.225073858e-308 responds 0. Their negative values respond similarly, so it would appear that somewhere in there is the smallest absolute value that that installation of R will hold. On another machine where the checks passed, both responses are correct, not just the first one. The underflow there is significantly lower, with much less accuracy, as opposed to what seems to be good accuracy on what looks like the broken one. The values there are: 2.4703282293e-324 gives 4.940656e-324 2.4703282292e-324 gives 0 My first thought was that GMP and/or MPFR weren't working properly, so I recompiled GMP, which passed all of its tests, and GCC, making sure to imclude support for them. This made no difference. Anyone have any ideas, including which one is broken? Both? -Bitt __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Label data points in scatterplot matrices
Mauricio Esguerra wrote: Hello, I am new to R and would like to know how to label data points in the matrices of scatterplots made by the pairs() command. To be more specific, I want to assign a number to each data point, instead of the small circumference that appears as a data point. If anyone here knows if its possible to do this with R, I would greatly appreciate your help. A - data.frame(a1=1:3, a2=1:3, a3=1:3) pairs(A, pch=letters[1:3]) Uwe Ligges Thank you, Mauricio Esguerra PhD candidate Chemistry and Chemical Biology Department Rutgers, the State University of New Jersey __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How about a mascot for R?
On Fri, Dec 03, 2004 at 03:04:52PM +1300, David Scott wrote: As to an animal mascot, I think a New Zealand mascot is a must, and suggestions of Australian ones would not be warmly received by New Zealanders. (To clarify, despite the address, I am Australian.) My suggestion is the Kea: inquisitive and intelligent. See: http://www.doc.govt.nz/Conservation/001~Plants-and-Animals/001~Native-Animals/Kea.asp Hello, I endorse David's comment that an Australian mascot chosen for R would not be warmly received by New Zealanders! But at the end of the day, Ross and Robert ought to give whatever choice the definitive yes or no. ps. Ross has Maori origins, so a native NZ animal is a better idea than usual. One good thing about the Kea is that another native NZ bird, called a Weka, is the name of a well-known machine learning software package (also free) which was developed about 100 miles south of Auckland, at the CS department of Waikato University. See http://www.cs.waikato.ac.nz/~ml However, having R indirectly associated with a similar free software package has its good and bad points. cheers Thomas Thomas W. Yee, Telephone: 64 - 9 - 3737599 extn 86857 or 85055 Department of Statistics,Fax: 64 - 9 - 3737000 or 3677149 University of Auckland, E-mail:[EMAIL PROTECTED] Private Bag 92019, [EMAIL PROTECTED] Auckland 1001, New Zealand. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Odd underflow(?) error
On Fri, 3 Dec 2004, William Faulk wrote: I'm still trying to install R on my Irix machine. Now I have a new problem that crops up during the checks. I've found the root cause, and it's that R is returning zero for certain things for reasons I don't understand. 2.225073859e-308, entered directly into R, responds 2.225074e-308. 2.225073858e-308 responds 0. Their negative values respond similarly, so it would appear that somewhere in there is the smallest absolute value that that installation of R will hold. Yes. .Machine$double.xmin tells you the smallest number representable to full precision, which is 2.225074e-308 (I think on all machines where R works) On another machine where the checks passed, both responses are correct, not just the first one. The underflow there is significantly lower, with much less accuracy, as opposed to what seems to be good accuracy on what looks like the broken one. The values there are: 2.4703282293e-324 gives 4.940656e-324 2.4703282292e-324 gives 0 Machines can differ in what they do with numbers smaller than .Machine$double.xmin. They can report zero, or they can add leading zeros and so lose precision. Suppose you had a 4-digit base 10 machine with 2 digits of exponent. The smallest number representable to full accuracy would be 1.000e-99 but by allowing the leading digits to be zero you could represent 0.001e-99 ie, 1e-102, to one digit accuracy (these are called denormalized numbers). My Mac laptop denormalizes, and agrees with your other computer, giving the smallest representable number as 4.940656e-324. It is .Machine$double.xmin/2^52. This number has very few bits left to represent values, so for example (a/2^52)*1.3==(a/2^52) [1] TRUE where a is .Machine$double.xmin Both your machines should be correct. I don't think we deliberately require denormalized numbers to work anywhere. -thomas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Label data points in scatterplot matrices
This does job, but it reveals that I don't really understand panels. What I would like to know is how do you get the same result but without the warnings. This is essentially taken from the ?pairs help. data(USJudgeRatings) # There are 43 observations in this data.frame z - 1:43 panel.text - function(x,y,z, ...) { text(x,y,z) } panel.hist - function(x, ...) { usr - par(usr); on.exit(par(usr)) par(usr = c(usr[1:2], 0, 1.5) ) h - hist(x, plot = FALSE) breaks - h$breaks; nB - length(breaks) y - h$counts; y - y/max(y) rect(breaks[-nB], 0, breaks[-1], y, col=cyan, ...) } pairs(USJudgeRatings[1:5], panel=panel.text,z=z,, cex = 1.5, pch = 24, bg=light blue, diag.panel=panel.hist, cex.labels = 2, font.labels=2) Mauricio Esguerra wrote: Hello, I am new to R and would like to know how to label data points in the matrices of scatterplots made by the pairs() command. To be more specific, I want to assign a number to each data point, instead of the small circumference that appears as a data point. If anyone here knows if its possible to do this with R, I would greatly appreciate your help. Thank you, Mauricio Esguerra PhD candidate Chemistry and Chemical Biology Department Rutgers, the State University of New Jersey __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how can I get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3
Have you considered library(polynom)? If you don't already have it but have R, install.packages(polynom) should get it. hope this helps. spencer graves Peter Yang wrote: Hi, I would like to get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3. The result should be 1, 3, 6, 7, 6, 3, 1; How can I calculate in R? You help will be greatly appreciated. Peter [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD, Senior Development Engineer O: (408)938-4420; mobile: (408)655-4567 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how can I get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3
From: Peter Yang [EMAIL PROTECTED] I would like to get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3. # modification of DD in example(D) to support 0th derivative DD - function(expr,name, order = 0) { if(order == 0) expr else DD(D(expr, name), name, order - 1) } # take symbolic derivatives, evaluate at 0 and divide by factorial n sapply(0:6, function(i) eval(DD(e,x,i),list(x=0)))/factorial(0:6) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how can I get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3
From: Peter Yang [EMAIL PROTECTED] I would like to get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3. # modification of DD in example(D) to support 0th derivative DD - function(expr,name, order = 0) { if(order == 0) expr else DD(D(expr, name), name, order - 1) } # take symbolic derivatives, evaluate at 0 and divide by factorial n sapply(0:6, function(i) eval(DD(e,x,i),list(x=0)))/factorial(0:6) By the way, e in the above is your expression, in this case: e - expression((1+x+x^2)^3) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to wrap or split labels on plot
On Fri, 2004-12-03 at 15:00 -0500, Heather J. Branton wrote: Dear R gurus, I want to wrap labels that are too long for a plot. I have looked at strsplit(), substr(), nchar(), and strwrap(). I think it's some combination but I'm having difficulty trying to figure out the right combo. I think I need to create some new matrix containing the labels already split, though I'm not sure if maybe there is a quick and dirty way to address this without my wandering around the block. I am using R 1.9.1, Windows XP. (Note: we are currently in the midst of a big project and probably won't upgrade to R 2.0.1 for another couple of weeks -- *unless* that's what I need to do to address these issues.) Here is my script with two label options at the bottom that are not working. # Settings win.graph(width=8, height=8, pointsize=10) # Read in data test - matrix(data=c(2.52,9.5,3.07,2.5,1.99,8.95), nrow = 6, byrow=TRUE) # Read in and attach labels (names) to data rownames(test) - c(Mount Pleasant,Jordan,Oil City,Pleasant Valley,Village of Lake Isabella,Rosebush) # Set plot limits: xmax - nrow(test) nvec - ncol(test) ymax - ceiling(max(test)) yinc - 1 # Generate Pareto order test - test[order(test[,1],decreasing=TRUE),] # Set color palette MyCols - rep(c(lightcyan,cornsilk,lavender), each = xmax) # Adjust the margins par(mar = c(7, 5, 6, 3)) # Bar graph mp - barplot(test, beside = TRUE, col = MyCols, axisnames = FALSE, names.arg = rep(names(test),nvec), las = 2, cex.names = 0.75, ylab = IXYV, ylim = c(0,ymax), yaxt = n) # Set up the y axis tick marks and labels ifelse (ymax=10,decpt - 2,decpt - 0) ticks - seq(0, ymax, yinc) axis(2, at = ticks, las = 1, labels = formatC(ticks, format = f, digits = decpt)) # Draw a box around the whole thing box() # Draw the x axis labels mtext(side = 1, at = rowMeans(mp)-.2, line = .5, las=2, text = strsplit(names(test), )) mtext(side = 1, at = rowMeans(mp), line = .5, las=2, text = strwrap(names(test),7)) mtext(side = 1, line = 5.5, text = Division) # Draw titles title(main=Central, outer=F, font.main=4, line=4) title(main=IXYV by Division, outer=F, font.main=2, line=2.5) Heather, There is likely to be more than one approach, but the one that I generally use is to explicitly put a newline character \n into the plot labels where required. So, in this case, you could do something like: names(test) - c(Mount\nPleasant,Jordan,Oil City, Pleasant\nValley, Village of\nLake Isabella, Rosebush) Also, there are some confusing things in your code, which I suspect may tie back to your test data versus the actual data you are using. If I am missing something here, you might want to clarify that, since things like your colors and other things don't entirely make sense. Here is something of a simplified approach using the test data as you have it: # Test can be a vector test - c(2.52, 9.5, 3.07, 2.5, 1.99, 8.95) names(test) - c(Mount\nPleasant,Jordan,Oil City, Pleasant\nValley, Village of\nLake Isabella, Rosebush) # Use sort here test - sort(test, decreasing = TRUE) ymax - ceiling(max(test)) par(mar = c(7, 5, 6, 3)) # Note that you can use the names here for names.arg # As a result of the \n, the titles will print on two lines mp - barplot(test, names.arg = names(test), cex.names = 0.8, ylab = IXYV, yaxt = n, ylim = c(0, ymax)) ticks - seq(0, ymax, 1) axis(2, at = ticks, las = 1, labels = formatC(ticks, format = f, digits = ifelse(ymax = 10, 2, 0))) box() mtext(side = 1, line = 3.5, text = Division) # you can combine the two title() calls into one mtext() call mtext(side = 3, text = c(Central, IXYV by Division), font = c(4, 2), line = c(4, 2.5)) If your actual data is a more complex matrix, adjust the above accordingly. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Computing the minimal polynomial or, at least, its degree
How about the following: library(polynom) help(package=polynom) A - diag(c(1:2, 2)) eigVals - eigen(A)$values multEig - table(eigVals) k - length(multEig) ratPoly - minPoly - 1 for(i in 1:k){ poly.i - polynomial(c(-as.numeric(names(multEig)[i]), 1)) minPoly - (minPoly*poly.i) if(multEig[i]1) ratPoly - (ratPoly*poly.i^(multEig[i]-1)) } minPoly 2 - 3*x + x^2 ratPoly -2 + x hope this helps. spencer graves ### Spencer, One could do this by a brute force approach. Suppose A is an nxn matrix, and the distinct eigenvalues are: lambda_1, ..., lambda_k, with multiplicities m_1, ..., m_k, such that they sum to n. Then the characteristic polynomial is: C(lambda) = \prod_i (lambda - lambda_i)^{m_i} The minimal polynomial is given by: M(lambda) = \prod_i (lambda - lambda_i)^{p_i}, where 1 \leq p_i \leq m_i. So, one could run through all possible p_i, starting with the smallest degree polynomial (within constraint), and stop when we find one that exactly divides C(lambda). Is there a cleverer way to do this? Ravi. # Have you looked at library(polynom)? Will that with unique(eigen(A)$values) allow you to compute what you want? hope this helps. spencer graves Ravi Varadhan wrote: Hi, I would like to know whether there exist algorithms to compute the coefficients or, at least, the degree of the minimal polynomial of a square matrix A (over the field of complex numbers)? I don't know whether this would require symbolic computation. If not, has any of the algorithms been implemented in R? Thanks very much, Ravi. P.S. Just for the sake of completeness, a minimal polynomial is a monic polynomial (whose leading coefficient is unity) of least degree, which divides all the annihilating polynomial of A. In particular, the minimal polynomial divides the characteristic polynomial. Knowing the degree of the minimal polynomial is useful in characterizing the convergence properties of a certain class of numerical schemes for iteratively solving linear (and nonlinear) system of equations. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Univerisity Ph: (410) 502-2619 Fax: (410) 614-9625 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] -- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD, Senior Development Engineer O: (408)938-4420; mobile: (408)655-4567 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how can I get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3
Alternatively, how about the following: library(polynom) coefficients(polynomial(c(1,1,1))^3) [1] 1 3 6 7 6 3 1 hope this helps. spencer graves Gabor Grothendieck wrote: From: Peter Yang [EMAIL PROTECTED] I would like to get the coefficients of x^0, x^1, x^2, . , x^6 from expansion of (1+x+x^2)^3. # modification of DD in example(D) to support 0th derivative DD - function(expr,name, order = 0) { if(order == 0) expr else DD(D(expr, name), name, order - 1) } # take symbolic derivatives, evaluate at 0 and divide by factorial n sapply(0:6, function(i) eval(DD(e,x,i),list(x=0)))/factorial(0:6) By the way, e in the above is your expression, in this case: e - expression((1+x+x^2)^3) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD, Senior Development Engineer O: (408)938-4420; mobile: (408)655-4567 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] vector to matrix transformation
If v is a vector, as.matrix(v) and t(v) give row and column matrices and matrix(v,nrow=nr, ncol=nc) gives a matrix with nr rows and nc columns such that the vector fills the first column, then the second, etc. You only have to provide nr or nc in most cases. If m is a matrix c(m) is a vector formed by stringing out the columns one after another. as.vector is similar. Date: Fri, 3 Dec 2004 11:39:57 +0100 From: Gwenael Jacob [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] vector to matrix transformation Dear, Some analysis (linear regression) can only be done from a vectorized dataset whereas others require a matrix (Mantel tests). I use the two analyses and thus need to format my data in matrix and vector. I spent some time trying to solve the problem and I just gave up. Did anyone knows how to transform a matrix into a vector and back-transform a vector into a matrix? Thanks by advance, Gwenaël Jacob -- - Gwenaël JACOB Division Biodiversity Swiss Federal Research Institute WSL Zuercherstrasse 111/Postfach CH-8903 Birmensdorf SWITZERLAND Phone : ++41 1 7392 504 Fax : ++41 1 7392 215 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html