[R] Residual analysis in GEE
Does anyone know how to get residuals out of the Generalized Estimating Equations (GEE) module. I can get the fitted values but not the residuals? Also, I would like some more extended model diagnostics such as the studentized residuals, studentized deleted residuals,DFFIT, BFBeta, etc. Any help would be greatly appreciated. Dave Schwarz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot a new picture against an old one to see the difference between them
Maybe par(mfrow=c(1,2)) would do the trick. It puts two plots (of any kind) to the same device next to each-other. You have to run the command before the plotting commands. To have again only one plot per device, use par(mfrow=c(1,1)) Best, Ales Ziberna Am Stat pravi: Dear Roger, Thanks, that's really helpful, do you know how to deal with it if the two plots are generated by plot(), not by contour(). Best, Leon - Original Message - From: roger koenker [EMAIL PROTECTED] To: Am Stat [EMAIL PROTECTED] Sent: Monday, September 04, 2006 8:06 PM Subject: Re: [R] plot a new picture against an old one to see the difference between them for the second call to contour use the argument add=TRUE. On Sep 4, 2006, at 6:42 PM, Am Stat wrote: Hello, useR:, Suppose I have two plots made by using contour() function, say Cont1 and Cont2 respectively. They have slightly difference because of the two slightly different data I used. I want to see the difference between them so I want to plot Cont2 on Cont1, are there any methods to plot it without filling the frame of Cont1 totally of Cont2. I mean, how I can integreate the two plots together that they kind of have weighted colors? Thanks very much in Advance! Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Residual analysis in GEE
See the function geeglm in package geese. It has response, Pearson an working residuals. Best, Renaud 2006/9/4, David S. Schwarz [EMAIL PROTECTED]: Does anyone know how to get residuals out of the Generalized Estimating Equations (GEE) module. I can get the fitted values but not the residuals? Also, I would like some more extended model diagnostics such as the studentized residuals, studentized deleted residuals,DFFIT, BFBeta, etc. Any help would be greatly appreciated. Dave Schwarz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Renaud LANCELOT Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD Directeur adjoint chargé des affaires scientifiques CIRAD, Animal Production and Veterinary Medicine Department Deputy director for scientific affairs Campus international de Baillarguet TA 30 / B (Bât. B, Bur. 214) 34398 Montpellier Cedex 5 - France Tél +33 (0)4 67 59 37 17 Secr. +33 (0)4 67 59 39 04 Fax +33 (0)4 67 59 37 95 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] abline and plot(augPred) help
I would like to thank to Gabor Grothendieck, Paul Murrel and Maria Gabriela Cendoya for their helpful answers. Based on Gabors code here is a solution for adding lines to lattice plots which works smoothly on augPred plots. addLine- function(a, b=NULL, v = NULL, h = NULL, ...) { tcL - trellis.currentLayout() for(i in 1:nrow(tcL)) for(j in 1:ncol(tcL)) if (tcL[i,j] 0) { trellis.focus(panel, j, i, highlight = FALSE) panel.abline(a=a, b=b, v=v, h=h, ...) trellis.unfocus() } } Best regards. Petr Pikal On 4 Sep 2006 at 16:37, Gabor Grothendieck wrote: Date sent: Mon, 4 Sep 2006 16:37:00 -0400 From: Gabor Grothendieck [EMAIL PROTECTED] To: Paul Murrell [EMAIL PROTECTED] Copies to: Petr Pikal [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject:Re: [R] abline and plot(augPred) help On 9/4/06, Paul Murrell [EMAIL PROTECTED] wrote: Hi Petr Pikal wrote: Dear all as I did not get any response on my post about abline and plot(augPred)) I try again. I hope I do not break some posting guide rules. I would try to contact package maintainer directly but there is stated to be R-core people, so I feel R-help list shall be OK. I need to draw straight lines through augPred plotted panels (vertical or horizontal) at specified point. I know I shall probably use panel.abline but I am missing correct syntax. Below you can see my attempts together with results. I hope somebody can point me to right direction. I am probably somewhere close but I have no clue, which parameter I shall modify to get measured points, fitted lines and vertical lines in panels together. The problem is that you do not know about the default panel function that nlme:::plot.augPred() uses, so your panel functions are not replicating all of the default behaviour as well as adding your vertical lines. Some possible solutons suggested below ... fm1 - lme(Orthodont) # standard plot plot(augPred(fm1, level = 0:1, length.out = 2)) #plot with vertical but without points and fitted lines plot(augPred(fm1, level = 0:1, length.out = 2), panel=function(v,...) { panel.abline(v=10)} ) # plot with vertical but without fitted lines plot(augPred(fm1, level = 0:1, length.out=2), panel=function(x,y,...) { panel.xyplot(x,y,...) panel.abline(v=10)} ) # plot with vertical and with all points (fitted lines are drawn # as points) plot(augPred(fm1, level = 0:1), panel=function(x,y,...) { panel.xyplot(x,y,...) panel.abline(v=10)} ) One option is to take a sneak a peek at nlme:::plot.augPred() to see what the default panel function is doing. Here I have replicated the default panel function and added a call to panel.abline(). plot(augPred(fm1, level = 0:1, length.out = 2), panel=function(x, y, subscripts, groups, ...) { orig - groups[subscripts] == original panel.xyplot(x[orig], y[orig], ...) panel.superpose(x[!orig], y[!orig], subscripts[!orig], groups, ..., type = l) panel.abline(v=10) }) The problem with this approach is that you need to crawl around in the code of nlme:::plot.augPred(). An alternative approach is to annotate the plot after-the-fact. This is shown below. plot(augPred(fm1, level = 0:1, length.out = 2)) for (i in 1:5) { for (j in 1:6) { if (i 5 || j 4) { trellis.focus(panel, j, i, highlight=FALSE) panel.abline(v=10) } } } This avoids crawling around in code, but the problem with this is knowing how many rows and columns of panels there are. If you explicitly controlled the 'layout' of the original plot, you could guarantee that your annotation works properly. You can find that out with trellis.currentLayout: tcL - trellis.currentLayout() for(i in 1:nrow(tcL)) for(j in 1:ncol(tcL)) if (tcL[i,j] 0) { trellis.focus(panel, j, i, highlight = FALSE) panel.abline(v = 10) trellis.unfocus() } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Reserve and biobase
Hi I am using Rserve for R2.3.1. every time after I load Biobase library, a new Graphics window frame pops up. Could any onw know how can avoid it. Best Saeede class testReserve { public static void main(String[] args) { RServeConnection rsCon = null; Rconnection c = null; Process proc = null; try { Runtime rt = Runtime.getRuntime(); proc = rt.exec(generalMetaData.rserveDir); try { c = new Rconnection(); c.eval(library(grDevices)); //c.eval(graphics.off()); c.eval(postscript()); //load library c.eval(library(tools)); System.out.println( load library tools); c.eval( postscript('foo2.ps')); c.eval( library(Biobase)); c.eval(graphics.off()); System.out.println( load library Biobase); } catch (RSrvException ex1) { System.out.println(ex1.getMessage()); } } catch (Exception e) { System.out.print(cannot run rserve); } //end of testing } } - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot a new picture against an old one to see the difference between them
Hi On 5 Sep 2006 at 8:42, Ales Ziberna wrote: Date sent: Tue, 05 Sep 2006 08:42:27 +0200 From: Ales Ziberna [EMAIL PROTECTED] To: Am Stat [EMAIL PROTECTED] Copies to: roger koenker [EMAIL PROTECTED], R-help@stat.math.ethz.ch Subject:Re: [R] plot a new picture against an old one to see the difference between them Maybe par(mfrow=c(1,2)) would do the trick. It puts two plots (of any kind) to the same device next to each-other. You have to run the command before the plotting commands. To have again only one plot per device, use par(mfrow=c(1,1)) see also ?lines or ?points to put lines or points over previously plotted image. HTH Petr Best, Ales Ziberna Am Stat pravi: Dear Roger, Thanks, that's really helpful, do you know how to deal with it if the two plots are generated by plot(), not by contour(). Best, Leon - Original Message - From: roger koenker [EMAIL PROTECTED] To: Am Stat [EMAIL PROTECTED] Sent: Monday, September 04, 2006 8:06 PM Subject: Re: [R] plot a new picture against an old one to see the difference between them for the second call to contour use the argument add=TRUE. On Sep 4, 2006, at 6:42 PM, Am Stat wrote: Hello, useR:, Suppose I have two plots made by using contour() function, say Cont1 and Cont2 respectively. They have slightly difference because of the two slightly different data I used. I want to see the difference between them so I want to plot Cont2 on Cont1, are there any methods to plot it without filling the frame of Cont1 totally of Cont2. I mean, how I can integreate the two plots together that they kind of have weighted colors? Thanks very much in Advance! Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting generalized additive models with constraints?
I am trying to fit a GAM for a simple model, a simple model, y ~ s(x0) + s(x1) ; with a constraint that the fitted smooth functions s(x0) and s(x1) have to each always be 0. From the library documentation and a search of the R-site and R-help archives I have not been able to decipher whether the following is possible using this, or other GAM libraries, or whether I will have to try to roll my own. I see from the mgcv docs that GAMs need to be constrained such that the smooth functions have zero mean. Is there a way around this? Is such a constraint possible? It is possible to estimate a GAM subject to this constraint, but be aware that the mean levels of your component smooths are not identifiable, so there is an unavoidable abitrariness in the estimate You have to have some sort of constraint on the smooths in a GAM to ensure identifiability, and a convenient way to set the model up is to write it as e.g. E(y) = a + f0(x0) + f1(x1) where `a' is the intercept and f0 and f1 are smooth functions which sum to zero over their respective covariate values. In this parameterization your constraint implies that a + f0(x0) + f1(x1) 0 for all x0, x1. If this constraint is met then you can find constants b and c such that b+c=a such that f0(x0)+b0 and f1(x1)+c0 for all x0,x1. i.e. you redefine f0 as f0+b and f1 as f1+c, and you have a fitted model meeting the constraints. To fit the GAM subject to the constraints you can use mgcv:::pcls... ?pcls has some examples, but it does involve moderately low level programming. It's hard to impose the constraint exactly, so the usual approach would be to impose the constraint over a fairly fine grid of x0, x1 values. Also, you'll need to figure out how to select smoothing parameters. For many problems it suffices to estimate smoothing parameters on the unconstrained fit, and then use these to fit subject to constraints, but it depends on the problem Hope that's some use. Simon thanks very much for any advice or pointers. -David [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] A question about gc()
Hi everyone, I am doing some intensive computation: 5 regressions of the form Y~X with each y of size (1,1000) , even if I break invoke gc() for a few time in the loop, it still breaks down at some point with the error message: Error in .signalSimpleWarning(Reached total allocation of 1024Mb: see help(memory.size), : recursive default argument reference After getting this, even if I call gc() and resume the computation, it won't move at all. May I get some suggestions what should I do to get around this problem ? Thanks a lot. tong __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rserve and bibase
Hi I am using Rserve for R2.3.1. every time after I load Biobase library, a new Graphics window frame pops up. Could any onw know how can avoid it. Best Saeede class testReserve { public static void main(String[] args) { RServeConnection rsCon = null; Rconnection c = null; Process proc = null; try { Runtime rt = Runtime.getRuntime(); proc = rt.exec(generalMetaData.rserveDir); try { c = new Rconnection(); c._eval(library(grDevices)); //c._eval(graphics.off()); c._eval(postscript()); //load library c._eval(library(tools)); System.out.println( load library tools); c._eval( postscript('foo2.ps')); c._eval( library(Biobase)); c._eval(graphics.off()); System.out.println( load library Biobase); } catch (RSrvException ex1) { System.out.println(ex1.getMessage()); } } catch (Exception e) { System.out.print(cannot run rserve); } //end of testing } } - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] A question about gc()
On Tue, 5 Sep 2006, Tong Wang wrote: Hi everyone, I am doing some intensive computation: 5 regressions of the form Y~X with each y of size (1,1000) , even if I break invoke gc() for a few time in the loop, it still breaks down at some point with the error message: gc() does not reclaim memory for you beyond what R has already done. Error in .signalSimpleWarning(Reached total allocation of 1024Mb: see help(memory.size), : recursive default argument reference After getting this, even if I call gc() and resume the computation, it won't move at all. May I get some suggestions what should I do to get around this problem ? Consult the rw-FAQ (since you seem to be using Windows without telling us) and the help page the message mentions. It looks as if you are trying to store too many objects. If you have lots of RAM you can increase that limit (see the previous para), but you are getting uncomfortably close to the address space limit of your OS. Perhaps you can only save the part of the fit you need, or save() the objects to separate files and rm() them, and postprocess them in a later session? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave and the [ function
Hi Vincent This would seem logical but in this case doesn't work. It doesn't seem to be a Sweave problem (feature) at all but within R as Hadley stated. Within R try quote(women[1]) women[1] now try quote([(women,1)) women[1] So it's parsed and normalised (there's a familiar term); in this case to women[1] before its quoted. Curiously in the R Language Definition Guide in 10.4.3 it states R has three indexing constructs, two of which are syntactically similar although with somewhat different semantics: object [ arg1, .. , argn ] object [[ arg1, .. , argn ]] The object can formally be any valid expression, but it is understood to denote or evaluate to a subsettable object. The arguments generally evaluate to numerical or character indices, but other kinds of arguments are possible (notably drop = FALSE). Internally, these index constructs are stored as function calls with function name [ respectively [[. So I'm lost now. Can some one hand me a map and compass? Vincent Goulet wrote: Le Mardi 5 Septembre 2006 0:03, hadley wickham a écrit : = str(women) women$height women[,1] [(women,1) @ to show the equivalence of three methods of extracting an element from a data.frame. However Sweave returns the last of these as women[1] in the S input chunk How can I force it not to do this and return [(women,1) I don't think you can. Sweave parses your R code and from then on uses the internal R representation. R normalises the parse tree in certain ways (eg. strips comments, formats source code, and clearly normalises some function calls). Since sweave uses this, and not the original text, I don't think there is anyway to get around this, unless there is some trick during parsing. (And don't forget women[[1]]) Hadley So here's a workaround (untested): echo=TRUE, eval=TRUE= str(women) women$height women[,1] @ echo=TRUE, eval=FALSE= [(women,1) @ echo=FALSE, eval=TRUE= [(women,1) @ I often end up doing similar things. HTHVincent __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave and the [ function
G'day all, RD == Ross Darnell [EMAIL PROTECTED] writes: RD Hi Vincent This would seem logical but in this case doesn't RD work. Well, he said that it was untested. :) Same idea, but with a slightly different implementation (and this one works, I have tested it): = str(women) women$height women[,1] @ \begin{Sinput} [(women,1) \end{Sinput} echo=FALSE, eval=TRUE= [(women,1) @ HTH Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australiahttp://www.maths.uwa.edu.au/~berwin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave and the [ function
On Tue, 05 Sep 2006 20:56:33 +1000, Ross Darnell (RD) wrote: Hi Vincent This would seem logical but in this case doesn't work. It doesn't seem to be a Sweave problem (feature) at all but within R as Hadley stated. Yes, Sweave parses deparses the code in oreder to make full expressions out of lines of text, i.e., to know where open parentheses are closed etc. This is necessary in order to know where to insert output when multiple lines are contained in one code chunk, but unfortunately looses the original formatting as has correctly been explained earlier in this thread. Best, Fritz -- --- Prof. Dr. Friedrich Leisch Institut für Statistik Tel: (+49 89) 2180 3165 Ludwig-Maximilians-Universität Fax: (+49 89) 2180 5308 Ludwigstraße 33 D-80539 München http://www.stat.uni-muenchen.de/~leisch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave and the [ function
Ross Darnell [EMAIL PROTECTED] writes: Hi Vincent This would seem logical but in this case doesn't work. It doesn't seem to be a Sweave problem (feature) at all but within R as Hadley stated. Within R try quote(women[1]) women[1] now try quote([(women,1)) women[1] So it's parsed and normalised (there's a familiar term); in this case to women[1] before its quoted. Curiously in the R Language Definition Guide in 10.4.3 it states R has three indexing constructs, two of which are syntactically similar although with somewhat different semantics: object [ arg1, .. , argn ] object [[ arg1, .. , argn ]] The object can formally be any valid expression, but it is understood to denote or evaluate to a subsettable object. The arguments generally evaluate to numerical or character indices, but other kinds of arguments are possible (notably drop = FALSE). Internally, these index constructs are stored as function calls with function name [ respectively [[. Clear enough to me, but then again, I probably wrote it... 5 years ago or so. So I'm lost now. Can some one hand me a map and compass? Er, maybe, if you tell us which woods you are lost in so that we can find you... What may be confusing you is that it is precisely the other way around: women[1] is parsed to [(women,1) which deparses to women[1]. This may be illuminating: for(i in 1:3) print(quote(foo(women,1))[[i]]) for(i in 1:3) print(quote([(women,1))[[i]]) for(i in 1:3) print(quote(women[i])[[i]]) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Clubbing-UnknownLocations Mailing List Confirmation
This message has been sent to you as the final step to confirm your email *removal* for the following list: Clubbing-UnknownLocations To confirm this unsubscription, please follow the URL below: http://www.lancashireclubbers.co.uk/cgi-bin/dada/mail.cgi/u/loc_unknown/r-help/stat.math.ethz.ch/1835582/ (Click the URL above, or copy and paste the URL into your browser. Doing so will remove you to this list.) --- The following is the description given for this list: Lancashire based list, for informing the community of the latest clubbing events in and around Burnley, along with special promotions and news. These members have not been location verified. --- This double opt-out confirmation email was sent to protect the privacy of the owner of this email address. Furthermore, the following privacy policy is associated with this list: Your email address will be used by Lancashireclubbers to inform you about Lancashire based Clubbing Events, Promotions and News related to clubbing. Your email address will not be sold on, and will in no way be used to advertise non-clubbing / music related information. Please read and understand this privacy policy. If you did not ask to be removed from this particular list, please do not visit the confirmation URL above. The confirmation for removal will not go through and no other action on your part will be needed. To contact the owner of this email list, please use the address below: mailto:[EMAIL PROTECTED] The following physical address is associated with this mailing list: 168 Sycamore Avenue, Burnley - mailto:[EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Clubbing-UnknownLocations Unsubscription
The removal of the email address: r-help@stat.math.ethz.ch from the mailing list: Clubbing-UnknownLocations is complete. You may wish to save this email message for future reference. --- Date of this removal: Tue Sep 5 13:52:48 2006 You may automatically re-subscribe to this list at any time by visiting the following URL: http://www.lancashireclubbers.co.uk/cgi-bin/dada/mail.cgi/s/loc_unknown/r-help/stat.math.ethz.ch/ If the above URL is inoperable, make sure that you have copied the entire address. Some mail readers will wrap a long URL and thus break this automatic unsubscribe mechanism. You may also change your subscription by visiting this list's main screen: http://www.lancashireclubbers.co.uk/cgi-bin/dada/mail.cgi/list/loc_unknown If you're still having trouble, please contact the list owner at: mailto:[EMAIL PROTECTED] The following physical address is associated with this mailing list: 168 Sycamore Avenue, Burnley - mailto:[EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RGui problem in Windows XP with demo() and help()
Murray Eisenberg wrote: I just installed R-2.3.1pat under Windows XP as well as the associated RWinEdt. If I start RGui from its shortcut (but do _not_ also start RWinEdt) and then try to execute demo() or help(), I get a RWinEdt pop-up error window with message: File D:\WP\WinEdtData\WinEdt\D:/WP/WinEdtData/WinEdt/R.ini does not exist! Qualifier -e/-E does not specify an existing file! First question: what is causing RWinEdt even to get involved here? Second: where is the garbled path to R.ini coming from. Here's the configuration: Everything R is in D:\Stats\R. R-2.3.1pat has the actual R release installed. The shortcut for R-2.3.1-pat has target D:\Stats\R\R-2.3.1pat\bin\Rgui.exe and starts in D:\Stats\R\R-2.3.1pat. File .Renviron is in D:\Stats\R. R-2.3.1pat; the only lines in it that are not commented out are: R_USER=e:/Documents/R R_LIBS=d:/Stats/R/myRlib File .Rprofile is in e:/Documents/R (the reference of myR_USER); the only lines in it not commented out are: options(editor=\d:/WP/winedt/winedt\ -c=\R-WinEdt\ -E=\D:/WP/WinEdtData/WinEdt/R.ini\ -V) [on 1 line] options(pager=\d:/WP/winedt/winedt\ -C=\R-WinEdt\ -e=\D:/WP/WinEdtData/WinEdt/R.ini\ -V) [on 1 line] .First - function(x) print(Profile read) Just delete those options, they are not required in order to have RWinEdt working with R (I'm not using them). The usual way is to start RWinEdt separately in order to edit .R files and source() or paste parts of them to R. Uwe Ligges Is the root of the problem that I have a single .Rprofile set up for RWinEdt but need to have a different one for RGui without RWinEdt? And, if so, how do I tell R which one to use at startup? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] colorRamp
I am using colorRamp in the following way. I am *sure* there is a better way to do this, so if you'd be so kind to show me the true R way: Another possibility is to use map_colour_gradient from ggplot, which takes care of most of that for you (although it doesn't use colorRamp, that could be easily fixed) Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] terms.inner
Question: I am trying to impliment a function in R that we use quite regularly in Splus, and it fails due to a lack of the terms.inner function in R. The substitute is? Part question and part soapbox: Why remove terms.inner from R? It's little used, but rather innocuous. Mostly soapbox: I figured it was no big deal, as I originally discovered the use of terms.inner from reading the plot.gam function. So I'd just see what plot.gam does in R. plot.gam Error: object plot.gam not found Ok, I know this function has to exist. I even remember that there is some sort of multi-colon secret handshake that will convince R to let you look at it, although I don't remember the form. This Nixonesque passion with hiding things is one of the reasons I still prefer Splus. Terry Therneau [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] terms.inner
On Tue, Sep 05, 2006 at 08:24:54AM -0500, Terry Therneau wrote: ... ... Terry plot.gam Terry Error: object plot.gam not found if I do library(gam) plot.gam it prints the function Terry Terry Ok, I know this function has to exist. I even remember that there is some Terrysort of multi-colon secret handshake that will convince R to let you look Terryat it, although I don't remember the form. This Nixonesque passion with Terryhiding things is one of the reasons I still prefer Splus. afaik getAnywhere(function name) usually works for the hidden ones...though I don't quite understand why one should hide them HIH, Stefano Terry Terry Terry Terry Therneau Terry [EMAIL PROTECTED] Terry Terry__ TerryR-help@stat.math.ethz.ch mailing list Terryhttps://stat.ethz.ch/mailman/listinfo/r-help TerryPLEASE do read the posting guide http://www.R-project.org/posting-guide.html Terryand provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] terms.inner
Check out: http://tolstoy.newcastle.edu.au/R/help/01c/0340.html On 9/5/06, Terry Therneau [EMAIL PROTECTED] wrote: Question: I am trying to impliment a function in R that we use quite regularly in Splus, and it fails due to a lack of the terms.inner function in R. The substitute is? Part question and part soapbox: Why remove terms.inner from R? It's little used, but rather innocuous. Mostly soapbox: I figured it was no big deal, as I originally discovered the use of terms.inner from reading the plot.gam function. So I'd just see what plot.gam does in R. plot.gam Error: object plot.gam not found Ok, I know this function has to exist. I even remember that there is some sort of multi-colon secret handshake that will convince R to let you look at it, although I don't remember the form. This Nixonesque passion with hiding things is one of the reasons I still prefer Splus. Terry Therneau [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help: advice on the structuring of ReML models for analysing growth curves
Hi R experts, I am interested on the effects of two dietry compunds on the growth of chicks. Rather than extracting linear growth functions for each chick and using these in an analysis I thought using ReML might provide a neater and better way of doing this. (I have read the pdf vignette(MlmSoftRev) and Fitting linear mixed models in R by Douglas Bates but I am not entirely sure that I have the right solution). Basically I fed chicks in nest boxes over a period of time and weighed them each time I fed them. I presume that chick id should be a random factor and should be nested within nest box number? (Chicks were not moved around so this should make things more simple). Also since the chicks were measured repeatedly over time I presume that this should be a random factor? Growth is not linear exactly (more quadratic), so I thought rather than put time in the fixed model I want to control for the effects of time as a random factor The resulting model is this where id=chick identity and brood=nest box model1-lmer(weight~treatment1*treatment2*brood size*sex+(id|brood)+(1|brood)+(1|age), data=H) Is this the right approach or am I barking up the wrong tree? Any suggestions much appreciated, Simon Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: advice on the structuring of ReML models for analysing growth curves
Hi Simon, overall I think that lmer is a good tool for this problem. It's impossible to reply definitively without the full details on the experimental design. Caveat in place, I have questions and some suggestions. Are treatment1 and treatment2 distinct factors, or two levels of a treatment, the dietary compound? Also, what is broodsize? If you want to nest chick id within brood, I think that you should include the interaction as a random factor. If you'd like the age effects to differ between chicks then age should be on the left of id. Thus, start with something like ... model1 - lmer(weight ~ treatment + broodsize + sex + age + (1|brood) + (age|id:brood), data=H) You might also like to consider a quadratic term in age, if you think that growth is quadratic. Cheers Andrew ps spaces enhance legibility :) On Tue, Sep 05, 2006 at 03:01:30PM +0100, Simon Pickett wrote: Hi R experts, I am interested on the effects of two dietry compunds on the growth of chicks. Rather than extracting linear growth functions for each chick and using these in an analysis I thought using ReML might provide a neater and better way of doing this. (I have read the pdf vignette(MlmSoftRev) and Fitting linear mixed models in R by Douglas Bates but I am not entirely sure that I have the right solution). Basically I fed chicks in nest boxes over a period of time and weighed them each time I fed them. I presume that chick id should be a random factor and should be nested within nest box number? (Chicks were not moved around so this should make things more simple). Also since the chicks were measured repeatedly over time I presume that this should be a random factor? Growth is not linear exactly (more quadratic), so I thought rather than put time in the fixed model I want to control for the effects of time as a random factor The resulting model is this where id=chick identity and brood=nest box model1-lmer(weight~treatment1*treatment2*brood size*sex+(id|brood)+(1|brood)+(1|age), data=H) Is this the right approach or am I barking up the wrong tree? Any suggestions much appreciated, Simon Simon Pickett PhD student Centre For Ecology and Conservation Tremough Campus University of Exeter in Cornwall TR109EZ Tel 01326371852 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] terms.inner
On Tue, 5 Sep 2006, Terry Therneau wrote: Question: I am trying to impliment a function in R that we use quite regularly in Splus, and it fails due to a lack of the terms.inner function in R. The substitute is? Part question and part soapbox: Why remove terms.inner from R? It's little used, but rather innocuous. AFAIK it wasn't removed, it just hasn't ever been implemented. Probably no-one in the early years of R tried to port any code that used it -- there were a number of functions added back then just because the survival package used them, such as subscripting on terms objects. Mostly soapbox: I figured it was no big deal, as I originally discovered the use of terms.inner from reading the plot.gam function. So I'd just see what plot.gam does in R. plot.gam Error: object plot.gam not found Ok, I know this function has to exist. I even remember that there is some sort of multi-colon secret handshake that will convince R to let you look at it, although I don't remember the form. This Nixonesque passion with hiding things is one of the reasons I still prefer Splus. Perhaps not the best soapbox example. There are at least two gam implementations, but they are both in add-on packages. Neither of them hides its plot.gam in a namespace, but you do need to install and load the package. You presumably want Trevor Hastie's one, which is in the gam package, rather than Simon Woods' one in the mgcv package. BTW, termplot() does many of the same things as Hastie's plot.gam(). It is also not hidden. If I understand correctly what terms.inner does, termplot() uses two functions: pf - envir carrier - function(term) { if (length(term) 1) carrier(term[[2]]) else eval(term, data, enclos = pf) } carrier.name - function(term) { if (length(term) 1) carrier.name(term[[2]]) else as.character(term) } to do the job. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reserve and biobase
You should ask questions about Bioconductor software on the Bioconductor list, you might also read the posting guide and provide version numbers for all packages you are using (the output of sessionInfo is useful). Biobase does not do any plotting, so where ever the action is coming from it is unlikely to be Biobase that is doing it. I don't use Rserve so I cannot comment on how that might interact with other software. I have no idea what you are trying to do, but somehow you seem to be doing a lot more than just loading Biobase - so why not try just doing that and leave out all the other code opening devices (and why open two postscript devices and then close them?). Robert saeedeh maleki wrote: Hi I am using Rserve for R2.3.1. every time after I load Biobase library, a new Graphics window frame pops up. Could any onw know how can avoid it. Best Saeede class testReserve { public static void main(String[] args) { RServeConnection rsCon = null; Rconnection c = null; Process proc = null; try { Runtime rt = Runtime.getRuntime(); proc = rt.exec(generalMetaData.rserveDir); try { c = new Rconnection(); c.eval(library(grDevices)); //c.eval(graphics.off()); c.eval(postscript()); //load library c.eval(library(tools)); System.out.println( load library tools); c.eval( postscript('foo2.ps')); c.eval( library(Biobase)); c.eval(graphics.off()); System.out.println( load library Biobase); } catch (RSrvException ex1) { System.out.println(ex1.getMessage()); } } catch (Exception e) { System.out.print(cannot run rserve); } //end of testing } } - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R: Optimization
Thanks for the help. I thought about taking the logarithms of the expression but to cope with the problem of zero values both in yield and the values of the environmental variables another transformation is needed (I simply add one to the yield value and to the environmental variables values). I follow the suggestion kindly provided by Spencer Graves but I found the following problems, which depend probably on my understanding: 1) I don't understand why it is needed to test the no-constant model (which provides a better fitting of the model). Can I simply assume a no-constant model? 2) Here comes the big problem. I don't understand what it is done with the models fit.0 and fit.1. In both cases I have to leave out one variable from the linear model but I don't understand why in this way I would test the constraint that all the coefficients should sum to 1. And it is not possible to apply anova(fit0,fit.0) and anova(fit1,fit.1) because I have different response variables. In conclusion, I don't actually know how to proceed and if in R this kind of analysis is possible. Any help and any further explanation would be very appreciated. Below I report part of the data frame I'm using for the analysis. The environmental variables (Salinity, Hydrodynamism, Sediment, Oxygen, Chlorophyll and Bathymetry) values have been transformed using suitability function (and thus are bounded between 0 and 1) while Yield is in kg/m2. Sedi Sal Bathy Chl Hydro Oxy Yield 1 1.00 1.00 0.51 1 0.17 0.75 1.5 2 0.50 0.95 1.00 1 0.09 0.94 0.4 3 0.50 1.00 0.17 1 0.44 0.90 1.8 4 1.00 0.98 1.00 1 0.10 0.89 4.5 5 0.13 0.84 0.73 1 0.16 0.84 0.4 6 0.50 0.90 0.91 1 0.22 0.84 0.4 7 0.13 0.75 1.00 1 0.14 0.86 0.2 8 0.13 0.84 0.75 1 0.10 0.83 0.3 9 0.13 0.78 0.97 1 0.06 0.84 0.5 10 0.13 0.87 0.70 1 0.45 0.85 1.0 11 1.00 0.77 1.00 1 0.19 0.86 1.5 12 1.00 0.94 0.81 1 0.47 0.86 3.0 13 1.00 0.93 1.00 1 0.45 0.89 2.5 14 0.50 1.00 1.00 1 0.54 0.84 4.0 15 0.50 1.00 1.00 1 0.25 0.88 2.2 16 1.00 1.00 0.56 1 0.25 0.90 5.0 17 1.00 0.90 0.56 1 0.40 0.90 1.5 18 0.50 0.97 1.00 1 0.22 0.95 1.0 19 0.54 0.96 1.00 1 0.18 0.91 0.3 20 1.00 0.97 0.33 1 0.39 0.90 3.0 And here the results of the fitted models so far. summary(fit0) Call: lm(formula = log(Yield + 1) ~ log(Sal + 1) + log(Bathy + 1) + log(Chl + 1) + log(Hydro + 1) + log(Oxy + 1) + log(Sedi + 1) - 1, data = data.df) Residuals: Min 1Q Median 3Q Max -1.05485 -0.23759 0.01331 0.18692 1.23803 Coefficients: Estimate Std. Error t value Pr(|t|) log(Sal + 1) 5.071931.00584 5.042 1.98e-06 *** log(Bathy + 1) 0.058040.20684 0.281 0.779561 log(Chl + 1) -8.539412.11720 -4.033 0.000106 *** log(Hydro + 1) 1.738350.28815 6.033 2.56e-08 *** log(Oxy + 1) 4.199511.98459 2.116 0.036750 * log(Sedi + 1) 1.159530.14807 7.831 4.51e-12 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.3735 on 103 degrees of freedom Multiple R-Squared: 0.9148, Adjusted R-squared: 0.9098 F-statistic: 184.2 on 6 and 103 DF, p-value: 2.2e-16 summary(fit1) Call: lm(formula = log(Yield + 1) ~ log(Sal + 1) + log(Bathy + 1) + log(Chl + 1) + log(Hydro + 1) + log(Oxy + 1) + log(Sedi + 1), data = (data.df)) Residuals: Min1QMedian3Q Max -1.057766 -0.227720 0.006146 0.192200 1.222543 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -4.494004.76603 -0.943 0.3479 log(Sal + 1) 5.134991.00861 5.091 1.63e-06 *** log(Bathy + 1) 0.066850.20716 0.323 0.7476 log(Chl + 1) -2.489096.75718 -0.368 0.7134 log(Hydro + 1) 1.706740.29025 5.880 5.22e-08 *** log(Oxy + 1) 4.637582.03928 2.274 0.0251 * log(Sedi + 1) 1.140050.14959 7.621 1.34e-11 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.3737 on 102 degrees of freedom Multiple R-Squared: 0.7589, Adjusted R-squared: 0.7447 F-statistic: 53.51 on 6 and 102 DF, p-value: 2.2e-16 summary(fit.0) Call: lm(formula = log((Yield + 1)/(Sedi + 1)) ~ log((Sal + 1)/(Sedi + 1)) + log((Bathy + 1)/(Sedi + 1)) + log((Chl + 1)/(Sedi + 1)) + log((Hydro + 1)/(Sedi + 1)) + log((Oxy + 1)/(Sedi + 1)) - 1, data = subset(data.df)) Residuals: Min 1Q Median 3Q Max -1.5762 -0.2591 0.1065 0.5023 1.4533 Coefficients: Estimate Std. Error t value Pr(|t|) log((Sal + 1)/(Sedi + 1))3.0170 1.5304 1.971 0.05134 . log((Bathy + 1)/(Sedi + 1)) -0.3982 0.3139 -1.268 0.20748 log((Chl + 1)/(Sedi + 1))8.8137 2.3941 3.681 0.00037 *** log((Hydro + 1)/(Sedi + 1)) 0.3309 0.4066 0.814 0.41760 log((Oxy + 1)/(Sedi + 1)) -12.5242 2.1881 -5.724 1.01e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Re: [R] Reserve and biobase
Wild speculation on my part, but I wonder if the 'graphics window' that pops up is the 'welcome' message in Biobase? This is invoked by a call to 'message' in the .onAttach function... .onAttach - function(libname, pkgname) { message(paste(\nWelcome to Bioconductor\n, [etc] If so, suppressMessages(library(Biobase)) might help. It would be great to hear confirmation of this as the problem. If not, a completely streamlined example (no extra packages loaded / actions taken) would aid in debugging. Martin -- Bioconductor Robert Gentleman [EMAIL PROTECTED] writes: You should ask questions about Bioconductor software on the Bioconductor list, you might also read the posting guide and provide version numbers for all packages you are using (the output of sessionInfo is useful). Biobase does not do any plotting, so where ever the action is coming from it is unlikely to be Biobase that is doing it. I don't use Rserve so I cannot comment on how that might interact with other software. I have no idea what you are trying to do, but somehow you seem to be doing a lot more than just loading Biobase - so why not try just doing that and leave out all the other code opening devices (and why open two postscript devices and then close them?). Robert saeedeh maleki wrote: Hi I am using Rserve for R2.3.1. every time after I load Biobase library, a new Graphics window frame pops up. Could any onw know how can avoid it. Best Saeede class testReserve { public static void main(String[] args) { RServeConnection rsCon = null; Rconnection c = null; Process proc = null; try { Runtime rt = Runtime.getRuntime(); proc = rt.exec(generalMetaData.rserveDir); try { c = new Rconnection(); c.eval(library(grDevices)); //c.eval(graphics.off()); c.eval(postscript()); //load library c.eval(library(tools)); System.out.println( load library tools); c.eval( postscript('foo2.ps')); c.eval( library(Biobase)); c.eval(graphics.off()); System.out.println( load library Biobase); } catch (RSrvException ex1) { System.out.println(ex1.getMessage()); } } catch (Exception e) { System.out.print(cannot run rserve); } //end of testing } } - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] terms.inner
Terry: errr... at it, although I don't remember the form. This Nixonesque passion with hiding things is one of the reasons I still prefer Splus. Two comments: 1) The use of namespaces is a well-established appoach in computer science to avoid naming conflicts (and probably other stuff I don't understand). 2) To be fair, S-Plus is a proprietary closed system, and so can and presumably does control its naming of new functions so that naming conflicts are avoided. R, which is an open system with literally hundreds of contributed packages cannot do this, and so must use some methodology like namespaces to do so. Cheers, Bert -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: advice on the structuring of ReML models foranalysing growth curves
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Robinson Sent: Tuesday, September 05, 2006 7:25 AM To: Simon Pickett Cc: r-help@stat.math.ethz.ch Subject: Re: [R] help: advice on the structuring of ReML models foranalysing growth curves Hi Simon, overall I think that lmer is a good tool for this problem. It's impossible to reply definitively without the full details on the experimental design. Caveat in place, I have questions and some suggestions. Are treatment1 and treatment2 distinct factors, or two levels of a treatment, the dietary compound? Also, what is broodsize? If you want to nest chick id within brood, I think that you should include the interaction as a random factor. If you'd like the age effects to differ between chicks then age should be on the left of id. Thus, start with something like ... model1 - lmer(weight ~ treatment + broodsize + sex + age + (1|brood) + (age|id:brood), data=H) FWIW, this model can also be easily fit with the lme() function (in the nlme package) as the random effects are strictly nested. The only advantage in doing so is that the lme tools for examining the model are somewhat more developed and extensive (or am I just more familiar with them?) Cheers, Bert - Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help: advice on the structuring of ReML models foranalysing growth curves
I agree with Bert. The lme() helper functions are much more developed than the lmer() helper functions. This is probably relevant for Simon's data because temporal autocorrelation is likely for the measurements within chicks, and is easily handled in lme(). I'm not sure if it can be done yet in lmer(). Cheers Andrew On Tue, Sep 05, 2006 at 09:14:20AM -0700, Berton Gunter wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Robinson Sent: Tuesday, September 05, 2006 7:25 AM To: Simon Pickett Cc: r-help@stat.math.ethz.ch Subject: Re: [R] help: advice on the structuring of ReML models foranalysing growth curves Hi Simon, overall I think that lmer is a good tool for this problem. It's impossible to reply definitively without the full details on the experimental design. Caveat in place, I have questions and some suggestions. Are treatment1 and treatment2 distinct factors, or two levels of a treatment, the dietary compound? Also, what is broodsize? If you want to nest chick id within brood, I think that you should include the interaction as a random factor. If you'd like the age effects to differ between chicks then age should be on the left of id. Thus, start with something like ... model1 - lmer(weight ~ treatment + broodsize + sex + age + (1|brood) + (age|id:brood), data=H) FWIW, this model can also be easily fit with the lme() function (in the nlme package) as the random effects are strictly nested. The only advantage in doing so is that the lme tools for examining the model are somewhat more developed and extensive (or am I just more familiar with them?) Cheers, Bert - Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] terms.inner() reprise
I quickly recieved several replies to my terms.inner question. To summarize: 1. It was never in R Clearly I was mistaken in my assumptions. Since gam used it, and gam was ported, I assumed terms.inner had to have been in R at some point. But that version of gam must never have made it to R. 2. Given #1, it's not too surprising that I didn't (yet) get any answers to the main question, which is what to do instead. How do you know what can replace something, when you've never seen the something, after all. A bit more digging on my own found that all.vars(delete.repsonse(formula)) seems to be what I want. Something that returns x z from the formula y ~ log(x) + cos(z) 3. gam has to attached This surprised me. I think of lm, glm, and gam as the big 3 models from the Chambers and Hastie book, in the sense of using them all the time in my consulting work. I would never have guessed that the first 2 would make it into base R and the last not so. If I had downloaded and attached the right thing, it seems that I would have found print.gam. 4. Hiding names The soapbox part of my note is getting the most response, and very entertaining it is. getAnywhere() seems to be the most general fix to my frustration. I may come back with another note summarizing some of the philosophical debate. Terry Therneau __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R object code
Hi!, I wonder to know if someone can explain me how I can access R object code. Briefly, what I need to do is: given a user defined function in R I want to access its object code with C because I need evaluate the function but using C. Thanks in advance for any help. Patricia. ___ Do You Yahoo!? La mejor conexión a Internet y b 2GB/b extra a tu correo por $100 al mes. http://net.yahoo.com.mx __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fitting generalized additive models with constraints?
I am trying to fit a GAM for a simple model, a simple model, y ~ s(x0) + s(x1) ; with a constraint that the fitted smooth functions s(x0) and s(x1) have to each always be 0. From the library documentation and a search of the R-site and R-help archives I have not been able to decipher whether the following is possible using this, or other GAM libraries, or whether I will have to try to roll my own. I see from the mgcv docs that GAMs need to be constrained such that the smooth functions have zero mean. Is there a way around this? Is such a constraint possible? It is possible to estimate a GAM subject to this constraint, but be aware that the mean levels of your component smooths are not identifiable, so there is an unavoidable abitrariness in the estimate You have to have some sort of constraint on the smooths in a GAM to ensure identifiability, and a convenient way to set the model up is to write it as e.g. E(y) = a + f0(x0) + f1(x1) where `a' is the intercept and f0 and f1 are smooth functions which sum to zero over their respective covariate values. In this parameterization your constraint implies that a + f0(x0) + f1(x1) 0 for all x0, x1. If this constraint is met then you can find constants b and c such that b+c=a such that f0(x0)+b0 and f1(x1)+c0 for all x0,x1. i.e. you redefine f0 as f0+b and f1 as f1+c, and you have a fitted model meeting the constraints. To fit the GAM subject to the constraints you can use mgcv:::pcls... ?pcls has some examples, but it does involve moderately low level programming. It's hard to impose the constraint exactly, so the usual approach would be to impose the constraint over a fairly fine grid of x0, x1 values. Also, you'll need to figure out how to select smoothing parameters. For many problems it suffices to estimate smoothing parameters on the unconstrained fit, and then use these to fit subject to constraints, but it depends on the problem Hope that's some use. Simon Hi Simon, thanks very much for the advice. I will try to parse your response and the pcls docs and see if I can get this to work. In the meantime, I found a paper that tries to achieve a similar thing with the same constraints as I am working with, using quadprog: http://www.esajournals.org/esaonline/?request=get-abstractissn=0012-9658volume=083issue=08page=2256 -David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : merge files after cor.test
To merge two file you need to have the same key in both file. you can get what you need with de cbind function. What you did is not (I think ! it may be wrong) a case to use merge function. - Message d'origine De : jia ding [EMAIL PROTECTED] À : R-help r-help@stat.math.ethz.ch Envoyé le : Lundi, 4 Septembre 2006, 11h34mn 12s Objet : [R] merge files after cor.test Dear All, Suppose I have 2 files: # first one : testid.csv A B C D E (id- read.table (testid.csv,col.name=c(id))) id 1 A 2 B 3 C 4 D 5 E # second file is the result file I calculate from cor.text, which shows the correlation coefficient. cor.value.t 1 2 3 4 5 1 1.000 0.2156213 0.31000492 0.22282154 0.1822277 2 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 3 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 4 0.2228215 0.4268149 -0.02801885 1. 0.1454049 5 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 # I tried to merge these two files together. # what I expected is like this: A 1.000 0.2156213 0.31000492 0.22282154 0.1822277 B 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 C 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 D 0.2228215 0.4268149 -0.02801885 1. 0.1454049 E 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 # but after I used (output-merge(id,cor.value.t)), which shows 25 lines (below): id 1 2 3 4 5 1 A 1.000 0.2156213 0.31000492 0.22282154 0.1822277 2 B 1.000 0.2156213 0.31000492 0.22282154 0.1822277 3 C 1.000 0.2156213 0.31000492 0.22282154 0.1822277 4 D 1.000 0.2156213 0.31000492 0.22282154 0.1822277 5 E 1.000 0.2156213 0.31000492 0.22282154 0.1822277 6 A 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 7 B 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 8 C 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 9 D 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 10 E 0.2156213 1.000 -0.31183893 0.42681488 0.3421535 11 A 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 12 B 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 13 C 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 14 D 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 15 E 0.3100049 -0.3118389 1. -0.02801885 -0.1307732 16 A 0.2228215 0.4268149 -0.02801885 1. 0.1454049 17 B 0.2228215 0.4268149 -0.02801885 1. 0.1454049 18 C 0.2228215 0.4268149 -0.02801885 1. 0.1454049 19 D 0.2228215 0.4268149 -0.02801885 1. 0.1454049 20 E 0.2228215 0.4268149 -0.02801885 1. 0.1454049 21 A 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 22 B 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 23 C 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 24 D 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 25 E 0.1822277 0.3421535 -0.13077317 0.14540493 1.000 Is anybody know why it outputs 5 times? Thanks a lot! Nina [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] winDialog UNIX equivalent?
Hi all, I'm using winDialog and winDialogString in scripts running on a XP-machine. Since we're using some Linux-machines (Suse 10.0 and 10.1 on x86) I'm interested in equivalents of the above functions usable under Linux-OS. Are there any? Thanks, Richard -- Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn www.oeko-sorpe.de [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R object code
On Tue, 5 Sep 2006, Patricia Bautista wrote: Hi!, I wonder to know if someone can explain me how I can access R object code. Briefly, what I need to do is: given a user defined function in R I want to access its object code with C because I need evaluate the function but using C. Are you doing this from a package in R, or from another application? Both are covered in 'Writing R Extensions': the first uses eval in C, and the second needs embedded R or an R server. Depending on your OS, there are other possibilities like (D)COM (also in that manual) and Rserve (www.rosuda.org/Rserve). (The details are more appropriate for the R-devel list, according to the posting guide.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] biplot label size
Which is the parameter that is used to decrease the size of ylabs plotted in biplot? I tried playing with cex and cex.lab I am not getting it right pc - princomp(USArrests) biplot(pc, xlabs = rep(, nrow(USArrests)),ylabs=(colnames(USArrests))) Thanks../Murli [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] biplot label size
?biplot indicates cex= controls the size of the point labels. Is that what you want? I suspect not since you say you've tried it so if its something that ?biplot does not answer you may need to examine the source. Enter this into R to display the source: stats:::biplot.default On 9/5/06, Nair, Murlidharan T [EMAIL PROTECTED] wrote: Which is the parameter that is used to decrease the size of ylabs plotted in biplot? I tried playing with cex and cex.lab I am not getting it right pc - princomp(USArrests) biplot(pc, xlabs = rep(, nrow(USArrests)),ylabs=(colnames(USArrests))) Thanks../Murli [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R: Optimization
comments in line Simone Vincenzi wrote: Thanks for the help. I thought about taking the logarithms of the expression but to cope with the problem of zero values both in yield and the values of the environmental variables another transformation is needed (I simply add one to the yield value and to the environmental variables values). Do you have 0 yield in any cases where the values of all the environmental variables were non-zero? I didn't see any 0's in the data you have below. I would not worry about 0's unless they actually occur. If you have a larger data set with some 0's then I suggest you consider the cases where the 0's actually occur. * If every 0 yield occurs when at least one of the environmental variables is 0, you can safely delete all cases with 0 yield, because they provide zero information to estimate any of the parameters in your model. I would rerun the model without the 1's, as they make no sense to me. * Otherwise, you need to evaluate the noise in the model. In other words, the equation you wrote will not fit exactly. The standard regression model (linear or nonlinear) assumes that y = f(X, b) + e, where X here is a vector of A, B, ..., b is a vector of the parameters to be estimated, b0, b1, ..., in the model I wrote, and the errors e are normally distributed with constant variance. If you have cases where the yield is zero but none of the X's are, you have problems with this assumption no matter what. You could use nls with the model as you specified it. However, to get starting values for nls I suggest you run lm on the logarithms, adding 1 if you like, as you suggested. I follow the suggestion kindly provided by Spencer Graves but I found the following problems, which depend probably on my understanding: 1) I don't understand why it is needed to test the no-constant model (which provides a better fitting of the model). Can I simply assume a no-constant model? I was assuming yield would be a number between 0 and 1, similar to A, B, ... . If your inputs A, B, .., are all between 0 and 1 but yield is not. I suggest you carefully examine the source for that equation, because it makes no physical sense to me. Your regression results below report that the intercept is not significantly different from 0. However, I would suspect that might be just an accident. If you change units from kg/m2 to psi or something else, you should get a statistically significant intercept. * If yield is between 0 and 1, then the yield equation you wrote makes physical sense. And then it makes sense to test whether b0 = 0, because that is a test for whether there are other environmental that impact yield that are not in the model. * Similarly, the comparisons of fit0 and fit.0 plus fit1 and fit.1 are designed to test for other environmental variable(s) not in the model that affect yield but are correlated somewhat with the variables you already have. For more, I suggest you consult a statistician. There must be several at Uni Parma. Hope this helps. Spencer Graves 2) Here comes the big problem. I don't understand what it is done with the models fit.0 and fit.1. In both cases I have to leave out one variable from the linear model but I don't understand why in this way I would test the constraint that all the coefficients should sum to 1. And it is not possible to apply anova(fit0,fit.0) and anova(fit1,fit.1) because I have different response variables. In conclusion, I don't actually know how to proceed and if in R this kind of analysis is possible. Any help and any further explanation would be very appreciated. Below I report part of the data frame I'm using for the analysis. The environmental variables (Salinity, Hydrodynamism, Sediment, Oxygen, Chlorophyll and Bathymetry) values have been transformed using suitability function (and thus are bounded between 0 and 1) while Yield is in kg/m2. Sedi Sal Bathy Chl Hydro Oxy Yield 1 1.00 1.00 0.51 1 0.17 0.75 1.5 2 0.50 0.95 1.00 1 0.09 0.94 0.4 3 0.50 1.00 0.17 1 0.44 0.90 1.8 4 1.00 0.98 1.00 1 0.10 0.89 4.5 5 0.13 0.84 0.73 1 0.16 0.84 0.4 6 0.50 0.90 0.91 1 0.22 0.84 0.4 7 0.13 0.75 1.00 1 0.14 0.86 0.2 8 0.13 0.84 0.75 1 0.10 0.83 0.3 9 0.13 0.78 0.97 1 0.06 0.84 0.5 10 0.13 0.87 0.70 1 0.45 0.85 1.0 11 1.00 0.77 1.00 1 0.19 0.86 1.5 12 1.00 0.94 0.81 1 0.47 0.86 3.0 13 1.00 0.93 1.00 1 0.45 0.89 2.5 14 0.50 1.00 1.00 1 0.54 0.84 4.0 15 0.50 1.00 1.00 1 0.25 0.88 2.2 16 1.00 1.00 0.56 1 0.25 0.90 5.0 17 1.00 0.90 0.56 1 0.40 0.90 1.5 18 0.50 0.97 1.00 1 0.22 0.95 1.0 19 0.54 0.96 1.00 1 0.18 0.91 0.3 20 1.00 0.97 0.33 1 0.39 0.90 3.0 And here the results of the fitted models so far. summary(fit0) Call: lm(formula = log(Yield + 1) ~ log(Sal + 1) + log(Bathy + 1) + log(Chl + 1) + log(Hydro + 1) + log(Oxy + 1) + log(Sedi + 1) - 1, data =