Re: [R] Lattice cloud() funtion bug in R1.8.0beta
Mark Marques wrote: Cloud() function does not display anything with R1.8.0beta in WindowsXP ... Does any one noticed this ? No. Works in the latest beta on my machine. others functions from lattice seem working properly. does it work in the final 1.8.0 for windows ? Yes. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Scoping rules
On Wed, 8 Oct 2003, Roger D. Peng wrote: I think I misinterpreted this section of the help file for get(): If `inherits' is `FALSE', only the first frame of the specified environment is inspected. If `inherits' is `TRUE', the search is continued up through the parent frames until a bound value of the right mode is found. Should this read parent environments instead of parent frames? I'm taking this from R 1.7.1. It should read `enclosing' not `parent' for a start. Thanks: we will try to get this consistent. -roger Prof Brian Ripley wrote: On Wed, 8 Oct 2003, Roger D. Peng wrote: It seems like you want in fnB get(AA$first, envir = parent.frame(1)) but I'm entirely clear on why your original function doesn't work. My understanding was that get() should search through the parent frames. Where did you get that idea from? Argument `inherits' to get() defaults to TRUE and is defined as inherits: should the enclosing frames of the environment be inspected? Note `enclosing', not `parent'. So the normal R scope rules apply when looking for an object from the frame of fnB, which as its environment (aka enclosing frame) is the workspace (.GlobalEnv) is to look in the local frame and then along the search path. [This does seem a fairly common misconception, so if you do have any idea in which document it arises it would be good to know.] Peter Alspach wrote: Dear List members: I'm using R1.7.1 (Windows 2000) and having difficulty with scoping. I've studied the FAQ and on-line manuals and think I have identified the source of my difficulty, but cannot work out the solution. For the purposes of illustration. I have three functions as defined below: fnA - function(my.x) { list(first=as.character(substitute(my.x)), second=sqrt(my.x)) } fnB - function(AA) { tmp.x - get(AA$first) tmp.x^2 } fnC - function() { x - 1:2 y - fnA(x) z - fnB(y) c(x,y,z) } fnA() has a vector as an argument and returns the name of the vector and the square root of its elements in a list. fn(B) takes the result of fn(A) as its argument, gets the appropriate vector and computes the square of its elements. These work fine when called at the command line. fnC() defines a local vector x and calls fnA() which operates on this vector. Then fnB() is called, but it operates on a global vector x in GlobalEnv (or returns an error is x doesn't exist there) - but I want it to operate on the local vector. I am not sure what you really want to do here, but R works best if you pass functions an object to work on, and not the name of an object. Normally this sort of thing is best avoided, but if it is really needed it is normally simpler to find the object in the calling function (your fnC). I think this is related to the enclosing environment of all three functions being GlobalEnv (since they were created at the command line), but the parent environment of fnB() being different when invoked from within fnC(). My questions: 1 Have I correctly understood the issue ? 2 How do I make fnB() operate on the local vector rather than the global one ? 3 And, as an aside, I have used as.character(substitute(my.x)) to pass the name - but deparse(substitute(my.x)) also works. Is there any reason to prefer one over the other? deparse() is preferred. One subtle reason is what happens with very long expressions (and note deparse may give more than one line of output), but the main reason is what happens with expressions such as calls: fn1 - function(x) as.character(substitute(x)) fn2 - function(x) deparse(substitute(x)) fn1(log(x)) [1] log x fn2(log(x)) [1] log(x) It is normally dangerous to use get() on the result of deparse(substitute()), as the latter may be the character representation of an expression and not a simple name. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] 2 questions regarding base-n and identifing digits + the source problem description
Thanks for the suggestions.. The strsplit function works great for the second question... I will have to come up with another solution to the first one, since my problem would definetly involve a lot of calculations and I think that current methods would cause major computational congestion... BUt here is the outline of my problem... if anybody has an idea... In practice I start with 4 possible correlations: -0.9, -0.1, 0.1, 0.9 and want to construct all possible 3x3 correaltion matrices with those values. So I need to do all possible permutations of a given length with replication. I have a set of 4 distinct values and want to create the permutations of length 3. My idea was as folows: specifing the sequence in base-4 form 0 to 333 would account for all possible combinations. I checked some of the existing functions which were either recursive and slow or without replication. I think there was a thread on the list just a short while ago. If anybody has a hint to follow, i would be more then glad to try it out... Thanks again Andrej _ Andrej Kveder, M.A. researcher Institute of Medical Sciences SRS SASA; Novi trg 2, SI-1000 Ljubljana, Slovenia phone: +386 1 47 06 440 fax: +386 1 42 61 493 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] SuSE rpms for R-1.8.0 available
Rpms for R-base and all R-contrib packages (that compile on my machines) have been uploaded to CRAN. For the time beeing SuSE 7.3, 8.[012] are supported. 9.0 rpms will be created asap. This is the last build for 7.3. Have fun, dst -- The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. Russell Detlef Steuer --- http://fawn.unibw-hamburg.de/steuer.html * Encrypted mail preferred * __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Previous Commands
Philippe Glaziou [EMAIL PROTECTED] writes: Rau, Roland [EMAIL PROTECTED] wrote: yesterday I took the R-1.8.0-source file and compiled it on my own. As I am using Linux just for a couple of weeks, it was my first compiling session with ./configure, make, Everything went fine, except for one thing: if I want to look at the commands history by using the cursor keys, it does not work. Instead of displaying the previous commands, it returns something like [[A. Is this a common problem? Does anyone have a solution? You may need to install the ncurses dev libraries. and/or readline-devel -- 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://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Previous Commands
On Thu, 9 Oct 2003, Philippe Glaziou wrote: Rau, Roland [EMAIL PROTECTED] wrote: yesterday I took the R-1.8.0-source file and compiled it on my own. As I am using Linux just for a couple of weeks, it was my first compiling session with ./configure, make, Everything went fine, except for one thing: if I want to look at the commands history by using the cursor keys, it does not work. Instead of displaying the previous commands, it returns something like [[A. Is this a common problem? Does anyone have a solution? You may need to install the ncurses dev libraries. More likely it is the readline-del[ev] RPMs/.debs/ that you need. Take a look at the R-admin manual (e.g. doc/html/R-admin.html in the sources). -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Previous Commands
Philippe Glaziou [EMAIL PROTECTED] wrote: Rau, Roland [EMAIL PROTECTED] wrote: yesterday I took the R-1.8.0-source file and compiled it on my own. As I am using Linux just for a couple of weeks, it was my first compiling session with ./configure, make, Everything went fine, except for one thing: if I want to look at the commands history by using the cursor keys, it does not work. Instead of displaying the previous commands, it returns something like [[A. Is this a common problem? Does anyone have a solution? You may need to install the ncurses dev libraries. oops, sorry, I meant readline. And then re-configure. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Correlations
Hi I am trying out R for the first time and it seems to work nice. I also try it out on a LINUX platform aswell as on Windows. I downloaded the new version of R for windows (version 8.1.0) but something look not right in the calculations of correlations between traits when I use the next command: cor(fc,use=pairwise) The correlation return between the same trait (that must be 1.000) is not 1 and sometimes it is 0.37?? When I run the same scrip with the same data in Linux the correlation is correctly, 1.000. And when I run the following scrip in 1.8.0 for windows it returns the correct correlation of 1.000. cor.test(BIRHTMASS,BIRHTMASS,na.rm=T,method=pearson) Could there be a bug in this version of Windows? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] simulate binary data from a logistic regression model
Hi. How can i simulate a binary data set from a logistic regression model?I need to manipulate parameters and so obtain my set of data. I want to show the improve in analyzing binary data with GLM(binomial) model instead of classical ANOVA or NON-MODELS procedures(relative risk-odds ratio-Pearson test of godness of fit...) Can you say me what is the right function to use? Do you know any interesting simulation in the web? Thank you. Michele. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)
-Original Message- From: Richard A. O'Keefe [mailto:[EMAIL PROTECTED] snip The very existence of an is.na- which accepts a logical vector containing FALSE as well as TRUE ... And don't forget this is not the only usage of is.na-. In fact it is designed to take any valid indexing value. For example: a-1:10 is.na(a) - 1:5 a [1] NA NA NA NA NA 6 7 8 9 10 Wow. I really hate that. Someone tell me again why this is better than a[1:5] - NA ?? Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Exact logistic regression models
Hello All: Is there such a function in the R libraries: exact logistic regression? Thanks, ANDREW __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Source package installation for WinXPpro
Hi I d like to compile the source code from last Affy package for WinXPpro under R18beta however the doc is pretty poor regarding this process... I went to FAQ R Win then to http://www.stats.ox.ac.uk/pub/Rtools/ and downloaded in The essentials, tools and Perl 5.8.0, then MingW from www.mingw.org and I wonder if I need any other stuff from this page ? I m not sure but I dont think I need the cross-conpilers ? what about the others below ? Then I installed MingW and Perl. Then what am i suposed to do? If I click on Rcmd I dont get any windows to open or just for a second... thanks for your help Philippe [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] polygon border
see ?chull hope this helps, Clément. At 12:34 09/10/2003 +0200, Marta Rufino wrote: Hello, Does anyone know how a function to find automaticly the border (polygon) of a cloud of points? It is for a PCA kind of analysis, where I wanted to present as the limits for each group, instead of all points... thank you in advance Marta __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] lattice/levelplot: panels with values can be empty
I tried: library(lattice) F0 - c( 'A', 'A', 'B', 'B' ) F1 - c( 1 , 1 , 1 , 2 ) F2 - c( 8 , 9 , 8 , 9 ) VAL - c( 20, 50, 10, 60 ) df - data.frame( F0, F1, F2, VAL ) levelplot( VAL ~ F1 * F2 | F0, data=df ) I got an empty field for F0 == 'A' and a colored field for F0 == 'B'. I expected two colored fields. - What can I do? Thanks. Wolfram __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Source package installation for WinXPpro
[Please do not cross-post to several mailing lists] [EMAIL PROTECTED] wrote: Hi I d like to compile the source code from last Affy package for WinXPpro under R18beta however the doc is pretty poor regarding this process... ...\gnuwin32\readme.packages and ...\gnuwin32\install do provide a great description. I went to FAQ R Win then to http://www.stats.ox.ac.uk/pub/Rtools/ and downloaded in The essentials, tools and Perl 5.8.0, then MingW from www.mingw.org and I wonder if I need any other stuff from this page ? Please read the files mentioned above and follow the instructions given therein exactly. I m not sure but I dont think I need the cross-conpilers ? No, given you are not going to cross-compile ... what about the others below ? Then I installed MingW and Perl. Then what am i suposed to do? If I click on Rcmd I dont get any windows to open or just for a second... Rcmd is supposed to be used within the windows shell. Uwe Ligges thanks for your help Philippe [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] robust regression and poisson errors
We have done a multiple regression (glm) with non-orthogonal design and two correlated explanatory variables, and poisson errors, because the response variable is a count (number of species). The parameter estimates calculated were opposite to the tendency observed in the plot. As we excluded the most influencial point, the results changed radically, but as we took the second influential point the results changed again, to a third form. Thefore I tried to use robust regression, with rlm. My questions are: 1 - how do I get the test of bias of the robust regression? In the S-Plus guide (p. 338), it is said that this test should be used to choose between the robust regression and the other one. Is this correct? 2 - when I run an anova, comparing the complete rlm model to a more simple model, I get no values for F nor P. How do I get these? 3 - may I use robust regression for count response variables, taking the log of the data? Thank you all! Carlos Sperber, Carla Galbiati Carla Ribas Carlos Frankl Sperber Ecology - Orthoptera: Grylloidea Departamento de Biologia Geral Universidade Federal de Viçosa 3.570-000 - Viçosa - MG Brazil tel: +55 (31) 3899 2556 fax: +55 (31) 3899 2549 E-mail: [EMAIL PROTECTED] --- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] robust standard error
How can I do a Multiple Linear Regression Models with robust standard error? Thank in advance. D.F. -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Vieni a visitare il Garden Center Peraga. Seimila metri quadrati di esposizione per servire una clientela competente ed esigente. Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=1480d=9-10 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
R: [R] simulate binary data from a logistic regression model
You can use the followings: lp- -5+. #linear predictor y-rbinom(length(lp), size, plogis(lp)) Note that size means your denominator in proportions to be simulated. For instance, if you want binary data use size=1. best, vito - Original Message - From: Michele Grassi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 11:38 AM Subject: [R] simulate binary data from a logistic regression model Hi. How can i simulate a binary data set from a logistic regression model?I need to manipulate parameters and so obtain my set of data. I want to show the improve in analyzing binary data with GLM(binomial) model instead of classical ANOVA or NON-MODELS procedures(relative risk-odds ratio-Pearson test of godness of fit...) Can you say me what is the right function to use? Do you know any interesting simulation in the web? Thank you. Michele. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Source package installation for WinXPpro
On Thu, 9 Oct 2003 [EMAIL PROTECTED] wrote: Hi I d like to compile the source code from last Affy package for WinXPpro under R18beta however the doc is pretty poor regarding this process... Or possibly you have failed to find the documentation. I went to FAQ R Win then to http://www.stats.ox.ac.uk/pub/Rtools/ and downloaded in The essentials, tools and Perl 5.8.0, then MingW from www.mingw.org and I wonder if I need any other stuff from this page ? I m not sure but I dont think I need the cross-conpilers ? what about the others below ? Then I installed MingW and Perl. Then what am i suposed to do? Read the documentation, starting with file readme.packages in the R distribution. If I click on Rcmd I dont get any windows to open or just for a second... And where in the documentation does it tell you to do that? -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] [R-pkgs] new package: segmented
A few days ago I uploaded to CRAN a new package called segmented. The package contains functions to fit (generalized) linear models with `segmented' (or `broken-line' or `piecewise linear') relationships between the response and one or more explanatory variables according to methodology described in Muggeo VMR (2003), Estimating regression models with unknown break-points, Statistics in Medicine, 22, 3055-3071. I would be very grateful for comments and suggestions, best, vito ___ R-packages mailing list [EMAIL PROTECTED] https://www.stat.math.ethz.ch/mailman/listinfo/r-packages __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] run R under unix
One can run R 'txt', script files thusly: 1. create the txt file (foo.txt) script. 2. at a command prompt type : R --vanilla foo.txt foo.results The file 'foo.results' will now have all the output that you normally would see on the screen. This is actually quite useful in that you can move around freely within foo.results (using some sort of text editor) - unlike results written to a screen. This will only run while you are logged into the machine, however. The best way to run a script without having to be logged in is through a batch processor. Indeed, for jobs running for days - your system administrator will be thrilled that it runs on the batch processor instead of interactively. The method for doing this depends on your particular unix machine configuration, but a common method flow like this: 1. Place the line: R --vanilla foo.txt foo.results into a file named foo.batch. No other text should be in the file. Make this file executable via chmod 755 foo.batch Then at the command line: at -f foo.batch now or perhaps, batch -f foo.batch If this does not work, ask your system administrator how to set up a batch process. The advantage of the batch process is 1) you need not be logged in, 2) your job will take a lower priority than interactive jobs. Michaell On Thu, 2003-10-09 at 01:52, Jason Turner wrote: Zhen Pang wrote: ... I now want to run the code under unix. However, I do not know how to run this code in txt file under unix. I just log in to the unix and enter the R, what should I do next? One more question is: if I log off my computer when R is running under unix (i.e., disconnect my computer from server), will I get the result when I log in my computer next time? ... You'll lose it if you run R in the normal, interactive way. Running it in the background will allow you to log out and still have it running, but! 1) If you're not the only person using this machine, you learn the command nice before you begin. 2) I'm not certain you'll be able to produce jpeg or png graphics when backgrounded; your backgrounded task needs access to the windowing system for graphics rendering, and local security policy might prohibit this. 3) Save early, save often. You probably already know that, but it bears repeating. Here are some suggested steps to run your simulation in background mode. Unfortunately, the exact commands will depend on which version of Unix you're using, and what command shells are available. Consult your local expert. 1) transfer the text file of commands to the unix machine. FTP, using ASCII mode is safest. 2) log onto the Unix machine. 3) run sh, ksh, or bash. (the syntax for what follows is different for the C shell, and I don't know it). 4) using a stripped-down version of your script which will complete in a short time (say, a minute or two), just to check that things work, type nohup nice 15 R my.small.script my.output 21 (again, learn what nice means before you use it. This may not be suitable, and it's impossible for me to tell from here if it is). I know that's not the full answer, but only someone who knows the local setup can give you that answer. Cheers Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Source package installation for WinXPpro
You need to make sure that all the tools are in your path, with the R tools before perl and mingw. Set this by right clicking My Computer, then properties, advanced, environment variables, then edit the path in the system variables window. Once you have done that, you should be able to download the sources (put them in a folder where the path doesn't contain spaces. In addition, it is best if R is in a path that doesn't contain spaces (so C:\Program Files\Rw1080 is not ideal. I usually install in C:\Rw1080, but do what you like.) Next, open a command prompt. Start menu, run, type cmd, enter. Then cd to the folder where the affy.tar.gz resides and type 'tar xvfz affy*gz' without the quotes. After everything is untarred and unzipped, cd to Rw1080\bin and type 'rcmd install path to affy folder'. Windows is case insensitive (mostly), so you don't need to capitalize. You should then see a bunch of stuff happening, hopefully none of which contains an error message. If something doesn't work, re-read Brian Ripley's page on compiling. You can also get good information by downloading the R-1.8.1 tarball and looking for the readme-packages file. HTH, Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 [EMAIL PROTECTED] 10/09/03 06:53 AM Hi I d like to compile the source code from last Affy package for WinXPpro under R18beta however the doc is pretty poor regarding this process... I went to FAQ R Win then to http://www.stats.ox.ac.uk/pub/Rtools/ and downloaded in The essentials, tools and Perl 5.8.0, then MingW from www.mingw.org and I wonder if I need any other stuff from this page ? I m not sure but I dont think I need the cross-conpilers ? what about the others below ? Then I installed MingW and Perl. Then what am i suposed to do? If I click on Rcmd I dont get any windows to open or just for a second... thanks for your help Philippe [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Under dispersion; Was: [R] binomial glm warnings revisited
Dear all, I have this problem with my data. In a GLM, I have 269 zeroes and only 1 one: During profiling, you may be pushing one of the parameter near the extremes and get a model where the fitted p's are very close to 0/1. I just want to clarify that the warning was given already when I fitted the glm(): dbh- glm(MPext ~ dbh, maxit = 100, family = binomial, data = valkdat) Warning message: fitted probabilities numerically 0 or 1 occurred in: (if ( (As you can see I had to increase maxit for th algorithm to converge.) A summary: summary(dbh) Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.1659 3.8781 0.0430.966 dbh -0.5872 0.5320 -1.1040.270 Null deviance: 13.1931 on 269 degrees of freedom Residual deviance: 9.9168 on 268 degrees of freedom AIC: 13.917 drop1(dbh, test = Chisq) Df Deviance AIC LRT Pr(Chi) none 9.9168 13.9168 dbh 1 13.1931 15.1931 3.2763 0.07029 . And then CI: confint(dbh) Waiting for profiling to be done... 2.5 % 97.5 % (Intercept) -6.458119 10.12380773 dbh -2.253015 -0.05047997 There were 17 warnings (use warnings() to see them) BUT, note the under dispersion. I GUESS it is because I have surveyed a moss on marked trees at three occations (with two years in between). The response 1 means that the moss has disappeared, and dbh is tree diameter. (This corresponds to revisitng patients who has a disease, and whose weight is unchanged between the visits. H0: weight does not affect tha chance of recovery from the disease) Here is a version with quasibinomial: dbh- glm(MPext ~ dbh, maxit = 100, family = quasibinomial, data = valkdat) Note, no warning. summary(dbh) Estimate Std. Error t value Pr(|t|) (Intercept) 0.1659 1.7179 0.097 0.9231 dbh -0.5872 0.2357 -2.491 0.0133 * (Dispersion parameter for quasibinomial family taken to be 0.1962275) Null deviance: 13.1931 on 269 degrees of freedom Residual deviance: 9.9168 on 268 degrees of freedom AIC: NA Number of Fisher Scoring iterations: 11 confint(dbh) Waiting for profiling to be done... 2.5 % 97.5 % (Intercept) -2.970644 3.9019555 dbh -1.158646 -0.2131936 drop1(dbh, test = Chisq) Df Deviance scaled dev. Pr(Chi) none 9.9168 dbh 1 13.1931 16.6966 4.386e-05 *** Note, no warning. I guess that this quasibinomial model is more reliable than the binomial. Now I can trust the SE of the Estim. too, can't I? (Under dispersion has not been discussed on the list except for a reply by Prof. Ripley on a Poisson model question.) That's not necessarily a sign of unreliability -- the procedure is to set one parameter to a sequence of fixed values and optimize over the other, and it might just be the case that the optimizations have been wandering a bit far from the optimum. (I'd actually be more suspicious about the fact that the name of the predictor suddenly changed) :D However, if you have only one 1 you are effectively asking whether one observation has a different mean than the other 269, and you have to consider the sensitivity to the distribution of the predictor. As far as I can see, you end up with the test of the null hypothesis beta==0 being essentially equivalent to a two sample t test between the mean of the 0 group and that of the 1 group, so with only one observation in one of the groups, the normal approximation of the test hinges quite strongly on a normal distribution of the predictor itself. Thanks for this interesting point of view. Sincerely, Tord -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 --- Tord Snäll Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University Villavägen 14 SE-752 36 Uppsala, Sweden Tel: 018-471 28 82 (int +46 18 471 28 82) (work) Tel: 018-25 71 33 (int +46 18 25 71 33) (home) Fax: 018-55 34 19 (int +46 18 55 34 19) (work) E-mail: [EMAIL PROTECTED] Check this: http://www.vaxtbio.uu.se/resfold/snall.htm! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] simulate binary data from a logistic regression model
On 9 Oct 2003 at 11:38, Michele Grassi wrote: Here is one way of doing it: x - rnorm(1000) beta - 1 p - 1/(1+exp(-beta*x)) o - order(x) plot( x[o], p[o], ylim=c(0,1), type=l) y - rbinom(1000, 1, prob=p) model - glm(y ~ x , family=binomial) summary(model) . . . B - 1000 # number of simulation replications coefs - matrix(0, B, 2) for (i in 1:B) { +coefs[i, ] - coef(glm(rbinom(1000,1,prob=p) ~ x, family=binomial)) + } hist( coefs[,1]) hist(coefs[,2]) plot(coefs) Kjetil Halvorsen Hi. How can i simulate a binary data set from a logistic regression model?I need to manipulate parameters and so obtain my set of data. I want to show the improve in analyzing binary data with GLM(binomial) model instead of classical ANOVA or NON-MODELS procedures(relative risk-odds ratio-Pearson test of godness of fit...) Can you say me what is the right function to use? Do you know any interesting simulation in the web? Thank you. Michele. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Correlations
On Thu, 9 Oct 2003, Bobbie van der Westhuizen wrote: Hi I am trying out R for the first time and it seems to work nice. I also try it out on a LINUX platform aswell as on Windows. I downloaded the new version of R for windows (version 8.1.0) but something look not right in the calculations of correlations between traits when I use the next command: cor(fc,use=pairwise) The correlation return between the same trait (that must be 1.000) is not 1 and sometimes it is 0.37?? When I run the same scrip with the same data in Linux the correlation is correctly, 1.000. And when I run the following scrip in 1.8.0 for windows it returns the correct correlation of 1.000. cor.test(BIRHTMASS,BIRHTMASS,na.rm=T,method=pearson) Could there be a bug in this version of Windows? Given that R 1.8.0 (sic) for Windows is not yet on CRAN, there is at least a bug in your description, and undoubtedly there are bugs in Windows. If you want to discuss a bug in R, please consult the FAQ and provide proper version information and a reproducible example. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: Under dispersion; Was: [R] binomial glm warnings revisited
Tord Snall [EMAIL PROTECTED] writes: Null deviance: 13.1931 on 269 degrees of freedom Residual deviance: 9.9168 on 268 degrees of freedom AIC: 13.917 ... BUT, note the under dispersion. I GUESS it is because I have surveyed a moss on marked trees at three occations (with two years in between). The response 1 means that the moss has disappeared, and dbh is tree diameter. (This corresponds to revisitng patients who has a disease, and whose weight is unchanged between the visits. H0: weight does not affect tha chance of recovery from the disease) Don't trust deviances as measures of dispersion with binary data! Here is a version with quasibinomial: ... Note, no warning. I guess that this quasibinomial model is more reliable than the binomial. Now I can trust the SE of the Estim. too, can't I? No. Neither nor. With binary data, the deviance is purely a function of the fitted parameters. It is the difference in -2 log L between a perfect fit and the observed fit. A perfect fit has a zero prob. where the obs is 0 and probability 1 where it is 1, and L == 1 identically in that case. Now consider the likelihood for the complete toss-up i.e. intercept and slope both equal to 0 so all probabilities are 0.5. The likelihood in that case is 0.5^269, i.e. a constant. Take logarithms and notice that the model deviance plus the change in deviance from the model to the toss-up model is constant (2*269*log(2) to be precise). So what appears to be a measure of residual error is really just a measure of how far the fitted probabilities are from 0.5! -- 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://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] robust standard error
On Thu, 9 Oct 2003 13:26:57 +0200 daniele\.frison [EMAIL PROTECTED] wrote: How can I do a Multiple Linear Regression Models with robust standard error? Thank in advance. D.F. One way: install.packages('Hmisc'); install.packages('Design') library(Design) f - ols(y ~ x1 + , x=T, y=T) g - robcov(f) # or bootcov to use bootstrap s.e.'s --- Frank E Harrell JrProfessor and ChairSchool of Medicine Department of BiostatisticsVanderbilt University __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] nlme lme for complex mixed ANOVAs
The short answer is yes. The longer answer is the lme function in the nlme package uses a compact representation of the model matrices for a mixed-effects model. It is a sparse matrix representation that is specific to cases of strictly nested random effects when there is more that one level of random effects. In your case it seems that there will only be random effects for animal and the sparse matrix representation would apply. You may find that the version of lme in the experimental lme4 package is faster than the version in nlme. David Airey [EMAIL PROTECTED] writes: I downloaded R for the first time yesterday, in the hopes that I might deal more effectively with a complex repeated measures experimental design involving inbred strains of laboratory mice. The design below, somewhat simplified, cannot be computed with standard ANOVA, because something called the X'X matrix is too large. The design has the following factors: Between-subject factors (levels): inbred mouse strain (20, twenty) sex (2) Animals: 10 per sex*strain combination (400 total) Within-subject factors: drug (3) trial set (4) stimulus characteristic 1 (2) stimulus characteristic 2 (2) My question for the R community is, does R have in nlme or lme the ability to compute this problem on a typical desktop PC? In Stata, for instance, which has a matrix size limit of 11,000, the problem above will not fit, using standard ANOVA. Matrix size can be determined by listing all the terms of the full model and multiplying the levels of each factor withing a term and summing all terms. I said simplified in the first paragraph above, because if I include the day of drug challenge, the model oversteps the number of within-subject factors allowed. So, surprisingly to me, Stata/SE, which I bought for large data sets, is too small! Not that I don't like Stata, but I am annoyed that I must find another tool to use. I understand that SAS Proc Mixed will compute the problem, because it may handle the covariance matrix in some kind of piecemeal fashion (perhaps by animal but I've no confirmation of this, except that it zips through a comparable data set on someone else's computer). However, I am running Apple OS X and don't have SAS on my machine. I don't really understand what's going on underneath these programs respective hoods, but my question here is whether R computes mixed models in such a way as to require a matrix size like Stata or like SAS, when mixed models of this size are presented? Sincerely, -Dave __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Douglas Bates[EMAIL PROTECTED] Statistics Department608/262-2598 University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Partly successful build on Alpha/Tru64 UNIX 5.1
Dear all, I'd like to share my experiences in building R 1.8.0 on an Alpha/Tru64 UNIX 5.1 machine. I used the following modifications in file config.site: CC=cc F77=f77 CXX=c++ MAKE=gmake with these settings I was able to successfully run ./configure MAKE=gmake I had to manually unpack the files insrc/library/recommended to get gmake running through the end (otherwise gmake complained about a missing method for survival). Everything worked fine then. gmake check produces three errors inarith.R . All of these errors are due to an occurrence of a -0 instead of 0. Unfortunately gmake check stops here, with gmake check FORCE=FORCE yielding the same result. gmake install runs without problems. Best regards, Jörg Polzehl Dr. Jörg Polzehl WIAS, Mohrenstr. 39 D-10117 Berlin, Germany email: [EMAIL PROTECTED] Tel. +49 30/20372 481 Fax: +49 30/2044975 WWW: http://www.wias-berlin.de/people/polzehl __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: Under dispersion; Was: [R] binomial glm warnings revisited
Dear all, BUT, note the under dispersion. I GUESS it is because I have surveyed a moss on marked trees at three occations (with two years in between). The response 1 means that the moss has disappeared, and dbh is tree diameter. (This corresponds to revisitng patients who has a disease, and whose weight is unchanged between the visits. H0: weight does not affect tha chance of recovery from the disease) Don't trust deviances as measures of dispersion with binary data! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] startup file and lambda
Hi,s there a .Rrc file? so that when R starts up it automatically loads this file? I am interested in putting in some matlab-like functions names I am very use to. for example: ans=.Last.value etc __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] startup file and lambda
See ?Startup. Andy -Original Message- From: christoff pale [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 10:40 AM To: [EMAIL PROTECTED] Subject: [R] startup file and lambda Hi,s there a .Rrc file? so that when R starts up it automatically loads this file? I am interested in putting in some matlab-like functions names I am very use to. for example: ans=.Last.value etc __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] dyn.load error with C file
Re-sending this from 10/7. Please help! I'm really clueless how to fix this: System: Solaris 7, Software: R_1.7.1 for unix R CMD INSTALL -l /Rdir/library haplo.stats_1.1.0.tar.gz -works like a charm-- no syntax errors, etc But problems are when I'm loading the library within R. library(haplo.stats, lib.loc=/people/biostat3/sinnwell/Rdir/library) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library /people/biostat3/sinnwell/Rdir/library/haplo.stats/libs/haplo.stats.so: ld.so.1: /opt/tools/R/current-version/lib/R/bin/R.bin: fatal: relocation error: file /people/biostat3/sinnwell/Rdir/library/haplo.stats/libs/haplo.stats.so: symbol errmsg: referenced symbol not found Error in library(haplo.stats, lib.loc = /people/biostat3/sinnwell/Rdir/library) : .First.lib failed Within my package I have three C files, one of which I believe is causing the dynamic library error below. When I leave out this one C file when building the package, though remaining R-functions depend on it, the library loads beautifully. We use all Calloc and Free for double-compatibility with S, so memory allocation is fine. Is there some issue with C and R that I'm not aware of? FYI: We have the whole haplo.stats package working in S, INCLUDING that C-file Also, zzz.R for haplo.stats package: .First.lib - function(lib, pkg) { library.dynam(haplo.stats, pkg, lib) } Has anyone dealt with anything similar to this? I see some similar Fortran error messages... Thank you for your help, Jason - Jason P. Sinnwell, M.S. Mayo Clinic, Rochester Health Sciences Research Division of Biostatistics 507.284.3270 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] startup file and lambda
On Thu, Oct 09, 2003 at 07:39:58AM -0700, christoff pale wrote: Hi,s there a .Rrc file? so that when R starts up it automatically loads this file? ?Startup will tell you everything you want to know - especially bout the .Rprofile file. cu Philipp -- Dr. Philipp PagelTel. +49-89-3187-3675 Institute for Bioinformatics / MIPS Fax. +49-89-3187-3585 GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1 85764 Neuherberg, Germany __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] anonymous access to the R CVS archive
Thanks to John Eaton of the Octave project we now have anonymous CVS access to (a copy of) the R archive. See http://anoncvs.r-project.org/ ___ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-announce __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] upgrading R
Hi, I have installed a lot of extra packages for R 1.7.1. If I install R 1.8.0, will I have to reinstall all those packages? Is there a way that I can upgrading R without losing old packages? Thank you. wz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] curious mistake in tkradiobutton
Hello, the following code produces an error when executing it, it is a code that produces 6 checkbutton that at the beginning are empty, when selecting the first checkbox he says that doesn't know the second variable tcl, he say: [1] 1 Error in structure(.External(dotTcl, ..., PACKAGE = tcltk), class = tclObj) : [tcl] can't read ::RTcl2: no such variable. when six variables tcl has been created in the array b and they exist: b [1] ::RTcl1 ::RTcl2 ::RTcl3 ::RTcl4 ::RTcl5 ::RTcl6 the script is(I'm use R 1.7.1 for win): library(tcltk) tt-tktoplevel() f-tkframe(tt) tkpack(f) j-6 nbre-c(c1,c2,c3,c4,c5,c6) b-c() i-1 while (i=j){ aux-paste(b,i,sep=) aux-tclVar(init=0) b-c(b,as.character(aux)) tclvalue(b[i])-0 i-i+1 } i-1 while (i=j){ t-tkcheckbutton(f,text=nbre[i],variable=eval(b [i]),relief=raised,command=function()ver()) tkpack(t) i-i+1 } ver-function(){ k-1 while (k=j){ print(tclvalue(b[k])) k-k+1 } } any help will be welcome. Thank you Ruben __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Fitting AR(p) models
I am wanting to fit AR(p) models to column data for a series of matrices I have. Rather than trying to compute the AR models per column I was hoping to be able to do this per matrix (i.e. one AR model for each column in said matrix). However, when i attempt this, if there is just one NA value in any of the columns, the program refuses to compute AR models for any of the columns.(I am using na.action=na.omit) Is there a way I can force the calculation to provide AR models for complete columns, or alternatively, a better way to deal with NA's to provide an AR model, (eg via interpolation?) despite some missing values? I hope this makes some sense, thanks in advance, Laura __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Getting rows from a dataframe
On Thu, 2003-10-09 at 12:02, Mark Lee wrote: Sorry if this is a silly question. I'm trying to extract all elements of a dataframe at a particular row. I can find no mention of this in any documentation and it may be naivety of dataframe on my part as I'm very green at this. Thankyou, If d is your data.frame then d[ 1, ] will give all the columns coresponding to row 1 in a data.frame d - read.table('data') class(d) [1] data.frame x - d[1,] class(x) [1] data.frame HTH --- Rajarshi Guha [EMAIL PROTECTED] http://jijo.cjb.net GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- A red sign on the door of a physics professor: 'If this sign is blue, you're going too fast.' __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] upgrading R
I am not sure if this is a proper way, but here is what I did recently installing consecutive alpha and beta releases of 1.8.0 on a Win2000 machine: (1) I uninstalled previous version using the uninstall provided with R. This leaves all the additional packages in the library folder (2) I reinstalled the new version into the same folder structure. The problem might be that some 1.7.1 packages might be different from 1.8.0, so it might be safer to reinstall them from CRAN. Andy __ Andy Jaworski Engineering Systems Technology Center 3M Center, 518-1-01 St. Paul, MN 55144-1000 - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 |-+ | | Weiming Zhang | | | [EMAIL PROTECTED]| | | edu | | | Sent by: | | | [EMAIL PROTECTED]| | | ath.ethz.ch | | || | || | | 10/09/2003 10:38 | | || |-+ -| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: [R] upgrading R | -| Hi, I have installed a lot of extra packages for R 1.7.1. If I install R 1.8.0, will I have to reinstall all those packages? Is there a way that I can upgrading R without losing old packages? Thank you. wz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] dyn.load error with C file
On Thu, 9 Oct 2003, Jason Sinnwell wrote: Re-sending this from 10/7. Please help! I'm really clueless how to fix this: Your code calls the C entry point errmsg, and that is not in the R binary. So find out what library it is in and link against it. NB: it does not show up on our Solaris 8 system at a quick look. I think the error message is pretty explicit, so maybe you need to take local advice about your C code. System: Solaris 7, Software: R_1.7.1 for unix R CMD INSTALL -l /Rdir/library haplo.stats_1.1.0.tar.gz -works like a charm-- no syntax errors, etc But problems are when I'm loading the library within R. library(haplo.stats, lib.loc=/people/biostat3/sinnwell/Rdir/library) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library /people/biostat3/sinnwell/Rdir/library/haplo.stats/libs/haplo.stats.so: ld.so.1: /opt/tools/R/current-version/lib/R/bin/R.bin: fatal: relocation error: file /people/biostat3/sinnwell/Rdir/library/haplo.stats/libs/haplo.stats.so: symbol errmsg: referenced symbol not found Error in library(haplo.stats, lib.loc = /people/biostat3/sinnwell/Rdir/library) : .First.lib failed Within my package I have three C files, one of which I believe is causing the dynamic library error below. When I leave out this one C file when building the package, though remaining R-functions depend on it, the library loads beautifully. We use all Calloc and Free for double-compatibility with S, so memory allocation is fine. Is there some issue with C and R that I'm not aware of? FYI: We have the whole haplo.stats package working in S, INCLUDING that C-file Also, zzz.R for haplo.stats package: .First.lib - function(lib, pkg) { library.dynam(haplo.stats, pkg, lib) } Has anyone dealt with anything similar to this? I see some similar Fortran error messages... Thank you for your help, Jason - Jason P. Sinnwell, M.S. Mayo Clinic, Rochester Health Sciences Research Division of Biostatistics 507.284.3270 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Getting rows from a dataframe
Mark Lee wrote: Sorry if this is a silly question. I'm trying to extract all elements of a dataframe at a particular row. I can find no mention of this in any documentation and it may be naivety of dataframe on my part as I'm very green at this. Thankyou, Mark __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help dat - data.frame(var1 = c(1:10), var2 = c(31:40), var3 = c(6:15)) dat[1, ] #extract 1st row dat[1:4, ] #extract rows 1 through 4 dat[c(1,3,5,7,9), ] #extract named non-consecutive rows dat[ ,1] # extract 1st column ... etc It's in 'An Introduction to R' that should have come with your distribution, or in the manuals section of the r website: http://www.r-project.org HTH -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] [EMAIL PROTECTED] UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
AW: [R] Getting rows from a dataframe
Df[x, ] Read 'an introduction to R' and 'FAQ' -Ursprüngliche Nachricht- Von: Mark Lee [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 9. Oktober 2003 18:02 An: [EMAIL PROTECTED] Betreff: [R] Getting rows from a dataframe Sorry if this is a silly question. I'm trying to extract all elements of a dataframe at a particular row. I can find no mention of this in any documentation and it may be naivety of dataframe on my part as I'm very green at this. Thankyou, Mark __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
AW: [R] Getting rows from a dataframe
I have this right on the desk in front of me. I have gone through most of this actually and have been looking for the answer for several weeks now before resorting to this. The only reference I've found to this is on page 20 under array indexing but didn't see the relation to dataframes. Thanks, Mark __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R-OpenOffice.org Calc
I have been very satisfied with R-Excel interface (DCOM). Few months ago I have changed my OS to Linux-Mandrake, and now I am using OpenOffice.org Calc as spreadsheet. I would like to know does exist some R-OpenOffice.org interface or how is possible to use R-functions in OpenOffice.org Calc? Thanks a lot! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] plotting graphs with Rterm
Eric ESPOSITO wrote: Hello, I need to execute R code contained in a file xxx.R from DOS. The file is really simple, only: plot(rnorm(100)) You have to specify the windows() device explicitly, if you are in non-interactive mode: windows() plot(rnorm(100)) When I launch Rterm from Dos command and then source the file xxx.R it works, but I need to call the command from a DOS command file *.bat Using Rterm --slave xxx.R plots the graph in a postscript file Rplots.ps, how can I do to get the graph in an R window. Using a command windows() or win.graph() in the R file does not work any more. I have the same problem with tk widgets. If the file xxx.R is: library(tcltk) tt-tktoplevel() The widget does not appear on the screen. It appears! I guess your R process has finished right after those lines and the window has been shut before you have seen it. Uwe Ligges Does anybody can help? Regards, Eric __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Automatic re-looping after error
Hi Folks, I'm seeking advice about how to resume an outer loop following failure of a function within the loop (which issues an error message). Essentially, I'm repeating (simulating) a process which involves random sampling, EM and MCMC. I'm walking on very edge of rather thin ice -- data rather thinly spread over many parameters! Occasionally some component of the loop fails, with an error message. At this point, R quits the run altogether and returns to the command prompt. I then have to restart the whole script. All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) do it? Any other suggestions? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 09-Oct-03 Time: 18:03:37 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: AW: [R] Getting rows from a dataframe
If you're having so much trouble, perhaps it's because you want to get a vector result? This requires a little more, and if so, perhaps one of the following provides what you are looking for: x - data.frame(a=1:3,b=4:6) # row as a data frame x[2,] a b 2 2 5 # row as a list x[2,,drop=T] $a [1] 2 $b [1] 5 # row as a vector unlist(x[2,,drop=T]) a b 2 5 # row as a vector again unlist(x[2,]) a b 2 5 # row as a matrix (if x contains any non-numeric columns, this will be a character matrix) as.matrix(x[2,]) a b 2 2 5 # row as a vector (if x contains any non-numeric columns, this will be a character vector) as.matrix(x)[2,] a b 2 5 # row as a numeric vector (non-numeric columns in x will be converted to numeric data, see ?data.matrix for how) data.matrix(x[2,]) a b 2 2 5 Tony Plate At Thursday 05:40 PM 10/9/2003 +0100, Mark Lee wrote: I have this right on the desk in front of me. I have gone through most of this actually and have been looking for the answer for several weeks now before resorting to this. The only reference I've found to this is on page 20 under array indexing but didn't see the relation to dataframes. Thanks, Mark __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
Have you considered try? hope this helps. spencer graves (Ted Harding) wrote: Hi Folks, I'm seeking advice about how to resume an outer loop following failure of a function within the loop (which issues an error message). Essentially, I'm repeating (simulating) a process which involves random sampling, EM and MCMC. I'm walking on very edge of rather thin ice -- data rather thinly spread over many parameters! Occasionally some component of the loop fails, with an error message. At this point, R quits the run altogether and returns to the command prompt. I then have to restart the whole script. All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) do it? Any other suggestions? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 09-Oct-03 Time: 18:03:37 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Getting rows from a dataframe
Suppose foo.frame is your dataframe. Use foo.frame[j,] to extract all of the elements in the jth row of foo.frame. Also, you should get two excellent books that will help your learning process: The Basics of S and Splus, by Krause and Olsen, Third Edition, Springer-Verlag Modern Applied Statistics with S, by Venables and Ripley, Fourth Edition, Springer-Verlag Krause Olsen's book is the more elementary of the two. Venables and Ripley will get you to the point where you can productively use R/Splus for statistical analyses. Hope this helps. Best, david paul -Original Message- From: Mark Lee [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 12:02 PM To: [EMAIL PROTECTED] Subject: [R] Getting rows from a dataframe Sorry if this is a silly question. I'm trying to extract all elements of a dataframe at a particular row. I can find no mention of this in any documentation and it may be naivety of dataframe on my part as I'm very green at this. Thankyou, Mark __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] New Department of Biostatistics, Multiple Job Openings
NEW DEPARTMENT OF BIOSTATISTICS The School of Medicine at Vanderbilt University is pleased to announce the creation of a new Department of Biostatistics. Vanderbilt has made a major new funding commitment to build a world-class department. Chaired by Frank E. Harrell, Jr., the new department has exceptional institutional support from a medical center that is currently 16th in U.S. News and World Report's 2002 rankings of research-oriented medical schools, and has seen a sharp rise in NIH and other grant funding. The Vanderbilt School of Medicine has a strong basic, clinical, and health services research program. The Dean and other senior medical school faculty are committed to providing outstanding collaborative support in biostatistics to clinical and basic scientists and to developing a graduate program in biostatistics that will train outstanding collaborative scientists and will focus on the methods of modern applied statistics. The department currently has 9 PhD faculty members and plans to double in size over the next two years, continuing to add a significant number of faculty and staff biostatisticians after that. Besides a graduate program, a statistical data coordinating center will be created. We are excited about the future and seek outstanding biostatisticians who will help us to bring our goals to fruition. POSITIONS AVAILABLE AT ALL LEVELS There are openings at all levels: full professor, associate professor, assistant professor, senior and junior M.S. biostatistician, statistical programmers knowledgeable about tools such as R, S-Plus, and LaTeX, and data managers. We are especially seeking individuals with expertise in clinical trials, health services research, Bayesian methods, statistical methods in epidemiology, multicenter clinical trial data management, clinical safety assessment for pharmaceutical trials, and modern statistical computing. Applicants for PhD or MS biostatistician positions must have degrees in Biostatistics or have graduate degrees in Statistics with significant experience in clinical research or health services/outcomes research. Vanderbilt University is an independent, privately supported, university with an enrollment of 10,800 undergraduate, graduate, and professional students. The medical center is located within the main campus on 330 acres near downtown Nashville, Tennessee. Faculty and staff at the university receive excellent fringe benefits, including health, dental, life, and disability insurance, a tax deferred contributory retirement plan, and generous tuition assistance for dependents. Nashville is a pleasant metropolitan area of approximately 1.2 million residents. A wide variety of cultural activities are available, especially for music lovers. Nashville is famous as the home of country and western music. In addition, as a recording center for the music industry, the city draws many excellent rock, jazz, and classical artists. Sports fans will appreciate the Tennessee Titans (football), Nashville Predators (ice hockey), Nashville Sounds (AAA baseball), and numerous intercollegiate sporting events. There are many parks in the area, including the largest in-city park in the United States. Nashville also provides easy access to recreational areas for hiking, bicycling, water sports, and other outdoor activities. All candidates must enjoy collaborative research and possess excellent written and verbal communication skills. Send CV to [EMAIL PROTECTED] or to Search Committee, Biostatistics, S-2323 MCN, Vanderbilt University, Nashville, TN 37232-2158. Vanderbilt University is an equal opportunity/affirmative action employer; all qualified persons are encouraged to apply. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Specifying suitable PC to run R
If I am buying a PC where the most compute intensive task will be running R and I do not have unlimited resources what trade-offs should I make? Specifically should I go for 1 - more memory, or 2 - faster processor, or 3 - something else? If it makes a difference I shall be running Windows on it and I am thinking about getting a portable which I understand makes upgrading more difficult. Extra background: the tasks I notice going slowly at the moment are fitting models with lme which have complex random effects and bootstrapping. By the standards of r-help posters I have small datasets (few thousand cases, few hundred variables). In order to facilitate working with colleagues I need to stick with windows even if linux would be more efficient Michael Dewey [EMAIL PROTECTED] http://www.aghmed.fsnet.co.uk/home.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Specifying suitable PC to run R
On Windows, I find that having as much memory as I can possibly afford makes a real difference with R. Since I always end up having larger datasets/problems then I thought I'd have. My general strategy is to maximize the amount of memory first -- if that doesn't work, then think about getting a faster processor. -roger Michael Dewey wrote: If I am buying a PC where the most compute intensive task will be running R and I do not have unlimited resources what trade-offs should I make? Specifically should I go for 1 - more memory, or 2 - faster processor, or 3 - something else? If it makes a difference I shall be running Windows on it and I am thinking about getting a portable which I understand makes upgrading more difficult. Extra background: the tasks I notice going slowly at the moment are fitting models with lme which have complex random effects and bootstrapping. By the standards of r-help posters I have small datasets (few thousand cases, few hundred variables). In order to facilitate working with colleagues I need to stick with windows even if linux would be more efficient Michael Dewey [EMAIL PROTECTED] http://www.aghmed.fsnet.co.uk/home.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
On Thursday 09 October 2003 19:03, Ted Harding wrote: Hi Folks, I'm seeking advice about how to resume an outer loop following failure of a function within the loop (which issues an error message). Essentially, I'm repeating (simulating) a process which involves random sampling, EM and MCMC. I'm walking on very edge of rather thin ice -- data rather thinly spread over many parameters! Occasionally some component of the loop fails, with an error message. At this point, R quits the run altogether and returns to the command prompt. I then have to restart the whole script. All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) do it? Any other suggestions? Look at try(). hth, Z With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 09-Oct-03 Time: 18:03:37 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
On Thursday 09 October 2003 19:03, Ted Harding wrote: Hi Folks, I'm seeking advice about how to resume an outer loop following failure of a function within the loop (which issues an error message). Essentially, I'm repeating (simulating) a process which involves random sampling, EM and MCMC. I'm walking on very edge of rather thin ice -- data rather thinly spread over many parameters! Occasionally some component of the loop fails, with an error message. At this point, R quits the run altogether and returns to the command prompt. I then have to restart the whole script. All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) do it? Argh, didn't read carefully enough, sorry. Usually, I would expect from your description that try() would be good enough. You can try() the critical functions inside the loop and modify the actions inside the loop accordingly if something goes wrong... Z Any other suggestions? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 09-Oct-03 Time: 18:03:37 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Automatic re-looping after error
On Thu, 9 Oct 2003 [EMAIL PROTECTED] wrote: All that's really needed to cope with the situation is for R to drop that cycle of the loop, and resume with a new cycle. However, I'm wondering how to set this up. I've had a look at try(), and I'm not at all sure that it does what I would want. What I'd really like is something (inside the loop) on the lines of on.error(maybe some parameters X) break where X might specify what sort of error or what function it comes from. Would setting options(error = break ) I don't think so. You may need to look at the new exception-handling code (start with help(tryCatch)). -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Indexing Question
I have an indexing question. I have a data set that looks like this: b [[1]] [1] 22 23 24 25 26 [[2]] [1] 6 7 8 9 NA etc. from [[1]] to [[1000]] Then I need to use the sample function to take two samples from b[[1]] to b[[1000]] each separately. I thought something like sample(na.omit(b[[1:1000]]),2,replace=TRUE) would work but it doesn't. Is there a way to index this properly?? Thanks, Nathan _ Add MSN 8 Internet Software to your existing Internet access and enjoy patented spam protection and more. Sign up now! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R-OpenOffice.org Calc
Branimir K. Hackenberger wrote: I have been very satisfied with R-Excel interface (DCOM). Few months ago I have changed my OS to Linux-Mandrake, and now I am using OpenOffice.org Calc as spreadsheet. I would like to know does exist some R-OpenOffice.org interface or how is possible to use R-functions in OpenOffice.org Calc? I think all you need to do is download the SDK: http://www.openoffice.org/dev_docs/source/sdk/index.html then read and understand both the 900 page OpenOffice SDK manual, and everything there is to know about R internals. Then write an extension for OpenOffice Calc that uses UNO to communicate between Calc and the R library. You'll probably have to use C++. The spreadsheet section of the SDK doc starts at page 535, by the way... Or is there a quicker way? Baz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Indexing Question
Nathan Cooper [EMAIL PROTECTED] writes: I have an indexing question. I have a data set that looks like this: b [[1]] [1] 22 23 24 25 26 [[2]] [1] 6 7 8 9 NA etc. from [[1]] to [[1000]] Then I need to use the sample function to take two samples from b[[1]] to b[[1000]] each separately. I thought something like sample(na.omit(b[[1:1000]]),2,replace=TRUE) would work but it doesn't. Is there a way to index this properly?? Thanks, Not really. I'd try lapply(lapply(b,na.omit),sample,2,replace=TRUE) or lapply(b,function(x)sample(na.omit(x),2,replace=TRUE)) -- 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://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Indexing Question
I think what you want is lapply(b, function(x) sample(na.omit(x), 2, replace = TRUE)) -roger Nathan Cooper wrote: I have an indexing question. I have a data set that looks like this: b [[1]] [1] 22 23 24 25 26 [[2]] [1] 6 7 8 9 NA etc. from [[1]] to [[1000]] Then I need to use the sample function to take two samples from b[[1]] to b[[1000]] each separately. I thought something like sample(na.omit(b[[1:1000]]),2,replace=TRUE) would work but it doesn't. Is there a way to index this properly?? Thanks, Nathan _ Add MSN 8 Internet Software to your existing Internet access and enjoy patented spam protection and more. Sign up now! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Specifying suitable PC to run R
If you are running Windows, do you have the Performance Monitor running? This will help identify the reasons that programs are running slow. Most likely, you are low on memory and are paging a lot. I alway have it running and when I am running a large R script, if I am not using 100% of the CPU, then I must be paging (assuming that I am not reading in my data). You can also sprinkle the following function throughout your code to see how much CPU and memory you are using. I bracket all my major computational sections with it: my.stats - function(text = stats) { cat(text, -,sys.call(sys.parent())[[1]], :, proc.time()[1:3], : , round( memory.size()/2.^20., 1.), MB\n) invisible(flush.console()) } This prints out a message like: my.stats('Begin Reading') Begin Reading - my.stats : 5.61 3.77 22309.67 : 18.7 MB This says that I have used 5.61 CPU seconds of 'user' time, 3.77 CPU seconds of 'system' time and the R session has been running for 22309 seconds (I always have one waiting for simple calculation) and I have 18.7MB of memory allocated to objects. My first choice is get as much memory on your machine as you can; 1GB since this the most that R can use. I noticed a big difference in upgrading from 256M - 512M. I also watch the Performance Monitor and when memory gets low and I want to run a large job, I restart R. Most of my scripts are setup to run R without saving any data in the .Rdata file. If I need to save a large object, I do it explicitly since memory is key performance limiting factor and Windows is not that good at freeing up memory after you have used a lot of it. A faster CPU will also help, but it would be the second choice, since if you are paging, most of your time is spent on data transfer and not computation. __ James HoltmanWhat is the problem you are trying to solve? Executive Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] (513) 723-2929 Michael Dewey [EMAIL PROTECTED]To: [EMAIL PROTECTED] uk cc: Sent by: Subject: [R] Specifying suitable PC to run R [EMAIL PROTECTED] ath.ethz.ch 10/09/2003 14:04 If I am buying a PC where the most compute intensive task will be running R and I do not have unlimited resources what trade-offs should I make? Specifically should I go for 1 - more memory, or 2 - faster processor, or 3 - something else? If it makes a difference I shall be running Windows on it and I am thinking about getting a portable which I understand makes upgrading more difficult. Extra background: the tasks I notice going slowly at the moment are fitting models with lme which have complex random effects and bootstrapping. By the standards of r-help posters I have small datasets (few thousand cases, few hundred variables). In order to facilitate working with colleagues I need to stick with windows even if linux would be more efficient Michael Dewey [EMAIL PROTECTED] http://www.aghmed.fsnet.co.uk/home.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- NOTICE: The information contained in this electronic mail ...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] lattice/levelplot: panels with values can be empty
On Thursday 09 October 2003 05:40, Wolfram Fischer wrote: I tried: library(lattice) F0 - c( 'A', 'A', 'B', 'B' ) F1 - c( 1 , 1 , 1 , 2 ) F2 - c( 8 , 9 , 8 , 9 ) VAL - c( 20, 50, 10, 60 ) df - data.frame( F0, F1, F2, VAL ) levelplot( VAL ~ F1 * F2 | F0, data=df ) I got an empty field for F0 == 'A' and a colored field for F0 == 'B'. I expected two colored fields. - What can I do? Hmm, this seems to be a bug triggered when some panel has only one unique x (or y) value. Can't think of a workaround, other than adding some dummy rows with VAL = NA, e.g. F0 - c( 'A', 'A', 'B', 'B', 'A') F1 - c( 1 , 1 , 1 , 2 , 2 ) F2 - c( 8 , 9 , 8 , 9 , 8 ) VAL - c( 20, 50, 10, 60, NA ) df - data.frame( F0, F1, F2, VAL ) Deepayan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] subsetting objects
I want to be able to exctract a matrix from a data frame that contains repeated measurements for individuals. i.e I want to exctract the second observation for each individual in the study. Is there a way of doing this? I guess what I am trying to ask is if there as a multidimensional version of aggregate() as in aggregate(data, list(data[,ID]), function(x) x[2,]) but aggregate will only give back scalars. Thank you, Jean [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] run R under unix
Your Unix computer may also have screen installed. This is a multiplexing terminal that allows you to place tasks in the background, log out of them, log back into them on different machines, maintain multiple command prompts, etc., all with minimal overhead - ideal for modems. E.g. the following steps: login screen R source(mycode.R) start simulation Ctrl-a d (screen is now detached; process is running in background) exit Then on a different machine login screen -r (process is now running in foreground) Ctrl-a d (screen is now detached; process is running in background) exit You can create new screens, label them, obtain a menu, and use it to juggle numerous tasks - such as editing a source file and executing it efficiently. Refinements: use source(mycode.R, echo=T) for information about the status of your simulation. You can also easily write snippets of code to have the process email you when it's done, and run them via the system command. Locate cat commands judiciously through your code to update you on its progress. Andrew -- Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : [EMAIL PROTECTED] PO Box 441133W : http://www.uidaho.edu/~andrewr Moscow ID 83843 Or: http://www.biometrics.uidaho.edu No statement above necessarily represents my employer's opinion. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] detecting singular matrices
My colleague runs R 1.7.1 under Windows XP. He remarks: A [,1] [,2] [,3] [1,]123 [2,]456 [3,]789 b [1] 1 2 3 solve(A,b) [1] -0.333 0.667 0.000 solve(A) [,1] [,2][,3] [1,] -4.5036e+15 9.00720e+15 -4.5036e+15 [2,] 9.0072e+15 -1.80144e+16 9.0072e+15 [3,] -4.5036e+15 9.00720e+15 -4.5036e+15 eigen(A) $values [1] 1.611684e+01 -1.116844e+00 -1.303678e-15 with a condition number of 1.236260e+16 I think I'd like it to tell me it's singular like it used to :) and I know it is singular Under 1.6.0 also on XP I get solve(A,1:3) Error in solve.default(A, 1:3) : singular matrix `a' in solve solve(A) Error in solve.default(A) : singular matrix `a' in solve eigen(A) $values [1] 1.611684e+01 -1.116844e+00 -1.120190e-16 $vectors [,1][,2] [,3] [1,] -0.2719964 -0.76169140 0.3734378 [2,] -0.6159646 -0.08408654 -0.7468756 [3,] -0.9599328 0.59351831 0.3734378 Which seems to be preferable output. Murray -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Scoping Rules: Summary
Thanks to Andy Liaw, Roger Peng, Thomas Lumley, Brian Ripley and Peter Dalgaard, all of whom addressed my questions or threads arising from them. The full messages were posted to the list so this is a brief summary: Andy Liaw explained the difference between lexical and dynamic scoping and the rationale behind the choice of lexical scoping for R. Roger Peng showed how to modify fnB. Brian Ripley suggested that it is generally better to pass functions an object rather than just the name, and warned of the dangers of using get() on the result of deparse(substitute()). Thanks all Peter Alspach Original question below: I'm using R1.7.1 (Windows 2000) and having difficulty with scoping. I've studied the FAQ and on-line manuals and think I have identified the source of my difficulty, but cannot work out the solution. For the purposes of illustration. I have three functions as defined below: fnA - function(my.x) { list(first=as.character(substitute(my.x)), second=sqrt(my.x)) } fnB - function(AA) { tmp.x - get(AA$first) tmp.x^2 } fnC - function() { x - 1:2 y - fnA(x) z - fnB(y) c(x,y,z) } fnA() has a vector as an argument and returns the name of the vector and the square root of its elements in a list. fn(B) takes the result of fn(A) as its argument, gets the appropriate vector and computes the square of its elements. These work fine when called at the command line. fnC() defines a local vector x and calls fnA() which operates on this vector. Then fnB() is called, but it operates on a global vector x in GlobalEnv (or returns an error is x doesn't exist there) - but I want it to operate on the local vector. I think this is related to the enclosing environment of all three functions being GlobalEnv (since they were created at the command line), but the parent environment of fnB() being different when invoked from within fnC(). My questions: 1 Have I correctly understood the issue ? 2 How do I make fnB() operate on the local vector rather than the global one ? 3 And, as an aside, I have used as.character(substitute(my.x)) to pass the name - but deparse(substitute(my.x)) also works. Is there any reason to prefer one over the other? Thank you ... __ The contents of this e-mail are privileged and/or confidenti...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] subsetting objects
test - data.frame(ID=c(1,1,1,2,2,2),data=1:6) do.call(rbind, by(test,test$ID,function(x)x[2,]) ) --- On Thu 10/09, Jean Eid [EMAIL PROTECTED] wrote: From: Jean Eid [mailto: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Thu, 9 Oct 2003 16:06:12 -0400 Subject: [R] subsetting objects I want to be able to exctract a matrix from a data frame that contains repeated measurements for individuals. i.e I want to exctract the second observation for each individual in the study. brIs there a way of doing this? brbrI guess what I am trying to ask is if there as a multidimensional version of aggregate() as in aggregate(data, list(data[,ID]), function(x) x[2,])brbut aggregate will only give back scalars. brbrThank you, brJeanbr [[alternative HTML version deleted]]brbr__br[EMAIL PROTECTED] mailing listbrhttps://www.stat.math.ethz.ch/mailman/listinfo/r-helpbr ___ No banners. No pop-ups. No kidding. Introducing My Way - http://www.myway.com __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Fitting AR(p) models
Laura Quinn wrote: I am wanting to fit AR(p) models to column data for a series of matrices I have. Rather than trying to compute the AR models per column I was hoping to be able to do this per matrix (i.e. one AR model for each column in said matrix). However, when i attempt this, if there is just one NA value in any of the columns, the program refuses to compute AR models for any of the columns.(I am using na.action=na.omit) Is there a way I can force the calculation to provide AR models for complete columns, or alternatively, a better way to deal with NA's to provide an AR model, (eg via interpolation?) despite some missing values? Interpolation might not make sense for your data. Can't tell from here. Certainly it's quick, but it can also be pretty dirty - it over-weights those data regions. You can get around this by interpolating, then selecting a lower resolution (window with a larger deltat), and build your model from that. If the NAs are few and far between, some additional code to pick where the NAs are in each column, and build AR models from the longest continuous segment might be preferable. Apart from that, there's not much else I can add. Other takers? Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] detecting singular matrices
On Fri, 10 Oct 2003, Murray Jorgensen wrote: with a condition number of 1.236260e+16 I think I'd like it to tell me it's singular like it used to :) and I know it is singular This was found during code freeze (and I suggested to Martin that he file a bug report on it then, so that we could say Known Issue when someone reported it). Unlike the old LINPACK code the LAPACK code reports singularity only when it encounters an exactly zero pivot. This doesn't happen very often. There is another, more complicated LAPACK routine that reports an estimated condition number and reports when the matrix is singular to within working precision, and we should probably use that one instead. We need to investigate things like relative speed as well. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] RWinEdt patch
Hi: I just tried to install the patch for RWinEdt - there is an automated package ('SWinRegistry' ) which with the rwinedt patch on the CRAN site have to be loaded as packages from R using the local zip drive option. That works fine. The next step is to call the library(RwinEdt) and this does'nt work out ... the meesages i get are: install.packages(choose.files('',filters=Filters[c('zip','All'),]), .libPaths()[1], CRAN = NULL) updating HTML package descriptions install.packages(choose.files('',filters=Filters[c('zip','All'),]), .libPaths()[1], CRAN = NULL) updating HTML package descriptions install.packages(choose.files('',filters=Filters[c('zip','All'),]), .libPaths()[1], CRAN = NULL) updating HTML package descriptions library(RWinEdt) Error in testRversion(descfile) : This package has not been installed properly See the Note in ?library In addition: Warning message: package RWinEdt was built under R version 1.7.1 I am using windows office 2000 and R ver 1.7 and hence the final error message. I have tried it out on ver 1.7.1 too and i Get the same error. Was wondering if anyone else encountered this problem thanks Arnab __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] upgrading R
This has been discussed with previous upgrades. One such discussion was How to update installed packages to a new version of R?. http://finzi.psych.upenn.edu/R/Rhelp02/archive/8316.html There are a variety of methods to choose from. You may also learn about updating packages directly from the net which can take care of the issues of having to reinstall packages. _ Tom Mulholland Senior Policy Officer WA Country Health Service Tel: (08) 9222 4062 The contents of this e-mail transmission are confidential and may be protected by professional privilege. The contents are intended only for the named recipients of this e-mail. If you are not the intended recipient, you are hereby notified that any use, reproduction, disclosure or distribution of the information contained in this e-mail is prohibited. Please notify the sender immediately. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 10 October 2003 12:16 AM To: Weiming Zhang Cc: [EMAIL PROTECTED] Subject: Re: [R] upgrading R I am not sure if this is a proper way, but here is what I did recently installing consecutive alpha and beta releases of 1.8.0 on a Win2000 machine: (1) I uninstalled previous version using the uninstall provided with R. This leaves all the additional packages in the library folder (2) I reinstalled the new version into the same folder structure. The problem might be that some 1.7.1 packages might be different from 1.8.0, so it might be safer to reinstall them from CRAN. Andy __ Andy Jaworski Engineering Systems Technology Center 3M Center, 518-1-01 St. Paul, MN 55144-1000 - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 |-+ | | Weiming Zhang | | | [EMAIL PROTECTED]| | | edu | | | Sent by: | | | [EMAIL PROTECTED]| | | ath.ethz.ch | | || | || | | 10/09/2003 10:38 | | || |-+ --- --| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: [R] upgrading R | --- --| Hi, I have installed a lot of extra packages for R 1.7.1. If I install R 1.8.0, will I have to reinstall all those packages? Is there a way that I can upgrading R without losing old packages? Thank you. wz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] command line limit under unix?
Dear all, I have made my testing program to run successfully under unix in the background. However, my simulation work does not work. I read the foo.results file, I found it only have part of my code and not any output I want. Is there any line limit? My code is nearly 400 line. I can cut some of them, but I want to know whether there is any limit or exactly the number of limit is. Thanks. Regards, Pang Zhen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] command line limit under unix?
Zhen Pang wrote: I have made my testing program to run successfully under unix in the background. However, my simulation work does not work. I read the foo.results file, I found it only have part of my code and not any output I want. Is there any line limit? My code is nearly 400 line. I can cut some of them, but I want to know whether there is any limit or exactly the number of limit is. Thanks. 400 lines of input isn't large. Were there any error messages? Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R-OpenOffice.org Calc
Barry Rowlingson [EMAIL PROTECTED] writes: Branimir K. Hackenberger wrote: I have been very satisfied with R-Excel interface (DCOM). Few months ago I have changed my OS to Linux-Mandrake, and now I am using OpenOffice.org Calc as spreadsheet. I would like to know does exist some R-OpenOffice.org interface or how is possible to use R-functions in OpenOffice.org Calc? I think all you need to do is download the SDK: http://www.openoffice.org/dev_docs/source/sdk/index.html then read and understand both the 900 page OpenOffice SDK manual, and everything there is to know about R internals. Then write an extension for OpenOffice Calc that uses UNO to communicate between Calc and the R library. You'll probably have to use C++. The spreadsheet section of the SDK doc starts at page 535, by the way... Or is there a quicker way? I think Harry M. (spelling escapes me this morning) posted about working on a connection in the last few months. That might help. best, -tony -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R 1.8.0 Windows binaries uploaded
I've just uploaded the 1.8.0 binary build for Windows. It should be available on CRAN and the mirrors tomorrow. Duncan Murdoch ___ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-announce __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help