Re: [R] Probelms installing package RMySQL (Dominic Senn)
On Sun, 23 Oct 2005, Jeff Ryan wrote: Make sure you have your environment variable LDFLAGS set to -L/usr/ lib, otherwise I believe the linker doesn't look there. That is on the system default ld path on all known systems, including Solaris 8. You can check where R looks in the Makeconf file, under LDFLAGS. Those are _additional_ places. Not too sure though - just slogged through building on a brand new Solaris box, and that was my problem. I am sure there are others who know FAR more than I. Note that Dominic Senn had already replied to say this problem was solved: see https://stat.ethz.ch/pipermail/r-help/2005-October/079897.html jeff On Oct 23, 2005, at 5:00 AM, [EMAIL PROTECTED] wrote: [R] Probelms installing package RMySQL (Dominic Senn) __ 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 -- 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
Re: [R] GAM and AIC: How can I do??? please
ronggui == ronggui [EMAIL PROTECTED] on Mon, 24 Oct 2005 10:09:30 +0800 writes: ronggui === 2005-10-24 09:55:32 ronggui úÚ´ÅдÀº=== Hello, I'm a Korean researcher who have been started to learn the R package. I want to make gam model and AIC value of the model to compare several models. I did the GAM model, but there were error for AIC. SO, how can I do? pleas help me!!! I did like below; a.fit - gam(pi~ s(t1r), family = gaussian(link=log)) summary(a.fit) Family: gaussian Link function: log Formula: pi ~ s(t1r) Parametric coefficients: Estimate std. err.t ratioPr(|t|) constant 0.093105 0.005238 17.77 2.22e-16 Approximate significance of smooth terms: edf chi.sq p-value s(t1r) 1.833 24.153 0.00014213 R-sq.(adj) = 0.435 Deviance explained = 47.1% GCV score = 0.0010938 Scale est. = 0.00099053 n = 30 ronggui are you using the mgcv package? if you are,just ronggui use a.fit$aic to get the aic. hmm, yes, and no: It's true what you say, BUT is not at all recommended in general: You should use the generic AIC() function rather than extracting components yourself. This is a general priniciple: If possible use 'extractor functions' to work on objects rather then relying on internal representations. This is particularly relevant for fitted models: Do use residuals(.), fitted(.), LogLik(.), AIC(.), vcov(.) etc etc! Now back to this problem: AIC(a.fit) Error in logLik(object) : no applicable method for logLik I can't reproduce this; Eun definitely needs to give more details, since the following works fine: library(mgcv) x - 1:50 set.seed(1) y - 2^(sin(x/10) + rnorm(50)) a.fit - gam(y ~ s(x), family = gaussian(link=log)) summary(a.fit) Family: gaussian Link function: log Formula: y ~ s(x) Parametric coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.3171 0.1251 2.535 0.0147 * --- Signif. codes: ..{UTF-8 code} Approximate significance of smooth terms: edf Est.rankF p-value s(x) 2.8589.000 3.07 0.00576 ** --- Signif. codes: R-sq.(adj) =0.4 Deviance explained = 43.5% GCV score = 0.94391 Scale est. = 0.87107 n = 50 AIC(a.fit) [1] 140.6937 __ 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
[R] Strange update behavior of gregmisc
Hello, I notice an odd behavior of gregmisc package when using update.packages() via R --no-save (as root). Every time I launch update.packages() gregmisc is repeatedly selected for upgrade. Current available version of gregmisc is 2.08 according to 'installed.packages()'. Despite I obviousely have already installed the most up to date gregmisc, gregmisc will be updated repeatedly? No one seems to have noticed a similar behavior like this before according to mail archive. All dependencies are seemingly meet and no error messages occured, so I am kind of stuck to figure out what happens here. Here is my update session: thomas# R --no-save --- update.packages() --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done gregmisc : Version 2.0.6 installed in /usr/lib/R/site-library Version 2.0.8 available at http://pangora.org/cran Update (y/N/c)? y try URL 'http://pangora.org/cran/src/contrib/gregmisc_2.0.8.tar.gz' Content type 'application/x-tar' length 901 bytes URL opened == downloaded 901 bytes * Installing *source* package 'gregmisc' ... No man pages found in package 'gregmisc' ** building package indices ... * DONE (gregmisc) The downloaded packages are in /tmp/Rtmp4Thydf/downloaded_packages -- When I relaunch 'update.packages()' the same as desribed above is going to happen again? Do I miss something? regards Thomas My system (Debian Sarge): platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major2 minor2.0 year 2005 month10 day 06 svn rev 35749 language R __ 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
[R] [R-pkgs] new package bundle on CRAN: BACCO
Dear List please find on CRAN a new R bundle, BACCO, for Bayesian analysis of random functions, comprising two packages: emulator and calibrator. Package calibrator implements: “Bayesian calibration of computer models”, M. C. Kennedy and A. O'Hagan 2001. Journal of the Royal Statistical Society B, 63(3) pp425-464 and package emulator implements: J. Oakley 2004. “Estimating percentiles of uncertain computer code outputs”. Applied Statistics, 53(1), pp89-93. J. Oakley and A. O'Hagan, 2002. “Bayesian Inference for the Uncertainty Distribution of Computer Model Outputs”, Biometrika 89 (4), pp769-784 The bundle is described in: R. K. S. Hankin 2005. “Introducing BACCO, an R bundle for Bayesian analysis of computer code output”, Journal of Statistical Software, 14 (16) enjoy rksh -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ 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
[R] Is 64-bit linux compatible version of 'R' available?
Hi, Is there any 64-bit compatible version of 'R' available? Thanks Regards, Uttam Phulwale Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com [[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
Re: [R] Male and female symbols?
(Ted Harding) wrote: For example -- though I'm not seriously saying I need this -- in a population study of faxes and rabbits surveyed over several years, one might wish to plot the Rabbit population using tiny rabbits as points, and foxes' heads for the Fox population. I cant help thinking now of the graphic shown on the 'Brass Eye' comedy show on Animal Cruelty. Cue totally over-the-top 3d zooming barchart with mad lighting effects, and voice-over: 'If you plot number of animals abused against what makes people cruel versus intelligence of either party, the pattern is so unreadable you might as well draw in a chain of fox heads on sticks. And if you do that, an interesting thing happens: the word cruel starts flashing.' But seriously: you could load in an image with the pixmap package and plot with that: library(pixmap) x - read.pnm(system.file(pictures/logo.ppm, package=pixmap)[1]) plot(1:10,type='n') for(i in 1:10){addlogo(x,px=c(i-.2,i+.2),py=c(i-.2,i+.2))} From there to a chain of fox heads on sticks is a small step. Baz __ 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
Re: [R] Is 64-bit linux compatible version of 'R' available?
On Δευ, Οκτώβριος 24, 2005 11:48, [EMAIL PROTECTED] wrote: Hi, Is there any 64-bit compatible version of 'R' available? There is of course the possibility that you can build your own version of R by obtaining the source and compiling and optimizing for your own 64-bit processor. IKD -- Ioannis C. Dimakos University of Patras Department of Elementary Education Patras, GR-26500 GREECE http://www.elemedu.upatras.gr/dimakos/ http://yannishome.port5.com/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Errors occured
On Sun, 23 Oct 2005, Leaf Sun wrote: Hi all, Has anybody have the experience in the errors: Error in data.frame(..., check.names=FALSE): arguments imply differing number of rows: 343,15 This is the error occured in the middle of the program. I don't think the data frame has any problem, if there is problem with the program, why it happened in the middle? Further to Uwe's advice, looking at the traceback() output may give you an idea of what is going wrong, and if your script is adequately written, using debug() on the function in which the error occurs will let you examine what is being passed to data.frame() before the error happens. Does anybody have such an experience? It seems so weird to me. Thanks a lot! Leaf -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [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
[R] tk problem with R 2.2.0 on wine/linux
Actually I am trying to run sciview-R and encounted some problems with tk, and I thought I'll check the basic library(tcltk) functionallity, just to be sure. Anybody seen that '[tcl] bad window path name .1.' message before? Prof. Philippe Grosjean: yes, I have managed to load most of sciview-R under Wine, except the tcltk library! === R : Copyright 2005, The R Foundation for Statistical Computing Version 2.2.0 (2005-10-06 r35749) ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. [Previously saved workspace restored] library(tcltk) Loading Tcl/Tk interface ... done demo(tkdensity) demo(tkdensity) ~ Type Return to start : require(tcltk) || stop(tcltk support is absent) [1] TRUE require(graphics) [1] TRUE require(stats) [1] TRUE local({ y - NULL xlim - NULL size - tclVar(50.00) dist - tclVar(1.00) kernel - tclVar(gaussian) bw - tclVar(1.00) bw.sav - 1.00 replot - function(...) { if (is.null(y)) re [TRUNCATED] Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = tclObj) : [tcl] bad window path name .1. demo(tkttest) demo(tkttest) ~~~ Type Return to start : require(tcltk) || stop(tcltk support is absent) [1] TRUE require(stats) [1] TRUE local({ dialog.t.test - function() { tt - tktoplevel() tkwm.title(tt, t test) x.entry - tkentry(tt, textvariable = xvar) y.entry - tkentry(tt, textvariable = yvar) alt - tclVar(two.sided) d [TRUNCATED] ** The source for this demo can be found in the file: C:/PROG~FBU/R/R-2_~MVR.0/library/tcltk/demo/tkttest.R ** Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = tclObj) : [tcl] bad window path name .2. __ 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
Re: [R] tk problem with R 2.2.0 on wine/linux
Hello, This is interresting. I think you did the big part of the job if SciViews-R is starting. tcltk is used independently from the rest of SciViews-R, for some dialog boxes and for R Commander. I think you should try now to run tcltk on the plain RGui.exe under wine. I guess it will eliminate various possible interferences... and then, if you succeed, go back to RGui + SciViews-R + tcltk under Wine. Unfortunatelly, I cannot help you much here (except if I have some code to change for a better behaviour of SciViews-R under Wine). For the use of tcltk with RGui.exe under Wine, the best person to contact is the tcltk maintainer, that is, Peter Dalgaard. Best, Philippe Grosjean P.S.: What about the performances of R / SciViews-R under Wine??? ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) ( ( ( ( (Academie Universitaire Wallonie-Bruxelles ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium ( ( ( ( ( ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 ( ( ( ( (email: [EMAIL PROTECTED] ) ) ) ) ) ( ( ( ( (web: http://www.umh.ac.be/~econum ) ) ) ) ) http://www.sciviews.org ( ( ( ( ( .. Hin-Tak Leung wrote: Actually I am trying to run sciview-R and encounted some problems with tk, and I thought I'll check the basic library(tcltk) functionallity, just to be sure. Anybody seen that '[tcl] bad window path name .1.' message before? Prof. Philippe Grosjean: yes, I have managed to load most of sciview-R under Wine, except the tcltk library! === R : Copyright 2005, The R Foundation for Statistical Computing Version 2.2.0 (2005-10-06 r35749) ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. [Previously saved workspace restored] library(tcltk) Loading Tcl/Tk interface ... done demo(tkdensity) demo(tkdensity) ~ Type Return to start : require(tcltk) || stop(tcltk support is absent) [1] TRUE require(graphics) [1] TRUE require(stats) [1] TRUE local({ y - NULL xlim - NULL size - tclVar(50.00) dist - tclVar(1.00) kernel - tclVar(gaussian) bw - tclVar(1.00) bw.sav - 1.00 replot - function(...) { if (is.null(y)) re [TRUNCATED] Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = tclObj) : [tcl] bad window path name .1. demo(tkttest) demo(tkttest) ~~~ Type Return to start : require(tcltk) || stop(tcltk support is absent) [1] TRUE require(stats) [1] TRUE local({ dialog.t.test - function() { tt - tktoplevel() tkwm.title(tt, t test) x.entry - tkentry(tt, textvariable = xvar) y.entry - tkentry(tt, textvariable = yvar) alt - tclVar(two.sided) d [TRUNCATED] ** The source for this demo can be found in the file: C:/PROG~FBU/R/R-2_~MVR.0/library/tcltk/demo/tkttest.R ** Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = tclObj) : [tcl] bad window path name .2. __ 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
[R] locfit: simultaneous confidence band
I'm using the package 'locfit' for nonparametric regression. This package contains the function 'scb' to compute simultaneous confidence bands. The variance of the data is unknown. Up to now I compute a fit with 'locfit'. Afterwards an estimate of the residual variance is computed by the function 'rv'. The weights in the 'scb'-function are set 1/sigma^2 to compute the confidence band. Is this procedure correct or is there any other way to compute confidence bands with unknown variance? Thanks very much for any help you can offer. Michael Gälger __ 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
Re: [R] tk problem with R 2.2.0 on wine/linux
Philippe Grosjean wrote: Hello, This is interresting. I think you did the big part of the job if SciViews-R is starting. tcltk is used independently from the rest of SciViews-R, for some dialog boxes and for R Commander. I think you should try now to run tcltk on the plain RGui.exe under wine. I guess it will eliminate various possible interferences... and then, if you succeed, go back to RGui + SciViews-R + tcltk under Wine. This is what I am trying to do - it seems to be some interaction to the windows manager. I tried running library(tcltk); demo(tkdensity) under native R on linux - it works, but on exit from R, I get a bunch of warning messages like this: Warning messages: 1: X11 protocol error: BadWindow (invalid Window parameter) 2: X11 protocol error: BadWindow (invalid Window parameter) 3: X11 protocol error: BadWindow (invalid Window parameter) 4: X11 protocol error: BadWindow (invalid Window parameter) 5: X11 protocol error: BadWindow (invalid Window parameter) 6: X11 protocol error: BadWindow (invalid Window parameter) 7: X11 protocol error: BadWindow (invalid Window parameter) 8: X11 protocol error: BadWindow (invalid Window parameter) 9: X11 protocol error: BadWindow (invalid Window parameter) 10: X11 protocol error: BadWindow (invalid Window parameter) So it seems the tcltk is doing something not quite correct, and the problem is serious enough under wine to stop the whole thing. Unfortunatelly, I cannot help you much here (except if I have some code to change for a better behaviour of SciViews-R under Wine). For the use of tcltk with RGui.exe under Wine, the best person to contact is the tcltk maintainer, that is, Peter Dalgaard. Best, Philippe Grosjean P.S.: What about the performances of R / SciViews-R under Wine??? It is quite useable - I think screen refreshes and updates are significantly slower, so don't expect to do animations, but the Rgui and Rconsole are not noticeably slower than native. ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) ( ( ( ( (Academie Universitaire Wallonie-Bruxelles ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium ( ( ( ( ( ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 ( ( ( ( (email: [EMAIL PROTECTED] ) ) ) ) ) ( ( ( ( (web: http://www.umh.ac.be/~econum ) ) ) ) ) http://www.sciviews.org ( ( ( ( ( .. Hin-Tak Leung wrote: Actually I am trying to run sciview-R and encounted some problems with tk, and I thought I'll check the basic library(tcltk) functionallity, just to be sure. Anybody seen that '[tcl] bad window path name .1.' message before? Prof. Philippe Grosjean: yes, I have managed to load most of sciview-R under Wine, except the tcltk library! === R : Copyright 2005, The R Foundation for Statistical Computing Version 2.2.0 (2005-10-06 r35749) ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. [Previously saved workspace restored] library(tcltk) Loading Tcl/Tk interface ... done demo(tkdensity) demo(tkdensity) ~ Type Return to start : require(tcltk) || stop(tcltk support is absent) [1] TRUE require(graphics) [1] TRUE require(stats) [1] TRUE local({ y - NULL xlim - NULL size - tclVar(50.00) dist - tclVar(1.00) kernel - tclVar(gaussian) bw - tclVar(1.00) bw.sav - 1.00 replot - function(...) { if (is.null(y)) re [TRUNCATED] Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = tclObj) : [tcl] bad window path name .1. demo(tkttest) demo(tkttest) ~~~ Type Return to start : require(tcltk) || stop(tcltk support is absent) [1] TRUE require(stats) [1] TRUE local({ dialog.t.test - function() { tt - tktoplevel() tkwm.title(tt, t test) x.entry - tkentry(tt, textvariable = xvar) y.entry - tkentry(tt, textvariable = yvar) alt - tclVar(two.sided) d [TRUNCATED] ** The source for this demo can be found in the file:
Re: [R] Male and female symbols?
On 24-Oct-05 Barry Rowlingson wrote: (Ted Harding) wrote: For example -- though I'm not seriously saying I need this -- in a population study of faxes and rabbits surveyed over several years, one might wish to plot the Rabbit population using tiny rabbits as points, and foxes' heads for the Fox population. I cant help thinking now of the graphic shown on the 'Brass Eye' comedy show on Animal Cruelty. Cue totally over-the-top 3d zooming barchart with mad lighting effects, and voice-over: 'If you plot number of animals abused against what makes people cruel versus intelligence of either party, the pattern is so unreadable you might as well draw in a chain of fox heads on sticks. And if you do that, an interesting thing happens: the word cruel starts flashing.' But seriously: you could load in an image with the pixmap package and plot with that: library(pixmap) x - read.pnm(system.file(pictures/logo.ppm, package=pixmap)[1]) plot(1:10,type='n') for(i in 1:10){addlogo(x,px=c(i-.2,i+.2),py=c(i-.2,i+.2))} From there to a chain of fox heads on sticks is a small step. Baz Baz, We know what your day job is. But what's the other one, I begin to wonder? Cheers, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 24-Oct-05 Time: 10:52:33 -- XFMail -- __ 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
Re: [R] Is 64-bit linux compatible version of 'R' available?
On Mon, 24 Oct 2005 [EMAIL PROTECTED] wrote: Hi, Is there any 64-bit compatible version of 'R' available? Yes. See the R-admin manual for how to make one. There are even 64-bit RPMs available. -- 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
[R] Pb with function taxo2phylog (package ade4)
Hello I'm using the package ade4 to obtain classification from a .txt file. I use the following commands: cronquist - read.table(cronquist.txt, h = T, row.names = 8) cronquist - as.taxo(cronquist[7:1]) cro.phy - taxo2phylog(cronquist) in which cronquist.txt is a file with a classification of 218 genus of tree species from french Guiana. We I try to use the function taxo2phylog, I obtain the following error message (in French) : Erreur dans newick2phylog.addtools(res) : la longueur de 'dimnames' [2] n'est pas égale à l'étendue du tableau Error in newick2phylog.addtools(res) : length of dimnames[2] is not equal to length of frame newick2phylog.addtools is a function that is called when taxo2phylog is called when I want to know what is in dimnames[2] I obtain the names of my columns : none is missing. I don't understand what's happening because I've already been using this function with other files and I had no problem Can someone help me? Thanks Christophe Girod _ Apprenez à lutter contre le spam ! __ 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
Re: [R] Pb with function taxo2phylog (package ade4)
Christophe, please send emails related to this package to the ade4 list : http://pbil.univ-lyon1.fr/ADE-4/adelist.html Merci. Christophe Girod wrote: Hello I'm using the package ade4 to obtain classification from a .txt file. I use the following commands: cronquist - read.table(cronquist.txt, h = T, row.names = 8) cronquist - as.taxo(cronquist[7:1]) cro.phy - taxo2phylog(cronquist) in which cronquist.txt is a file with a classification of 218 genus of tree species from french Guiana. We I try to use the function taxo2phylog, I obtain the following error message (in French) : Erreur dans newick2phylog.addtools(res) : la longueur de 'dimnames' [2] n'est pas égale à l'étendue du tableau Error in newick2phylog.addtools(res) : length of dimnames[2] is not equal to length of frame newick2phylog.addtools is a function that is called when taxo2phylog is called when I want to know what is in dimnames[2] I obtain the names of my columns : none is missing. I don't understand what's happening because I've already been using this function with other files and I had no problem Can someone help me? Thanks Christophe Girod _ Apprenez à lutter contre le spam ! __ 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 -- Stéphane DRAY ([EMAIL PROTECTED] ) Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I 43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France Tel: 33 4 72 43 27 57 Fax: 33 4 72 43 13 88 http://www.steph280.freesurf.fr/ __ 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
[R] query on xtable(Sweave)
Dear all, I am exporting to latex a dataframe via xtable(Sweave). My dataframe includes 4 rows and 4 columns. The first two rows containing real values(e.g. a laboratory parameter's mean value), and the two rows at the bottom containing only integers (number of cases). using display=c('fg','fg','fg','fg') as an argument to xtable I tried to reach my goal, of presenting the table with numbers formatted with decimal paces in the upper rows, but with the numbers in the lower rows as integers (without superfluous commas and decimal places), as shown in the example below, Example I: A B C D 0,52 2,52 0,35 3,63 3,52 6,25 3,62 6,36 11121516 14151618 or another example(II): A B C D 11,5 12,5 10,4 13,6 3,52 6,25 12,62 16,3 11121516 14151618 The command used was ... trend_table-xtable(trend.table,caption=Caption,display=c('fg','fg','fg','fg'),size='small') trend_table The R help on xtable states that fg displays 'digits' as number of _significant_ digits. As a result no decimal places are shown in the last two rows, as expected, but no decimal places are shown neither in the first two rows, if the real value in the cell is greater than 10, and only 1 decimal place if the value in the cell is lower than 10. Thus instead of example II, I got in Latex the following data: A B C D 12131014 3,5 6,3 1316 11121516 14151618 I would prefer to show 1 additional decimal in both cases.Thus my question is how to modify the setting for _significant_ digits(in xtable or in Sweave??) in order to print values. thanks for your help, Manuel Manuel __ 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
[R] Spearman's Rho Help!
Hi, I have a dataset with four categories of data, the number of samples are not the same in each category. I want to find the Spearaman's Rho. Let me give an example. x=(14.22770439,26.49420624,46.7277932,19.02550707,23.37379361,16.97789862,19.77100085,23.11270162,13.72929843,33.54430621,14.4756979,70.15811106,11.22789833,NA,NA,NA) y=(143.2420241,45.24260203,62.13218994,27.79050219,27.41029595,191.2759927,141.1430225,234.1600259,37.69120463,156.332942,19.98579421,34.77930022,69.9088,21.92539608,NA,NA) z=(70.28027834,349.7838817,29.81811184,83.48042267,52.47989761,107.7110162,71.24609317,155.6580091,68.37158664,156.3179887,134.8930305,80.25242044,100.5309559,266.4470408,65.4934171,22.86950128) v=(150.2099947,73.52000706,83.18122348,150.3240468,352.9101222,195.8919089,263.9489287,114.2090369,153.5000165,18.62309563,117.2399949,441.8981252,285.3369951,161.3959985,NA,NA) I want to find the spearman's rho for this data. To my knowledge spearman's rho is for x vs. y or x vs. z or any combination. Is there a spearman's rho for the data all together (x y z v)? Please help! Thanks a bunch. suresh __ 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
Re: [R] testing non-linear component in mgcv:gam
In this case the models being compared are really identical, and the P-value is meaningless numerical noise. If your main focus is hypothesis testing and you really need near exact p-values, then do this sort of testing using unpenalized models. i.e. don't have mgcv::gam estimate the EDF of the smooth, just use `s(...,fx=TRUE)' to estimate it unpenalized. This gives horrible point estimates and excellent p-values. best, Simon Hi, I need further help with my GAMs. Most models I test are very obviously non-linear. Yet, to be on the safe side, I report the significance of the smooth (default output of mgcv's summary.gam) and confirm it deviates significantly from linearity. I do the latter by fitting a second model where the same predictor is entered without the s(), and then use anova.gam to compare the two. I thought this was the equivalent of the default output of anova.gam using package gam instead of mgcv. I wonder if this procedure is correct because one of my models appears to be linear. In fact mgcv estimates df to be exactly 1.0 so I could have stopped there. However I inadvertently repeated the procedure outlined above. I would have thought in this case the anova.gam comparing the smooth and the linear fit would for sure have been not significant. To my surprise, P was 6.18e-09! Am I doing something wrong when I attempt to confirm the non- parametric part a smoother is significant? Here is my example case where the relationship does appear to be linear: library(mgcv) This is mgcv 1.3-7 Temp - c(-1.38, -1.12, -0.88, -0.62, -0.38, -0.12, 0.12, 0.38, 0.62, 0.88, 1.12, 1.38, 1.62, 1.88, 2.12, 2.38, 2.62, 2.88, 3.12, 3.38, 3.62, 3.88, 4.12, 4.38, 4.62, 4.88, 5.12, 5.38, 5.62, 5.88, 6.12, 6.38, 6.62, 6.88, 7.12, 8.38, 13.62) N.sets - c(2, 6, 3, 9, 26, 15, 34, 21, 30, 18, 28, 27, 27, 29, 31, 22, 26, 24, 23, 15, 25, 24, 27, 19, 26, 24, 22, 13, 10, 2, 5, 3, 1, 1, 1, 1, 1) wm.sed - c(0.0, 0.016129032, 0.0, 0.062046512, 0.396459596, 0.189082949, 0.054757925, 0.142810440, 0.168005168, 0.180804428, 0.111439628, 0.128799505, 0.193707937, 0.105921610, 0.103497845, 0.028591837, 0.217894389, 0.020535469, 0.080389068, 0.105234450, 0.070213450, 0.050771363, 0.042074434, 0.102348837, 0.049748344, 0.019100478, 0.005203125, 0.101711864, 0.0, 0.0, 0.014808824, 0.0, 0.22200, 0.16700, 0.0, 0.0, 0.0) sed.gam - gam(wm.sed~s(Temp),weight=N.sets) summary.gam(sed.gam) Family: gaussian Link function: identity Formula: wm.sed ~ s(Temp) Parametric coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.084030.01347 6.241 3.73e-07 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 Approximate significance of smooth terms: edf Est.rank F p-value s(Temp) 11 13.95 0.000666 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 R-sq.(adj) = 0.554 Deviance explained = 28.5% GCV score = 0.09904 Scale est. = 0.093686 n = 37 # testing non-linear contribution sed.lin - gam(wm.sed~Temp,weight=N.sets) summary.gam(sed.lin) Family: gaussian Link function: identity Formula: wm.sed ~ Temp Parametric coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.162879 0.019847 8.207 1.14e-09 *** Temp-0.023792 0.006369 -3.736 0.000666 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 R-sq.(adj) = 0.554 Deviance explained = 28.5% GCV score = 0.09904 Scale est. = 0.093686 n = 37 anova.gam(sed.lin, sed.gam, test=F) Analysis of Deviance Table Model 1: wm.sed ~ Temp Model 2: wm.sed ~ s(Temp) Resid. Df Resid. Dev Df Deviance F Pr(F) 1 3.5000e+01 3.279 2 3.5000e+01 3.279 5.5554e-10 2.353e-11 0.4521 6.18e-09 *** Thanks in advance, Denis Chabot __ 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 __ 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
Re: [R] testing non-linear component in mgcv:gam
Looks like a bug in mgcv::summary.gam when the model is strictly parametric... I'll take a look and fix it. thanks, Simon In my original message I mentioned a gam fit that turns out to be a linear fit. By curiosity I analysed it with a linear predictor only with mgcv package, and then as a linear model. The output was identical in both, but the r-sq (adj) was 0.55 in mgcv and 0.26 in lm. In lm I hope that my interpretation that 26% of the variance in y is explained by the linear relationship with x is valid. Then what does r2 mean in mgcv? Denis summary.gam(lin) Family: gaussian Link function: identity Formula: wm.sed ~ Temp Parametric coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.162879 0.019847 8.207 1.14e-09 *** Temp-0.023792 0.006369 -3.736 0.000666 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 R-sq.(adj) = 0.554 Deviance explained = 28.5% GCV score = 0.09904 Scale est. = 0.093686 n = 37 summary(sed.true.lin) Call: lm(formula = wm.sed ~ Temp, weights = N.sets) Residuals: Min 1Q Median 3Q Max -0.6138 -0.1312 -0.0325 0.1089 1.1449 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.162879 0.019847 8.207 1.14e-09 *** Temp-0.023792 0.006369 -3.736 0.000666 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 Residual standard error: 0.3061 on 35 degrees of freedom Multiple R-Squared: 0.285,Adjusted R-squared: 0.2646 F-statistic: 13.95 on 1 and 35 DF, p-value: 0.000666 Le 05-10-05 à 09:45, John Fox a écrit : Dear Denis, Take a closer look at the anova table: The models provide identical fits to the data. The differences in degrees of freedom and deviance between the two models are essentially zero, 5.5554e-10 and 2.353e-11 respectively. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Denis Chabot Sent: Wednesday, October 05, 2005 8:22 AM To: r-help@stat.math.ethz.ch Subject: [R] testing non-linear component in mgcv:gam Hi, I need further help with my GAMs. Most models I test are very obviously non-linear. Yet, to be on the safe side, I report the significance of the smooth (default output of mgcv's summary.gam) and confirm it deviates significantly from linearity. I do the latter by fitting a second model where the same predictor is entered without the s(), and then use anova.gam to compare the two. I thought this was the equivalent of the default output of anova.gam using package gam instead of mgcv. I wonder if this procedure is correct because one of my models appears to be linear. In fact mgcv estimates df to be exactly 1.0 so I could have stopped there. However I inadvertently repeated the procedure outlined above. I would have thought in this case the anova.gam comparing the smooth and the linear fit would for sure have been not significant. To my surprise, P was 6.18e-09! Am I doing something wrong when I attempt to confirm the non- parametric part a smoother is significant? Here is my example case where the relationship does appear to be linear: library(mgcv) This is mgcv 1.3-7 Temp - c(-1.38, -1.12, -0.88, -0.62, -0.38, -0.12, 0.12, 0.38, 0.62, 0.88, 1.12, 1.38, 1.62, 1.88, 2.12, 2.38, 2.62, 2.88, 3.12, 3.38, 3.62, 3.88, 4.12, 4.38, 4.62, 4.88, 5.12, 5.38, 5.62, 5.88, 6.12, 6.38, 6.62, 6.88, 7.12, 8.38, 13.62) N.sets - c(2, 6, 3, 9, 26, 15, 34, 21, 30, 18, 28, 27, 27, 29, 31, 22, 26, 24, 23, 15, 25, 24, 27, 19, 26, 24, 22, 13, 10, 2, 5, 3, 1, 1, 1, 1, 1) wm.sed - c(0.0, 0.016129032, 0.0, 0.062046512, 0.396459596, 0.189082949, 0.054757925, 0.142810440, 0.168005168, 0.180804428, 0.111439628, 0.128799505, 0.193707937, 0.105921610, 0.103497845, 0.028591837, 0.217894389, 0.020535469, 0.080389068, 0.105234450, 0.070213450, 0.050771363, 0.042074434, 0.102348837, 0.049748344, 0.019100478, 0.005203125, 0.101711864, 0.0, 0.0, 0.014808824, 0.0, 0.22200, 0.16700, 0.0, 0.0, 0.0) sed.gam - gam(wm.sed~s(Temp),weight=N.sets) summary.gam(sed.gam) Family: gaussian Link function: identity Formula: wm.sed ~ s(Temp) Parametric coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.084030.01347 6.241 3.73e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Approximate significance of smooth terms:
Re: [R] Spearman's Rho Help!
Suresh Kumar Karanam wrote: Hi, I have a dataset with four categories of data, the number of samples are not the same in each category. I want to find the Spearaman's Rho. Let me give an example. x=(14.22770439,26.49420624,46.7277932,19.02550707,23.37379361,16.97789862,19.77100085,23.11270162,13.72929843,33.54430621,14.4756979,70.15811106,11.22789833,NA,NA,NA) y=(143.2420241,45.24260203,62.13218994,27.79050219,27.41029595,191.2759927,141.1430225,234.1600259,37.69120463,156.332942,19.98579421,34.77930022,69.9088,21.92539608,NA,NA) z=(70.28027834,349.7838817,29.81811184,83.48042267,52.47989761,107.7110162,71.24609317,155.6580091,68.37158664,156.3179887,134.8930305,80.25242044,100.5309559,266.4470408,65.4934171,22.86950128) v=(150.2099947,73.52000706,83.18122348,150.3240468,352.9101222,195.8919089,263.9489287,114.2090369,153.5000165,18.62309563,117.2399949,441.8981252,285.3369951,161.3959985,NA,NA) I want to find the spearman's rho for this data. To my knowledge spearman's rho is for x vs. y or x vs. z or any combination. Is there a spearman's rho for the data all together (x y z v)? Please help! Thanks a bunch. suresh __ 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 In the Hmisc package see rcorr -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] aggregating using several functions
Dear R users, I would like to aggregate a data frame using several functions at once (e.g., mean plus standard error). How can I make this work using aggregate()? The help file says scalar functions are needed; can anyone help? Below is the code for my meanse function which I´d like to use like this: aggregate(dataframe, list(factorA,factoB),meanse) Thanks for your help! Christoph meanse-function(x,...,na.rm=T){ if(na.rm) x-x[!is.na(x)] m-mean(x) s-sd(x) l-length(x) serr-s/sqrt(l) return(data.frame(list(Mean=m,Std.Error=serr))) } __ 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
[R] R Reference Card (especially useful for Newbies)
Newbies (and others!) may find useful the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or through the Contributed link on CRAN (where some other reference cards are also linked). It categorizes and organizes a bunch of R's basic, most used functions so that they can be easily found. For example, paste() is under the Strings heading and expand.grid() is under Data Creation. For newbies struggling to find the right R function as well as veterans who can't quite remember the function name, it's very handy. -- 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
Re: [R] reading data from a pdf
Hi, In my experience pdftotext did not do a very good job at this because it screws up the formatting of tables. This of course depends on what program the pdf document was originally constructed with. What I found most appealing is the use of cut and paste into xemacs or emacs and use M-x canonically-space-region function. This will eliminate any extra spaces. However if the pdf document was prepared through scanning and one uses a character recognition program, then all is up in the air and the formatting of tables have to be done by hand. Jean [EMAIL PROTECTED] wrote: Hi, I'm trying to read data from a PDF file.Is it possible to do it with R? Thanks, Marco If cut and paste to a text file fails, try this: pdftotext (from the xpdf project) or http://pdftohtml.sourceforge.net pdftohtml is a utility which converts PDF files into HTML and XML formats In addition, pdftk, the command line pdf toolkit may be useful http://www.accesspdf.com/pdftk/ __ 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
[R] Compilation package error
Dear all, I tried to install gstat package and add the following compilation error : * Installing *source* package 'gstat' ... creating cache ./config.cache checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking how to run the C preprocessor... gcc -E checking for AIX... no checking for minix/config.h... no checking for POSIXized ISC... no checking for ANSI C header files... yes checking for working const... yes checking whether time.h and sys/time.h may both be included... yes checking for 8-bit clean memcmp... yes checking for vprintf... yes checking for strstr... yes checking for strtod... yes checking for strtol... yes checking for drand48... yes checking for gettimeofday... yes checking whether byte ordering is bigendian... no checking for memory.h... yes checking for ANSI C header files... (cached) yes checking for gcc option to accept ANSI C... checking for function prototypes... yes checking for working const... (cached) yes checking for complex.h... yes checking for malloc.h... yes checking for varargs.h... no checking for size_t... yes checking for working const... (cached) yes checking whether byte ordering is bigendian... (cached) no checking for u_int computing machine epsilon(s) gcc -o macheps ./src/meschach/dmacheps.c gcc -o macheps ./src/meschach/fmacheps.c computing M_MAX_INT gcc -o maxint maxint.c ./src/meschach/maxint.c: In function 'main': ./src/meschach/maxint.c:37: warning: incompatible implicit declaration of built-in function 'printf' checking char \\0 vs. float zeros checking for bcopy... yes checking for bzero... yes checking for function prototypes checking for function prototypes in structures updating cache ./config.cache creating ./config.status creating makefile creating src/config.h creating src/machine.h ** libs gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c block.c -o block.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c chfactor.c -o chfactor.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c copy.c -o copy.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c data.c -o data.o /tmp/ccXDZili.s: Messages de l'assembleur: /tmp/ccXDZili.s:8032: ERREUR: Opérande de relocalisation inconnue: !lituse_jsrdirect make: *** [data.o] Erreur 1 ERROR: compilation failed for package 'gstat' ** Removing '/usr/local/lib/R/site-library/gstat' ** Restoring previous '/usr/local/lib/R/site-library/gstat' --- R run on a dec alpha station under Debian Sarge 64 bits (alpha version of course). Compiler version is gcc 4.0.2. Regards Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] finite mixture model (2-component gaussian): plotting component gaussian components?
Dear R Community, I was finally able to figure out how to plot the components of the finite mixture model. Because it was not obvious, I am including the script here -- in case anyone in the future also needs to do this. Karen --- Karen M. Green, Ph.D. Research Investigator Drug Design Group Sanofi Aventis Pharmaceuticals Tucson, AZ, USA # # name: testMclust1Dplot # # date: 23 October 2005 # # status:validated # # dependencies: package mclust # # purpose: to test the mclust1Dplot function # to test the plot of components # # (0) preliminaries ## library(mclust) ## # (1) get some data ## data(faithful) attach(faithful) eruptions-sort(eruptions) eruptions-data.frame(eruptions) eruptions-as.numeric(eruptions$eruptions) detach(faithful) ## # (2) get model ## MyMixtureModel-summary(EMclust(eruptions),eruptions) ## # (3) plot mixture model ## attach(MyMixtureModel) mclust1Dplot(data=eruptions,z=z,mu=mu,sigmasq=sigmasq,pro=pro,ask=FALSE,type=c(density)) do.call(mclust1Dplot,c(list(data=eruptions,ask=FALSE,type=c(density)),MyMixtureModel)) detach(MyMixtureModel) ## # (4) plot components ## temp - cdens(modelName = MyMixtureModel$modelName,data=eruptions,mu=MyMixtureModel$mu, sigmasq=MyMixtureModel$sigmasq,decomp=MyMixtureModel$decomp) MyMixtureComponents-cbind(eruptions,temp) colnames(MyMixtureComponents)-c(eruptions,component1,component2,component3,component4) MyMixtureComponents-data.frame(MyMixtureComponents) MyMixtureComponents$eruptions-as.numeric(MyMixtureComponents$eruptions) attach(MyMixtureComponents) lines(x=eruptions,y=component1*MyMixtureModel$pro[1],type=l,col=red) lines(x=eruptions,y=component2*MyMixtureModel$pro[2],type=l,col=red) lines(x=eruptions,y=component3*MyMixtureModel$pro[3],type=l,col=red) lines(x=eruptions,y=component4*MyMixtureModel$pro[4],type=l,col=red) detach(MyMixtureComponents) # -Original Message- From: Green, Karen M. PH/US Sent: Thursday, October 20, 2005 6:42 PM To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' Cc: Green, Karen M. PH/US Subject: finite mixture model (2-component gaussian): plotting component gaussian components? Importance: High Dear Knowledgeable R Community Members, Please excuse my ignorance, I apologize in advance if this is an easy question, but I am a bit stumped and could use a little guidance. I have a finite mixture modeling problem -- for example, a 2-component gaussian mixture -- where the components have a large overlap, and I am trying to use the mclust package to solve this problem. I need to decompose that mixture into its 2 components which will need to be plotted. What I don't know how to do is: (1) restrict the number of components to 2 in the EMclust function (2) obtain and plot a component gaussian density Regarding (1), I think this should be the 'G' value but the documentation is somewhat cryptic as regards the format. Regarding (2), I think I need to use the cdens function, but again the documentation is somewhat cryptic. Here is a little test script to illustrate. (Note: my real dataset will not have peaks this well separated, but I needed to find a small example.) ## # (1) get some data ## data(faithful) ## # (2) get model ## library(mclust) MyMixtureModel-summary(EMclust(faithful$eruptions),faithful$eruptions) ## # (3) plot mixture model ## attach(MyMixtureModel) mclust1Dplot(data=faithful$eruptions,z=z,mu=mu,sigmasq=sigmasq,pro=pro,ask=FALSE,type=c(density)) do.call(mclust1Dplot,c(list(data=faithful$eruptions,ask=FALSE,type=c(density)),MyMixtureModel)) ## # (4) plot components ## ??? Any information you might be able to shed on this would be very much appreciated. With appreciation for your help, Karen --- Karen M. Green, Ph.D. Research Investigator Drug Design Group Sanofi Aventis Pharmaceuticals Tucson, AZ USA [[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
[R] Implicit nonlinear equation
I can't find a commande to solve an implicit nonlinear equation. Does it exist please ? __ 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
[R] SOM object manupulation
I am trying to use SOM package to cluster some gene expression data. I got stuck with 2 questions and can't not find any documents to resolve these matters. I would really appreciate if anybody can shed some sort of light. Q1. I clustered the data using SOM function and plotted it using plot function. But I can't figure out how I can list the data elements belongs to different clusters. I made a 5X5 SOM grid and there are 25 clusters. The plot tells me how many data elements belongs to this different cluster grids but I want to make separate list of them. I don't know how to deal with the SOM.objectfrankly speaking. Q2. The SOM package listed 5 functions som.init som som.train som.update and som.project I was wondering to get the best result in what order I should apply them? Should I first initialize the som using som.init, then train it with som.train and finally update it with som.update? Or just use som function followed by som.update? As I have only one set of data I don't think I need to use project function. Thanks in advance and regards. [[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
Re: [R] Any way to add to data frame saved as .rData file?
thx everyone for your help...for simplicity, i elected to stay with a text file and transpose it so that each new row of data is really a column...in this transposed file, the header is really the row labels. the first cell has the name of the row labels (RowID in this case)... here's code for what i ended up doing, in case anyone wants it (or wants to improve it) : outfile - mydata.txt zz - file(outfile, w) rowlabels - c(1:1) cat(c(RowID, rowlabels, \n), file = zz, sep = \t) # make the first row of the file have the row labels grep_text - function(s) # 's' is a unique string that is contained in the col or cols that you want { temp_header - scan(file = outfile, what = list(RowID), flush = TRUE) temp_header - unlist(temp_header) g - grep(toString(s), temp_header) # gives the row number in outfile with the data you want if(length(g)==1) { temp_file - scan(file = outfile, what = character(), skip = g-1, nlines = 1) # temp_file = a vector temp_file - temp_file[2:length(temp_file)] # drop title temp_file - as.numeric(temp_file) # now this is num vector tf_df - as.data.frame(temp_file) } if(length(g)1) { for(i in 1:length(g)) { temp_file - scan(file = outfile, what = character(), skip = g[i]-1, nlines = 1) temp_file - temp_file[2:length(temp_file)] # drop title temp_file - as.numeric(temp_file) # now this is num vector if(i==1) { tf_df - as.data.frame(temp_file) } if(i!=1) { tf_df[i] - temp_file } } } return(tf_df) } you would use grep_text(s) to return a data frame with column titles contained in the string s...if i had a column named Year05_population in the mydata.txt file, to return a data frame named 'df' with only that one column titles Year05_population i would simply type : outfile - mydata.txt df - grep_text(Year05_population) From: Greg Snow [EMAIL PROTECTED] To: [EMAIL PROTECTED],[EMAIL PROTECTED] CC: [EMAIL PROTECTED],r-help@stat.math.ethz.ch Subject: Re: [R] Any way to add to data frame saved as .rData file? Date: Thu, 13 Oct 2005 12:53:10 -0600 Have you looked at the g.data package? It might be useful (but may still require some redesign of your dataset). Greg Snow, Ph.D. Statistical Data Center, LDS Hospital Intermountain Health Care [EMAIL PROTECTED] (801) 408-8111 Ken Termiso [EMAIL PROTECTED] 10/13/05 08:14AM I'd put the extra columns in their own data frame, and save that to disk (use dates/times/process ids or some other unique identifier in the filenames to distinguish them). When you need access to a mixture of columns, load (or source, depending how you did the save) the columns you need, and cbind them together into one big data frame. If you are concerned about memory requirements when producing the pieces, watch out that you don't write out so much data that you'll never have enough memory to load all you need at once. Duncan Murdoch hmm...maybe i should just be dumping to a text file instead of a data frame..is there any way (without using a real SQL database) in R to create a file that i can selectively load certain columns from? if not, maybe i should break the data frame up into pieces (as you suggested) and create a separate file that keeps track of which columns are stored in which files (like a hashtable) and just load the small file of keys each time i need to load something.. whaddya think?? __ 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 __ 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
[R] Problems with pf() with certain noncentral values/degrees of freedom combinations
Hello all. It seems that the pf() function when used with noncentral parameters can behave badly at times. I've included some examples below, but what is happening is that with some combinations of df and ncp parameters, regardless of how large the quantile gets, the same probability value is returned. Upon first glance noncentral values greater than 200 may seem large, but they are in some contexts not large at all. The problems with pf() can thus have serious implications (for example, in the context of sample size planning). I noticed that in in 1999 and 2000 issues with large degrees of freedom came about (PR#138), but I couldn't find the present issue reported anywhere. Might there be a way to make the algorithm more stable? I'm not sure how difficult this issue might be to fix, but hopefully it won't be too bad and can be easily done. Any thoughts on a workaround until then? Thanks, Ken Kelley # Begin example code X - seq(10, 600, 10) # Gets stuck at .99135 round(pf(X, 10, 1000, 225), 5) round(pf(X, 10, 200, 225), 5) round(pf(X, 5, 1000, 225), 5) round(pf(X, 5, 200, 225), 5) round(pf(X, 1, 1000, 225), 5) round(pf(X, 1, 200, 225), 5) # Gets stuck at .97035 round(pf(X, 10, 1000, 250), 5) round(pf(X, 10, 200, 250), 5) round(pf(X, 5, 1000, 250), 5) round(pf(X, 5, 200, 250), 5) round(pf(X, 1, 1000, 250), 5) round(pf(X, 1, 200, 250), 5) # Gets stuck at .93539 round(pf(X, 10, 1000, 275), 5) round(pf(X, 10, 200, 275), 5) round(pf(X, 5, 1000, 275), 5) round(pf(X, 5, 200, 275), 5) round(pf(X, 1, 1000, 275), 5) round(pf(X, 1, 200, 275), 5) # end example code version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor2.0 year 2005 month10 day 06 svn rev 35749 language R -- Ken Kelley, Ph.D. Inquiry Methodology Program Indiana University 201 North Rose Avenue, Room 4004 Bloomington, Indiana 47405 http://www.indiana.edu/~kenkel __ 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
Re: [R] Compilation package error
This is a compiler error, not an R package error. Please ask on a suitable (Debian?) compiler list. As a possible hint, when such things happen on Solaris it indicates a mis-installed gcc, missing the gnu binutils it depends on. On Mon, 24 Oct 2005, Poizot Emmanuel wrote: Dear all, I tried to install gstat package and add the following compilation error : * Installing *source* package 'gstat' ... creating cache ./config.cache checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking how to run the C preprocessor... gcc -E checking for AIX... no checking for minix/config.h... no checking for POSIXized ISC... no checking for ANSI C header files... yes checking for working const... yes checking whether time.h and sys/time.h may both be included... yes checking for 8-bit clean memcmp... yes checking for vprintf... yes checking for strstr... yes checking for strtod... yes checking for strtol... yes checking for drand48... yes checking for gettimeofday... yes checking whether byte ordering is bigendian... no checking for memory.h... yes checking for ANSI C header files... (cached) yes checking for gcc option to accept ANSI C... checking for function prototypes... yes checking for working const... (cached) yes checking for complex.h... yes checking for malloc.h... yes checking for varargs.h... no checking for size_t... yes checking for working const... (cached) yes checking whether byte ordering is bigendian... (cached) no checking for u_int computing machine epsilon(s) gcc -o macheps ./src/meschach/dmacheps.c gcc -o macheps ./src/meschach/fmacheps.c computing M_MAX_INT gcc -o maxint maxint.c ./src/meschach/maxint.c: In function 'main': ./src/meschach/maxint.c:37: warning: incompatible implicit declaration of built-in function 'printf' checking char \\0 vs. float zeros checking for bcopy... yes checking for bzero... yes checking for function prototypes checking for function prototypes in structures updating cache ./config.cache creating ./config.status creating makefile creating src/config.h creating src/machine.h ** libs gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c block.c -o block.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c chfactor.c -o chfactor.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c copy.c -o copy.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c data.c -o data.o /tmp/ccXDZili.s: Messages de l'assembleur: /tmp/ccXDZili.s:8032: ERREUR: Opérande de relocalisation inconnue: !lituse_jsrdirect make: *** [data.o] Erreur 1 ERROR: compilation failed for package 'gstat' ** Removing '/usr/local/lib/R/site-library/gstat' ** Restoring previous '/usr/local/lib/R/site-library/gstat' --- R run on a dec alpha station under Debian Sarge 64 bits (alpha version of course). Compiler version is gcc 4.0.2. Regards Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 -- 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
Re: [R] question about technieque do with large computation
ronggui wrote: The green book tells:The basic technique is classic :keep it simple .A long ,complicated expression or function is less fravorable than a relatively small computations that combines calls to a few other functions to perform its tasks. But I don't get the point totally.Can anyone give me an example to make me understand this rules totally? ps: Is it mean that f1 is better than f2? Thank you! f1-function(x){ n-length(x) s-sum(x) m-s/n} f2- function(x){ m-sum(x)/length(x)} No, it means collecting sensible small parts of the code into separate functions as in f1 - function(x, .){ x1 - f1a(x, ..) x2 - f1b(x1, .) x3 - f1a(x2, .) f1c(x1, x2, x3, .) } which is better than f2 - function(.){ ## ## many lines calculating stuff as in f1a ## ## many lines calculating stuff as in f1b ## ## many lines calculating stuff as in f1a ## ## many lines calculating stuff as in f1c ## } Uwe Ligges 2005-10-23 -- Deparment of Sociology Fudan University My new mail addres is [EMAIL PROTECTED] Blog:http://sociology.yculblog.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ 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
Re: [R] Strange update behavior of gregmisc
Googling for gregmisc update points us, e.g., to http://tolstoy.newcastle.edu.au/~rking/R/devel/05/06/1140.html Uwe Ligges Thomas Schönhoff wrote: Hello, I notice an odd behavior of gregmisc package when using update.packages() via R --no-save (as root). Every time I launch update.packages() gregmisc is repeatedly selected for upgrade. Current available version of gregmisc is 2.08 according to 'installed.packages()'. Despite I obviousely have already installed the most up to date gregmisc, gregmisc will be updated repeatedly? No one seems to have noticed a similar behavior like this before according to mail archive. All dependencies are seemingly meet and no error messages occured, so I am kind of stuck to figure out what happens here. Here is my update session: thomas# R --no-save --- update.packages() --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done gregmisc : Version 2.0.6 installed in /usr/lib/R/site-library Version 2.0.8 available at http://pangora.org/cran Update (y/N/c)? y try URL 'http://pangora.org/cran/src/contrib/gregmisc_2.0.8.tar.gz' Content type 'application/x-tar' length 901 bytes URL opened == downloaded 901 bytes * Installing *source* package 'gregmisc' ... No man pages found in package 'gregmisc' ** building package indices ... * DONE (gregmisc) The downloaded packages are in /tmp/Rtmp4Thydf/downloaded_packages -- When I relaunch 'update.packages()' the same as desribed above is going to happen again? Do I miss something? regards Thomas My system (Debian Sarge): platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major2 minor2.0 year 2005 month10 day 06 svn rev 35749 language R __ 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 __ 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
Re: [R] Compilation package error
Please, tell us more about the packages and libraries installed. I did compile and installed gstat on a machine running sid64 (unstable) with no problems. The only thing is that I did not compile with the -mieee-with-inexact switch. Hope this helps. On Monday 24 October 2005 17:07, Poizot Emmanuel wrote: Dear all, I tried to install gstat package and add the following compilation error : * Installing *source* package 'gstat' ... creating cache ./config.cache checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking how to run the C preprocessor... gcc -E checking for AIX... no checking for minix/config.h... no checking for POSIXized ISC... no checking for ANSI C header files... yes checking for working const... yes checking whether time.h and sys/time.h may both be included... yes checking for 8-bit clean memcmp... yes checking for vprintf... yes checking for strstr... yes checking for strtod... yes checking for strtol... yes checking for drand48... yes checking for gettimeofday... yes checking whether byte ordering is bigendian... no checking for memory.h... yes checking for ANSI C header files... (cached) yes checking for gcc option to accept ANSI C... checking for function prototypes... yes checking for working const... (cached) yes checking for complex.h... yes checking for malloc.h... yes checking for varargs.h... no checking for size_t... yes checking for working const... (cached) yes checking whether byte ordering is bigendian... (cached) no checking for u_int computing machine epsilon(s) gcc -o macheps ./src/meschach/dmacheps.c gcc -o macheps ./src/meschach/fmacheps.c computing M_MAX_INT gcc -o maxint maxint.c ./src/meschach/maxint.c: In function 'main': ./src/meschach/maxint.c:37: warning: incompatible implicit declaration of built-in function 'printf' checking char \\0 vs. float zeros checking for bcopy... yes checking for bzero... yes checking for function prototypes checking for function prototypes in structures updating cache ./config.cache creating ./config.status creating makefile creating src/config.h creating src/machine.h ** libs gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c block.c -o block.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c chfactor.c -o chfactor.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c copy.c -o copy.o gcc -I/usr/lib/R/include -mieee-with-inexact -fPIC -g -O2 -c data.c -o data.o /tmp/ccXDZili.s: Messages de l'assembleur: /tmp/ccXDZili.s:8032: ERREUR: Opérande de relocalisation inconnue: !lituse_jsrdirect make: *** [data.o] Erreur 1 ERROR: compilation failed for package 'gstat' ** Removing '/usr/local/lib/R/site-library/gstat' ** Restoring previous '/usr/local/lib/R/site-library/gstat' --- R run on a dec alpha station under Debian Sarge 64 bits (alpha version of course). Compiler version is gcc 4.0.2. Regards Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 -- * Miguel A. Arranz Tol-Project [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
[R] How to create a new data.frame with all possible observations
I would like to use something like expand.grid to get a data.frame with all possible combinations of model terms from a formula. For example: R dat=data.frame(y=rnorm(8), + trt=rep(c(A,B),4), + state=c(rep(c('IA','NE'),each=4)), + county=c('P','P','S','S','J','J','N','N')) R dat=dat[-1,] R dat y trt state county 2 0.36 B IA P 3 0.44 A IA S 4 2.26 B IA S 5 -0.12 A NE J 6 0.84 B NE J 7 -2.11 A NE N 8 -0.69 B NE N If my model is model=formula(y~trt+state + county%in%state) Then I would like to create a data.frame that includes the missing observation for A + IA + P %in IA (trt + state + county %in% state) I currently use expand.grid to get all possible combinations of variables, then delete impossible combinations like J %in IA. This works, but is a bit clumsy and I wonder if there is a more general solution. Ideas welcome. Kevin Wright [[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
[R] Out of memory
Hi, I am using gamm and I run out of memory and R crashes. I have tried to change the amount of memory in R using memory.limit as so far the largest it has allowed memory.limit(size=3072) still ahs this problem. If I try to use max I get the following error memory.limit(memory.size(max=TRUE)) Error in memory.size(size) : don't be silly!: your machine has a 4Gb address limit Does anyone have any sugestions on how to get more memory ot R? Thanks, Elizabeth Lawson - [[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
Re: [R] Out of memory
On 10/24/2005 2:27 PM, Elizabeth Lawson wrote: Hi, I am using gamm and I run out of memory and R crashes. I have tried to change the amount of memory in R using memory.limit as so far the largest it has allowed memory.limit(size=3072) still ahs this problem. If I try to use max I get the following error memory.limit(memory.size(max=TRUE)) Error in memory.size(size) : don't be silly!: your machine has a 4Gb address limit Does anyone have any sugestions on how to get more memory ot R? Notice that those functions report sizes in bytes, but memory.limit takes input in megabytes. That's the reason for the don't be silly message. To get more than 3 GB out of R, you're probably going to have to run a 64 bit version. The theoretical limit for 32 bit versions is 4 GB, but most OS's reserve 1-2 GB for themselves. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error in step() (or stepAIC) for Cox model
Hello all, I am trying to use stepwise procedure to select covariates in Cox model and use bootstrap to repeat stepwise selection, then record how many times variables are chosen by step() in bootstrap replications. When I use step() (or stepAIC) to do model selection, I got errors. Here is the part of my code for (j in 1:mm){#--mm=10 for (b in 1:nrow(reg.bs)){ #--bootstrap 10 times mi-data.frame(tlfup,cen,complete(imp,j)) #--completed data sets after MI in.star-sample(1:n,n,replace=T) #--to sample id number 1-1851. data.star-mi[in.star,] M-coxph(Surv(tlfup,cen)~mi$trt+mi$nodes+mi$htypeed1+mi$htypeed2+mi$ngra ded2+mi$agem40 +mi$agem40sq+mi$er+mi$pr,data=data.star) reg.model-step(M) #--do stepwise selection reg.step[[b]]-c((reg.model$coef)) #-store selected variables chosen.vb[[b]]-names(reg.step[[b]]) #--store names of selected variables } tot.vb[[j]]-c(unlist(chosen.vb)) } Error in reg.step[[b]] : subscript out of bounds varibles-unlist(tot.vb) #--change to a vector table(varibles) #--how many times the names have been selected Error in sort(unique.default(x), na.last = TRUE) : 'x' must be atomic I figure the reason may be that when stepwise procedure selects the chosen model with no varibles, that is Start: AIC= 12436.85 Surv(tlfup, cen) ~ mi$trt + mi$nodes + mi$htypeed1 + mi$htypeed2 + mi$ngraded2 + mi$agem40 + mi$agem40sq + mi$er + mi$pr Df AIC - mi$pr1 12435 - mi$trt 1 12435 - mi$agem40sq 1 12435 - mi$agem401 12435 - mi$htypeed2 1 12435 - mi$nodes 1 12435 - mi$er1 12436 - mi$ngraded2 1 12436 - mi$htypeed1 1 12436 none 12437 Step: AIC= 12425.91 Surv(tlfup, cen) ~ mi$htypeed1 + mi$ngraded2 + mi$er Df AIC - mi$er1 12425 - mi$ngraded2 1 12425 - mi$htypeed1 1 12426 none 12426 Step: AIC= 12424.77 Surv(tlfup, cen) ~ 1 then reg.model$coef dosen't exist anymore (am I right?), but I need to count the variables that are selected by step() in bootstrap replications, what should I do? Thanks, Jia [[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
Re: [R] Strange update behavior of gregmisc
Hello, 2005/10/24, Uwe Ligges [EMAIL PROTECTED]: Googling for gregmisc update points us, e.g., to http://tolstoy.newcastle.edu.au/~rking/R/devel/05/06/1140.html Thanks, I totally missed that. Thomas __ 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
[R] lme and lmer syntax
Hi, I have this: lme(y~x1+x2,random=~1|x1/x2) How to make this random effect using lmer? I try this: lmer(y~x1+x2+(1|x1/x2) But it dont work. Any idea? Thanks Ronaldo -- System halted! -- | // | \\ [***] | ( õ õ ) [Ronaldo Reis Júnior] | V [UFV/DBA-Entomologia] |/ \ [36570-000 Viçosa - MG ] | /(.''`.)\ [Fone: 31-3899-4007 ] | /(: :' :)\ [EMAIL PROTECTED]] |/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ] |( `- ) [***] | _/ \_Powered by GNU/Debian Woody/Sarge __ 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
Re: [R] Error in step() (or stepAIC) for Cox model
On Mon, 24 Oct 2005, Li, Jia wrote: Hello all, I am trying to use stepwise procedure to select covariates in Cox model and use bootstrap to repeat stepwise selection, then record how many times variables are chosen by step() in bootstrap replications. When I use step() (or stepAIC) to do model selection, I got errors. Here is the part of my code for (j in 1:mm){#--mm=10 for (b in 1:nrow(reg.bs)){ #--bootstrap 10 times mi-data.frame(tlfup,cen,complete(imp,j)) #--completed data sets after MI in.star-sample(1:n,n,replace=T) #--to sample id number 1-1851. data.star-mi[in.star,] M-coxph(Surv(tlfup,cen)~mi$trt+mi$nodes+mi$htypeed1+mi$htypeed2+mi$ngra ded2+mi$agem40 +mi$agem40sq+mi$er+mi$pr,data=data.star) reg.model-step(M) #--do stepwise selection reg.step[[b]]-c((reg.model$coef)) #-store selected variables chosen.vb[[b]]-names(reg.step[[b]]) #--store names of selected variables } tot.vb[[j]]-c(unlist(chosen.vb)) } Error in reg.step[[b]] : subscript out of bounds varibles-unlist(tot.vb) #--change to a vector table(varibles) #--how many times the names have been selected Error in sort(unique.default(x), na.last = TRUE) : 'x' must be atomic I figure the reason may be that when stepwise procedure selects the chosen model with no varibles, that is Start: AIC= 12436.85 Surv(tlfup, cen) ~ mi$trt + mi$nodes + mi$htypeed1 + mi$htypeed2 + mi$ngraded2 + mi$agem40 + mi$agem40sq + mi$er + mi$pr Df AIC - mi$pr1 12435 - mi$trt 1 12435 - mi$agem40sq 1 12435 - mi$agem401 12435 - mi$htypeed2 1 12435 - mi$nodes 1 12435 - mi$er1 12436 - mi$ngraded2 1 12436 - mi$htypeed1 1 12436 none 12437 Step: AIC= 12425.91 Surv(tlfup, cen) ~ mi$htypeed1 + mi$ngraded2 + mi$er Df AIC - mi$er1 12425 - mi$ngraded2 1 12425 - mi$htypeed1 1 12426 none 12426 Step: AIC= 12424.77 Surv(tlfup, cen) ~ 1 then reg.model$coef dosen't exist anymore (am I right?), but I need to count the variables that are selected by step() in bootstrap replications, what should I do? Specify the lower scope suitably. -- 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
Re: [R] lme and lmer syntax
Ronaldo See the article on lmer pasted below for syntax. It is the only current source documenting the code. In lmer(), the nesting structure for the ranmdom effects is handled in a slightly different way. If your observations are nested as you note, then you can use lmer(y~x1 + x2 +(1|x1) + (1|x2), data) @Article{Rnews:Bates:2005, author = {Douglas Bates}, title= {Fitting Linear Mixed Models in {R}}, journal = {R News}, year = 2005, volume = 5, number = 1, pages= {27--30}, month= {May}, url = {http://CRAN.R-project.org/doc/Rnews/}, } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ronaldo Reis-Jr. Sent: Monday, October 24, 2005 3:56 PM To: R-Help Subject: [R] lme and lmer syntax Hi, I have this: lme(y~x1+x2,random=~1|x1/x2) How to make this random effect using lmer? I try this: lmer(y~x1+x2+(1|x1/x2) But it dont work. Any idea? Thanks Ronaldo -- System halted! -- | // | \\ [***] | ( õ õ ) [Ronaldo Reis Júnior] | V [UFV/DBA-Entomologia] |/ \ [36570-000 Viçosa - MG ] | /(.''`.)\ [Fone: 31-3899-4007 ] | /(: :' :)\ [EMAIL PROTECTED]] |/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ] |( `- ) [***] | _/ \_Powered by GNU/Debian Woody/Sarge __ 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 __ 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
[R] Basic: setting resolution and size of an R graphic
Dear List, I am sorry if this perhaps a too basic question, but I have not found an answer in Google or in the R help system. I am trying to use R to do a very simple analysis of some data (RT-PCR and Western analysis) with a T-test and to plot the results as a histogram with error bars. (I have pasted an example script at the bottom of this mail). In order to use this for publication, I would like to adjust the resolution and size of the final image. However, even using file types such as postscript or pdf that are vector based, I get rather bad-looking results with pdf(file=test.pdf) source(script at bottom of mail) dev.off() using either pdf or postscript or jpg devices. Therefore I would like to ask the list, how to best produce a graphic from the script below that would fit into one column of a published article and have a high resolution (as eps, or failing that tiff or png)? Thanks in advance for any advice, Peter ## Western.R ## A script to display the results of quantitative Western blotting with 6 repeats each at three dosages. ## This particular script has data from stimulation of fibroblasts with M-wt. # -- CONVENIENCE FUNCTIONS - # ## Define a simple function to draw the error bars. makeBars - function(x,mean,se){ segments(x,mean - se/2,x,mean+se/2) segments(x-0.1,mean - se/2,x+0.1,mean - se/2) segments(x-0.1,mean + se/2,x+0.1,mean + se/2) } ##Define a simple function to write p values writeP - function(x,mean,se,pval) { if (pval = 0.01) { # text(x, mean + se/2 + 0.25, sprintf('p=%.2f',pval),cex=1.5) text(x +0.05, mean + se/2 + 0.4, sprintf('*'),cex=1) } else { text(x +0.05, mean + se/2 + 0.4, sprintf('**'),cex=1) } } ## define function to draw entire group ## A,B,C refer to the x positions of the x,y,z observations drawBarsAndPValueForGroup - function(A,B,C,x.mean,x.se,y.mean,y.se,z.mean,z.se,xy.pval,xz.pval) { makeBars(A,x.mean,x.se) makeBars(B,y.mean,y.se) makeBars(C,z.mean,z.se) writeP(B - 0.05, y.mean,y.se,xy.pval) writeP(C -0.05,z.mean,z.se,xz.pval) } ## We will make a two part graphic par(mfrow=c(1,2)) ## X: 0 ## y: 0.2 µM ## z: 0.4 µM yTop - 12 ## Limit for Y axis ## --- RT-PCR MMP1 --- ## x - c(0.8839034,0.42011158,0.65318013 , 0.88494528,1.900606, 1.2572536 ) x.mean - mean(x) x.se - sd(x) / sqrt(length(x)) y - c(5.067579666,2.630677502,1.881902881,1.61994864,3.356066695 ) y.mean - mean(y) y.se - sd(y)/ sqrt(length(y)) z - c(13.38923048,3.677270765,3.559984278,10.83628903,12.20110874,12.8957108) z.mean - mean(z) z.se - sd(z)/ sqrt(length(z)) ## -- Do t test and calculate the p values -- ## xy.t - t.test(y,x, alternative=c(greater),var.equal=TRUE) xy.pval - xy.t$p.value xz.t - t.test(z, x, alternative=c(greater),var.equal=TRUE) xz.pval - xz.t$p.value arr - c(x.mean,y.mean,z.mean) mat - matrix(arr,nrow=3,byrow=F) barplot(mat, ## The data beside=TRUE, ## juxtapose values in each column rather than stacking them ylim=c(0,yTop), ## limits for y axis xlim=c(0,3), width=1, space=c(0,0.1),##space: the amount of space (as a fraction of the average bar width) ## left before each bar. beside=TRUE, can be given ## by 2 numbers, the space between bars within a group ## and space betweens bars of different groups names=c('0.0 µM','0.2 µM','0.4 µM'), ylab='Relative Change', col=c('white'), cex.names=1, cex.axis=1,##cex.axis: expansion factor for numeric axis labels. cex.lab=1) ## First for the RT-PCR group start - 0.1 first - start + 0.5 second - start + 1.5 third - start + 2.5 drawBarsAndPValueForGroup(first,second,third,x.mean,x.se,y.mean,y.se,z.mean,z.se,xy.pval,xz.pval) ## --- Western MMP1 --- ## x2 - c(1.117373856,0.690266558,1.192359586 ) y2 - c(3.53806369,3.895634049,6.653024511 ) z2 - c(8.609814741,3.858564979,8.492977115) x2.mean - mean(x2) x2.se - sd(x2) / sqrt(length(x2)) y2.mean - mean(y2) y2.se - sd(y2)/ sqrt(length(y2)) z2.mean - mean(z2) z2.se - sd(z2)/ sqrt(length(2)) ## -- Do t test and calculate the p values -- ## xy2.t - t.test(y2,x2, alternative=c(greater),var.equal=TRUE) xy2.pval - xy2.t$p.value xz2.t - t.test(z2,x2,alternative=c(greater),var.equal=TRUE) xz2.pval - xz2.t$p.value arr - c(x2.mean, y2.mean,z2.mean) mat - matrix(arr,nrow=3,byrow=F) ## mat now has the values of each type of experiment in individual columns barplot(mat, ## The date beside=TRUE, ## juxtapose values in each column rather than stacking them ylim=c(0,yTop), ## limits for y axis xlim=c(0,4), width=1, space=c(0,0.1),##space: the amount of space (as a fraction of the average bar width) ## left before each bar. beside=TRUE, can be
[R] error messages in matrix multiplication
Hello, I am hoping for some advice on using R - my experience with statistical programs has been limited to SPSS. I have been using a textual analysis program and wanted to add some rigour to making a choice between two models of self-reported cannabis effects. To do this, I need to compare the two resulting word co-occurence matrices. The program itself,doesn't offer this as an option and the person who wrote the program, told me where the numerical data was located and offered this advice: For two vectors a and b, the cosine similarity is: therefore cos theta = a . b / magn(a)*magn(b) that the formula is really identical for matrices. The dot product (or inner product) is calculated by multiplying each pair of corresponding elements from the two matrices, and summing these products. Calculating the magnitude of a matrix is really the same as a vector: square each element of the matrix, sum the squares, then take the square root of the sum. I have been advised that when matrices are multiplied I should use %*%, whereas if I want a point estimate I omit the %. I have tried to run syntax with and without the %, however my efforts at either syntax below (a) or syntax (b) remain unsuccessful. With (a) I obtain the message - Warning message: Error in A %*% B : non-conformable arguments With (b) I obtain the message - Warning message:NAs produced by integer overflow in: sum(A * A) * sum(B * B) : (a) Matrix testA -read.table(c:\\matrixA.txt,header=T) testB -read.table(c:\\matrixB.txt,header=T) A-as.matrix(testA) B-as.matrix(testB) cosineDissimilarity - sum(A%*%B)/sqrt(sum(A%*%A)*sum(B%*%B)) (b) pointwise testA -read.table(c:\\matrixA.txt,header=T) testB -read.table(c:\\matrixB.txt,header=T) A-as.matrix(testA) B-as.matrix(testB) cosineDissimilarity - sum(A*B)/sqrt(sum(A*A)*sum(B*B)) Any suggestions are appreciated, regarding either the above logic about analysis selection or the necessary syntax. regards Bob __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Basic: setting resolution and size of an R graphic
On Mon, 2005-10-24 at 22:32 +0200, Dr. med. Peter Robinson wrote: Dear List, I am sorry if this perhaps a too basic question, but I have not found an answer in Google or in the R help system. I am trying to use R to do a very simple analysis of some data (RT-PCR and Western analysis) with a T-test and to plot the results as a histogram with error bars. (I have pasted an example script at the bottom of this mail). In order to use this for publication, I would like to adjust the resolution and size of the final image. However, even using file types such as postscript or pdf that are vector based, I get rather bad-looking results with pdf(file=test.pdf) source(script at bottom of mail) dev.off() using either pdf or postscript or jpg devices. Therefore I would like to ask the list, how to best produce a graphic from the script below that would fit into one column of a published article and have a high resolution (as eps, or failing that tiff or png)? Thanks in advance for any advice, Peter Snip of code What OS are you on? Running your example on FC4, I get the attached output for a pdf(). I suspect that on your OS, the height and width arguments are not appropriate by default. Thus, you may need to adjust your pdf (or postscript) function call to explicitly specify larger height and width arguments. Also note that to generate an EPS file, pay attention to the details section of ?postscript, taking note of the 'onefile', 'horizontal' and 'paper' arguments and settings. Also, check with your journal to see if they specify dimensions for such graphics so that you can abide by their specs if provided. If they are using LaTeX, there are means of specifying and/or adjusting the height and/or width specs in the code based upon proportions of various measures (ie. \includegraphics[width=0.9\textwidth]{GraphicsFile.eps} ). HTH, Marc Schwartz test.pdf Description: Adobe PDF document __ 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
Re: [R] Male and female symbols?
If you have image files of your plotting symbols (fox and rabbits) then one approach is to follow the example in the post at: http://tolstoy.newcastle.edu.au/~rking/R/help/05/08/10890.html hope this helps, Greg Snow, Ph.D. Statistical Data Center, LDS Hospital Intermountain Health Care [EMAIL PROTECTED] (801) 408-8111 Ted Harding [EMAIL PROTECTED] 10/22/05 08:58AM George's query somewhat leads on to a more general question: Can one define one's own symbols for plotting? For example -- though I'm not seriously saying I need this -- in a population study of faxes and rabbits surveyed over several years, one might wish to plot the Rabbit population using tiny rabbits as points, and foxes' heads for the Fox population. (Given the data coordinates, I would have my own ways to do this; but not in R). Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 22-Oct-05 Time: 15:55:41 -- XFMail -- __ 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 __ 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
[R] stepAIC formula upper limit guidelines
Hello, I am attempting to refine an lm()-generated model using the stepAIC function. My model has approximately 20 inputs and I am trying to determine the best upper limit scope for using those inputs. My lower limit is y ~ 1 and my original upper limit was y ~ x1 + x2 + ... + x20. This is great start, but I am wondering if some other (more broad) upper limit would allow for combinations of inputs (examples: x1*x3 or x5/x7) before the coefficients are applied. Specifically, I am trying to determine what syntax will give stepAIC the most flexibility to slice and dice my inputs as it searches for the best possible model. Any details or references would be immensely appreciated. Thank you, Tate Avery __ 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
[R] selecting every nth item in the data
I want to make a glm and then use predict. I have a fairly small sample (4000 cases) and I want to train on 90% and test on 10% but I want to do it in slices so I test on every 10th case and train on the others. Is there some simple way to get these elements? Stephen -- 21/10/2005 [[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
Re: [R] selecting every nth item in the data
On 25 Oct 2005 at 13:48, Stephen Choularton wrote: From: Stephen Choularton [EMAIL PROTECTED] To: R Help r-help@stat.math.ethz.ch Date sent: Tue, 25 Oct 2005 13:48:42 +1000 Subject:[R] selecting every nth item in the data I want to make a glm and then use predict. I have a fairly small sample (4000 cases) and I want to train on 90% and test on 10% but I want to do it in slices so I test on every 10th case and train on the others. Is there some simple way to get these elements? As glm accept subet you probably can use test-seq(1,4000,n) glm(, subset = test) to select only n'th item or glm(, subset = -test) to select all but n'th items. or you can split the data freme by mydf[test,] or mydf[-test,] HTH Petr Stephen -- 21/10/2005 [[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 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
[R] Examples of classwt, strata, and sampsize in randomForest?
Just browsing the documentation, and searching the list came up short... I have some unbalance data and was wondering if, in a 0 v 1 classification forest, if these options might yield better predictions when the proportion of one class is low (less than 10% in a sample of 2,000 observations). Not sure how to specify these terms... from the docs, we have: classwt: Priors of the classes. Need not add up to one. Ignored for regression. So is this something like ... classwt=c(.90,.10) ? I didn't see the syntax demonstrated. Similar for strata and sampsize though there is a default for sampsize that makes sense... not sure how you would make a vector of the length the number of strata, however Pointers? -- --- David L. Van Brunt, Ph.D. mailto:[EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html