[R] sample variogram construction
Hi Im attempting to build a sample variogram for 300 obersvations of longitudinal data. So what I need to do is compute the half squared differences between pairs of residuals (for instance if a subject has 4 obersvations, this is 4 choose 2 paird differences) for each subject. Also, then I need the corresponding time differences within each individual. So the end result will be a 300 by 2 matrix with columns corresponding to paired difference residuals within subject and time differences within subject. Basically im having trouble coding this kind of matrix in R, if anyone can help me out or give me some tips id appreciate it. Thanks. Stuck in the for loop student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] grouping for lme with nested repeated measurements
1.The simple problem ist that i have different Samples , from which i make repeated measurements (each sample is measured 6 times) and i repeat this experiment over several Days, so i get the lme grouping term random=~1|Days/Sample. I would rather specify this as: random= ~ 1 | Sample/Days, but I am not quite sure how this affects the model. 2. Now i am measuring with 2 different measuring Apparatus the same Sample each 6 times, to see how big the difference from the appratus is. Because Apparatus is on the level of repeated measurements i cant write Days/Sample/Apparatus. the lme function offers a list() feature to design the grouping, but i didnt understand this, if it is the solution to the problem. Why would you want to include the Apparatus in the random effect? I assume that you are interested in differences and thus, this is a fixed effect: lme (fixed= response ~ apparatus, data= XX, random= ~ 1 | Sample/Days) Lorenz - Lorenz Gygax, [EMAIL PROTECTED] Centre for proper housing of ruminants and pigs Swiss Federal Veterinary Office __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] grouping for lme with nested repeated measurements
A variable is considered to be nested when it is unique within that combination. i.e. if your measuring Apparatus was different at each sample. Hence, as Lorenz suggested it is reasonable to treat Apparatus as fixed, specially if you are considering making comparisons between the 2 apparatus. I hope that this helps Francisco From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: [R] grouping for lme with nested repeated measurements Date: Mon, 25 Oct 2004 08:11:21 +0200 1.The simple problem ist that i have different Samples , from which i make repeated measurements (each sample is measured 6 times) and i repeat this experiment over several Days, so i get the lme grouping term random=~1|Days/Sample. I would rather specify this as: random= ~ 1 | Sample/Days, but I am not quite sure how this affects the model. 2. Now i am measuring with 2 different measuring Apparatus the same Sample each 6 times, to see how big the difference from the appratus is. Because Apparatus is on the level of repeated measurements i cant write Days/Sample/Apparatus. the lme function offers a list() feature to design the grouping, but i didnt understand this, if it is the solution to the problem. Why would you want to include the Apparatus in the random effect? I assume that you are interested in differences and thus, this is a fixed effect: lme (fixed= response ~ apparatus, data= XX, random= ~ 1 | Sample/Days) Lorenz - Lorenz Gygax, [EMAIL PROTECTED] Centre for proper housing of ruminants and pigs Swiss Federal Veterinary Office __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Plotting Bivariate Normal Data
JohnF == John Fox [EMAIL PROTECTED] on Sun, 24 Oct 2004 12:37:09 -0400 writes: JohnF Dear Sarah, If the data are allegedly bivariate JohnF normal, then they are probably two vectors, not JohnF one. Assuming that this is the case, I know of JohnF nothing quite as neat as a univariate QQ plot to JohnF check visually for bivariate normality (perhaps JohnF someone else has a suggestion here), but you could JohnF superimpose bivariate-normal contours on a JohnF scatterplot of the data, perhaps along with a JohnF bivariate density estimate. The car and ellipse JohnF packages can do the former, while the locfit and sm JohnF packages (and possibly others) can do the latter. Since one of the more severe and common deviations from normality is long tailedness (in all it's vaguety), we have been recommending to QQ-plot mahalanobis distances against chi squared quantiles - even before looking at the univariate QQ plots. Exactly for this reason, in R, example(mahalanobis) shows a version of how to do this! Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
Actually, you are unable to connect to the Internet from R on your computer. Perhaps you are not connected, or need to set a proxy? Please read the rw-FAQ, as the posting guide asks. Note that right now you there are no packages on CRAN and Bioconductor has not yet released packages for R 2.0.x. The first is a short-term problem, and the second needs a little patience (look at http://www.bioconductor.org which has variously mentioned Oct 25 and Nov 1). On Mon, 25 Oct 2004, shizhu zang wrote: Hi , there: I used function source to download the package but found source(http://www.bioconductor.org/getBioC.R;) Error in file(file, r) : unable to open connection In addition: Warning message: unable to resolve 'www.bioconductor.org'. Then I downloaded the packages from CRAN and found local({a - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a, dependencies=TRUE)}) trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES' Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES' In addition: Warning message: unable to resolve 'cran.r-project.org'. I use the Window operation system I don't konw what is the matter 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Multiple formula in one block
Hi Everybody: I want to draw some chart using command histogram and add another curve in it. Example: require(stats) data(singer) library(lattice) histogram( ~ height | voice.part, data = singer, nint = 17, endpoints = c(59.5, 76.5), layout = c(2,4), aspect = .5, xlab = Height (inches)) Now I got a chart of 8 blocks, then I need add : abline(v=mean(singer$height), col=2, lwd=2) or any other curve to every block. How can I do to achieve it. Thanks. Best Regards YiYao Jiang Product Division/ product Testing Department Semiconductor Manufacturing International Corporation 18 ZhangJiang Road, PuDong New Area, Shanghai ZIP: 201203 Tel:86-21-5080-2000 Ext. 15173 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Multiple formula in one block
Hi YiYao, you need the `?panel.abline()' function, somehing like: panel=function(x, breaks, equal.widths, type, ...){ panel.histogram(x, breaks, equal.widths, type, ...) panel.abline(v=mean(singer$height)) } inside the `histogram()' function could do the trick. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: YiYao_Jiang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: YiYao_Jiang [EMAIL PROTECTED] Sent: Monday, October 25, 2004 9:16 AM Subject: [R] Multiple formula in one block Hi Everybody: I want to draw some chart using command histogram and add another curve in it. Example: require(stats) data(singer) library(lattice) histogram( ~ height | voice.part, data = singer, nint = 17, endpoints = c(59.5, 76.5), layout = c(2,4), aspect = .5, xlab = Height (inches)) Now I got a chart of 8 blocks, then I need add : abline(v=mean(singer$height), col=2, lwd=2) or any other curve to every block. How can I do to achieve it. Thanks. Best Regards YiYao Jiang Product Division/ product Testing Department Semiconductor Manufacturing International Corporation 18 ZhangJiang Road, PuDong New Area, Shanghai ZIP: 201203 Tel:86-21-5080-2000 Ext. 15173 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
: [R] Multiple formula in one block
Hi Dimitris: Thanks for your help, I will try. BR Yiyao -- : Dimitris Rizopoulos [mailto:[EMAIL PROTECTED] be] : 20041025 15:39 : YiYao_Jiang : [EMAIL PROTECTED] : Re: [R] Multiple formula in one block Hi YiYao, you need the `?panel.abline()' function, somehing like: panel=function(x, breaks, equal.widths, type, ...){ panel.histogram(x, breaks, equal.widths, type, ...) panel.abline(v=mean(singer$height)) } inside the `histogram()' function could do the trick. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: YiYao_Jiang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: YiYao_Jiang [EMAIL PROTECTED] Sent: Monday, October 25, 2004 9:16 AM Subject: [R] Multiple formula in one block Hi Everybody: I want to draw some chart using command histogram and add another curve in it. Example: require(stats) data(singer) library(lattice) histogram( ~ height | voice.part, data = singer, nint = 17, endpoints = c(59.5, 76.5), layout = c(2,4), aspect = .5, xlab = Height (inches)) Now I got a chart of 8 blocks, then I need add : abline(v=mean(singer$height), col=2, lwd=2) or any other curve to every block. How can I do to achieve it. Thanks. Best Regards YiYao Jiang Product Division/ product Testing Department Semiconductor Manufacturing International Corporation 18 ZhangJiang Road, PuDong New Area, Shanghai ZIP: 201203 Tel:86-21-5080-2000 Ext. 15173 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Legend/Substitute/Plotmath problem
Johannes == Johannes Graumann [EMAIL PROTECTED] on Sat, 23 Oct 2004 11:04:25 -0700 writes: Johannes == Johannes Graumann [EMAIL PROTECTED] on Sat, 23 Oct 2004 11:04:25 -0700 writes: Johannes Hello, Johannes I seem unable to construct a legend which contains Johannes a substitution as well as math symbols. I'm trying Johannes to do the following: strain2 - YJG48 legend.txt - c( substitute( strain * %==% * YJG45, rpn10 * %Delta%, list(strain=strain2) ), Verhulst/Logistic, Malthus ) Johannes . Do try to break down a problem into simple things -- particularly when you have problems! This substitute() call is simply invalid: ss - substitute( strain * %==% * YJG45, rpn10 * %Delta%, list(strain=strain2) ) Error: syntax error and the 'syntax error' should give you a clue: The first argument of substitute must be a syntactically correct R expression. Now you try more and more simple things till you 'see it' : Why should I expect 'A * %==% B' to be valid syntax? Both '*' and '%==%' are (diadic) operators: You can't juxtapose them, as well as you can't write 'A * = B'. Then, '%Delta%' (like any other '%foo%' !!) is a diadic operator too and hence can't be juxtaposed to '*'. But I'm pretty sure you rather mean (greek) 'Delta'. Hence: ss - substitute( strain %==% YJG45, rpn10 * Delta, list(strain=strain2) ) --- Once you have the expression you can go further; still step by step : c(ss, Verhulst) [[1]] YJG48 %==% YJG45, rpn10 * Delta [[2]] [1] Verhulst Hmm, a list; that won't work. You do need to pass either a character vector or an expression, i.e., an expression of length 3 in our case. We must build the expression somewhat manually: e - expression(1, Verhulst, Malthus)# '1' is a place holder expression(1, Verhulst, Malthus) e[[1]] - ss ## that's the trick! str(e) expression(YJG48 %==% YJG45, rpn10 * Delta, Verhulst, Malthus) plot(1); legend(1,1, leg = e) --- Maybe something to be added as an example to help(legend) or rather to help(expression) ? HTH, Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] library gregmisc
I write to ask you an help about the package gregmisc. I saw the instructions, and I need some functionalities of this package, but I am unable ti download it. On friday I was able to download thte .zip, but R does not install this package, today there is no possibility to download it. What I have to do? Thanks Anna Maria Paganoni Anna __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] library gregmisc
Gregmisc is a *bundle*, not a library, not a package. It unpacks into four packages: see http://cran.r-project.org/src/contrib/Descriptions/gregmisc.html I guess you are using Windows (see the posting guide, and tell us). There is a temporary problem on the CRAN master. Set options(CRAN=http://cran.ch.r-project.org;) and it works. On Mon, 25 Oct 2004, Anna Maria Paganoni wrote: I write to ask you an help about the package gregmisc. I saw the instructions, and I need some functionalities of this package, but I am unable ti download it. On friday I was able to download thte .zip, but R does not install this package, today there is no possibility to download it. What I have to do? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
Prof Brian Ripley wrote: Actually, you are unable to connect to the Internet from R on your computer. Perhaps you are not connected, or need to set a proxy? Please read the rw-FAQ, as the posting guide asks. Note that right now you there are no packages on CRAN and Bioconductor has not yet released packages for R 2.0.x. The first is a short-term problem, Yes, unfotunately, there was a network breakdown caused by a broken router (that one that connects the whole building with the world) over the weekend - and our department has no access to that machine. The problem is solved now. Windows binaries will soon be back on CRAN. Uwe Ligges and the second needs a little patience (look at http://www.bioconductor.org which has variously mentioned Oct 25 and Nov 1). On Mon, 25 Oct 2004, shizhu zang wrote: Hi , there: I used function source to download the package but found source(http://www.bioconductor.org/getBioC.R;) Error in file(file, r) : unable to open connection In addition: Warning message: unable to resolve 'www.bioconductor.org'. Then I downloaded the packages from CRAN and found local({a - CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a, dependencies=TRUE)}) trying URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES' Error in download.file(url = paste(contriburl, PACKAGES, sep = /), : cannot open URL `http://cran.r-project.org/bin/windows/contrib/2.0/PACKAGES' In addition: Warning message: unable to resolve 'cran.r-project.org'. I use the Window operation system I don't konw what is the matter PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] unable to open connection
On Mon, 25 Oct 2004 10:10:06 +0200, Uwe Ligges (UL) wrote: Prof Brian Ripley wrote: Actually, you are unable to connect to the Internet from R on your computer. Perhaps you are not connected, or need to set a proxy? Please read the rw-FAQ, as the posting guide asks. Note that right now you there are no packages on CRAN and Bioconductor has not yet released packages for R 2.0.x. The first is a short-term problem, Yes, unfotunately, there was a network breakdown caused by a broken router (that one that connects the whole building with the world) over the weekend - and our department has no access to that machine. The problem is solved now. Windows binaries will soon be back on CRAN. They are now on the CRAN master site, mirrors may take a day or two to recover. Best, Fritz Leisch -- --- Friedrich Leisch Institut für Statistik Tel: (+43 1) 58801 10715 Technische Universität WienFax: (+43 1) 58801 10798 Wiedner Hauptstraße 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to save a complete image of the current state of R ?
Thanks for your reply. Considering the reproducibility of R this is an important issue. Regarding my particular problem, i.e. the package build failure with R CMD check package in the examples section, I do not know how to proceed. I have tried the following strategy: direct installation of the package via R CMD INSTALL packageDirectory and running of the examples after loading the package or running the examples file which was generated by the failing R CMD check command - but the error is not reproducible. Any ideas how I can track the problem or get interactive access to the actual state of R during the check procedure ? Best Regards Andreas Prof Brian Ripley wrote: On Fri, 22 Oct 2004, Uwe Ligges wrote: Andreas Buness wrote: Hello, I like to save the complete state of R, i.e. including all environments, objects/workspaces, loaded packages etc.. I think what you are going to do is not available. It is impossible. You have no access to e.g. the internal state of the Box-Muller generator, the objects pointed to by external references, the versions of namespaces, and many other things. You can save the workspace, attach the data and load formerly loaded packages again, of course. Uwe Ligges This wish has arisen since I am not able to reproduce an error which occurs when running R CMD check. Many thanks for your advice in advance. Best Regards Andreas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] library gregmisc
Hi, On Mon, 25 Oct 2004, Anna Maria Paganoni wrote: I write to ask you an help about the package gregmisc. I saw the instructions, and I need some functionalities of this package, but I am unable ti download it. On friday I was able to download thte .zip, but R does not install this package, today there is no possibility to download it. What do you mean R doesn't install the bundle? How did you try to install it? Kev Ko-Kang Kevin Wang PhD Student Centre for Mathematics and its Applications Building 27, Room 1004 Mathematical Sciences Institute (MSI) Australian National University Canberra, ACT 0200 Australia Homepage: http://wwwmaths.anu.edu.au/~wangk/ Ph (W): +61-2-6125-2431 Ph (H): +61-2-6125-7407 Ph (M): +61-40-451-8301 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] usage and behavior of 'setIs'
Hello, am I using 'setIs' in the correct way in the subsequent (artifical) example? Do I have to specify explicit 'setAs' for 'list' and 'vector' or should this work automatically, since getClass(List1) states an explicit coerce also for these classes. I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000. Thanks for your advice, Matthias # example setClass(Class = List1, representation(List = list)) setClass(Class = List2, contains = list) setIs(class1 = List1, class2 = List2, coerce = function(obj){ new(List2, [EMAIL PROTECTED]) }, replace = function(obj, value){ [EMAIL PROTECTED] - value }) getClass(List1) # states explicit coerce for 'list' and 'vector' getClass(List2) L1 - new(List1, List = list(a)) # all TRUE is(L1, List2) is(L1, list) is(L1, vector) as(L1, List2) # works # both return 'list()' # why not a 'list' with entry a? # Is there an additional 'setAs' needed? as(L1, list) as(L1, vector) L2 - as(L1, List2) as(L2, list) # works as(L2, vector) # works __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to calculate Adjusted SS
Hi ALL, I am trying to compute adjusted SS estimated component variance in GLM with un-balanced data using R. Can anyone advise me? Thanks in advance. Best Regards, WeiQiang Li [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] usage and behavior of 'setIs'
Hi Matthias, A similar problem to yours (with one level of inheritance less) was disccussed this month on the r-devel list. You find an answer from JChambers here: https://stat.ethz.ch/pipermail/r-devel/2004-October/030980.html And yes specifying _setAs_ to each _setIs_ with the coerce and replace is a _hack_ which is with this version of methods necessary when inherting from Old Classes. /E [EMAIL PROTECTED] wrote: Hello, am I using 'setIs' in the correct way in the subsequent (artifical) example? Do I have to specify explicit 'setAs' for 'list' and 'vector' or should this work automatically, since getClass(List1) states an explicit coerce also for these classes. I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000. Thanks for your advice, Matthias # example setClass(Class = List1, representation(List = list)) setClass(Class = List2, contains = list) setIs(class1 = List1, class2 = List2, coerce = function(obj){ new(List2, [EMAIL PROTECTED]) }, replace = function(obj, value){ [EMAIL PROTECTED] - value }) getClass(List1) # states explicit coerce for 'list' and 'vector' getClass(List2) L1 - new(List1, List = list(a)) # all TRUE is(L1, List2) is(L1, list) is(L1, vector) as(L1, List2) # works # both return 'list()' # why not a 'list' with entry a? # Is there an additional 'setAs' needed? as(L1, list) as(L1, vector) L2 - as(L1, List2) as(L2, list) # works as(L2, vector) # works __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] usage and behavior of 'setIs'
Thank you, Matthias Hi Matthias, A similar problem to yours (with one level of inheritance less) was disccussed this month on the r-devel list. You find an answer from JChambers here: https://stat.ethz.ch/pipermail/r-devel/2004-October/030980.html And yes specifying _setAs_ to each _setIs_ with the coerce and replace is a _hack_ which is with this version of methods necessary when inherting from Old Classes. /E [EMAIL PROTECTED] wrote: Hello, am I using 'setIs' in the correct way in the subsequent (artifical) example? Do I have to specify explicit 'setAs' for 'list' and 'vector' or should this work automatically, since getClass(List1) states an explicit coerce also for these classes. I'm working with R 2.0.0 Patched (2004-10-06) on windows 2000. Thanks for your advice, Matthias # example setClass(Class = List1, representation(List = list)) setClass(Class = List2, contains = list) setIs(class1 = List1, class2 = List2, coerce = function(obj){ new(List2, [EMAIL PROTECTED]) }, replace = function(obj, value){ [EMAIL PROTECTED] - value }) getClass(List1) # states explicit coerce for 'list' and 'vector' getClass(List2) L1 - new(List1, List = list(a)) # all TRUE is(L1, List2) is(L1, list) is(L1, vector) as(L1, List2) # works # both return 'list()' # why not a 'list' with entry a? # Is there an additional 'setAs' needed? as(L1, list) as(L1, vector) L2 - as(L1, List2) as(L2, list) # works as(L2, vector) # works __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Legend/Substitute/Plotmath problem
Martin Maechler wrote: Johannes == Johannes Graumann [EMAIL PROTECTED] on Sat, 23 Oct 2004 11:04:25 -0700 writes: Johannes == Johannes Graumann [EMAIL PROTECTED] on Sat, 23 Oct 2004 11:04:25 -0700 writes: Johannes Hello, Johannes I seem unable to construct a legend which contains Johannes a substitution as well as math symbols. I'm trying Johannes to do the following: strain2 - YJG48 legend.txt - c( substitute( strain * %==% * YJG45, rpn10 * %Delta%, list(strain=strain2) ), Verhulst/Logistic, Malthus ) Johannes . Do try to break down a problem into simple things -- particularly when you have problems! This substitute() call is simply invalid: ss - substitute( strain * %==% * YJG45, rpn10 * %Delta%, list(strain=strain2) ) Error: syntax error and the 'syntax error' should give you a clue: The first argument of substitute must be a syntactically correct R expression. Now you try more and more simple things till you 'see it' : Why should I expect 'A * %==% B' to be valid syntax? Both '*' and '%==%' are (diadic) operators: You can't juxtapose them, as well as you can't write 'A * = B'. Then, '%Delta%' (like any other '%foo%' !!) is a diadic operator too and hence can't be juxtaposed to '*'. But I'm pretty sure you rather mean (greek) 'Delta'. Hence: ss - substitute( strain %==% YJG45, rpn10 * Delta, list(strain=strain2) ) --- Once you have the expression you can go further; still step by step : c(ss, Verhulst) [[1]] YJG48 %==% YJG45, rpn10 * Delta [[2]] [1] Verhulst Hmm, a list; that won't work. You do need to pass either a character vector or an expression, i.e., an expression of length 3 in our case. We must build the expression somewhat manually: e - expression(1, Verhulst, Malthus)# '1' is a place holder expression(1, Verhulst, Malthus) e[[1]] - ss ## that's the trick! str(e) expression(YJG48 %==% YJG45, rpn10 * Delta, Verhulst, Malthus) plot(1); legend(1,1, leg = e) --- Maybe something to be added as an example to help(legend) or rather to help(expression) ? Martin, a small example is given in the Help Desk in R News 2 (3). Maybe you want to include it ... Uwe HTH, Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] sample variogram construction
Hi Matt, there are several R packages that will compute the sample variogram for you. Check out GeoR, sgeostat, nlme, spatial. There's no point in recoding the whole lot yourself, unless as a learning excercise. D p.s. For time series autocorrelations, you could use acf in package stats. Message: 9 Date: Mon, 25 Oct 2004 02:02:06 -0400 From: [EMAIL PROTECTED] Subject: [R] sample variogram construction To: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII Hi Im attempting to build a sample variogram for 300 obersvations of longitudinal data. So what I need to do is compute the half squared differences between pairs of residuals (for instance if a subject has 4 obersvations, this is 4 choose 2 paird differences) for each subject. Also, then I need the corresponding time differences within each individual. So the end result will be a 300 by 2 matrix with columns corresponding to paired difference residuals within subject and time differences within subject. Basically im having trouble coding this kind of matrix in R, if anyone can help me out or give me some tips id appreciate it. Thanks. Stuck in the for loop student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] From soundcard to R?
Atte Tenkanen wrote: Is it possible to input data from sound card of the computer to R? What do I need to know about my computer (it's linux pc)? Can I get some real time graphical information this way, spektrum for example? I guess it is possible to get data directly from the sound card using connections, but you cannot get real time graphical output. Uwe Ligges Atte __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] functions for special na handling?
hi, i need a function that can replace na's in univariate ts objects with a value interpolated linearly using the adjacent non-na values. for example, the function i need (myfun) would do the following x - ts(10,11.4,NA,12,9.7) y - myfun(x) y 10 11.4 11.7 12 9.7 i can code an na.action method myself to accomplish this, but has someone else already coded routines of this nature? many thanks, robert Robert Sams SANCTUM FI LLP Charles House 18B Charles Street Mayfair London W1J 5DU Tel: +44 (0) 207 667 6360 Dir: +44 (0) 207 667 6363 fax: +44 (0) 207 667 6460 email: [EMAIL PROTECTED] Authorised and Regulated by the FSA. Sending encrypted mail: See http://pgp.mit.edu (search string 'sanctumfi') for updates. -BEGIN PGP PUBLIC KEY BLOCK- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org mQGiBD/xA1kRBAC2RUt8WyHDjXDoO1eu2Mli83cuEV37FicaBs/Wj5ry1QIz1drj ubP25QQvu0lYOOnP7iS48bcOVP77uQYqLbsvzQ4fChFLCg9O3D4ourolZEK69ooJ 74r87PPV/LEnURL4T8E7QCDrRmylJ1iCffgJ9JWkAN4qUG+6fFuOyiqxDwCgiMkM oLaYHjl3unc7Anx59xAlm+MD/R1EdXM9uewCj2kS3SdN+akklg6QVy+gTl3+HGzc MC6ZcLsk1uIklkvCfoYDN7oeC3uVGik7QYkE3n02vfAMGjW7AqsQEoblzi3QscoX Kzitd04NcWeDYIXRThCCydIJ64DdpF293ewJf2fRykmBdAbV0oaqL+zgdrRqFxYJ m2d9A/9m3DoHwXBXPyqueX8naY5hmmeG+mihkdI4H4MBmaPJZW9DnZxor6P2Nm/X muDSf7aZ1t9J0t75oEY/SyjoCYhWlMJS+wnOUq3u5XRNRyo9oI1qQaF5zw8ZmIzW x7nfQMlXpXpETGwbNxZuUoucbN1cDrZBymHxlI5AiBCZ/fya3rQzUm9iZXJ0IFNh bXMgKFNhbmN0dW0gRkkgTExQKSA8cm9iZXJ0QHNhbmN0dW1maS5jb20+iF0EExEC AB0FAj/xA1kFCQHhM4AFCwcKAwQDFQMCAxYCAQIXgAAKCRD3WGga9bCIIPV6AJ9t cDQkN8jW8CxzbU5K2O3dxaMlKwCeNOYQsAgW7S1qAlM345QpDXxbjgC5Ag0EP/ED bRAIANoxq2NjQFdrUMSlQEaitR3pFTmOC7n2rICBAbU/hxlVs1PFSyh6Tr00vzFM py6n4uBCOzrz3b5u5YbRaQzs8ipkqnSzoDD6GKfMEEWYQvZ76kkShWt5zDkLQ2X4 V4X+xJ0iuFT+9cK7VuJ102pjsAwltDUGPKsSwWqs55tzBN8BwAxqNMxRtNYbOTAB Dpnm1BsiZ1TLqHIr4a1t2ZEuqhKV0HEP9VugP9XQz9u1f5QZrriNW/foxBwLuXS7 g+945IGXZq/qxHzgQjJQhC3jIaHUrchrQxy6snoQxgAnuO2/g9SLI8BBsvpVZ+Ac mpkhPtT4pGujwsK/oRFDloAb7BsAAwYIAMlQrB2GPn1ZNFIf9zN+euTv2jWx5Hv4 ZEhqeBTqq00KCT3NSrnOHBTX4x6F4L+ofRzl2L5zIi685wWTpLgqQI7hzKvAxerJ xe1qpz5GfGX976uaqxEfzwQZqcZB2iihhjeOUTxalSWdkX73yNtRmLLikTr0U3E0 v0dB1laMqldYub4X+GeH7tAeQGqYfS6Y+BdNDWfIcwADM0ggLIbNsw+IsjdQNOpq 5R4p1E2o5kfvafIFLpMOZACKKdTBkfiAqOZq8ezDpNHwLrRG4RvQ1K80pGGqaikI XFbJIthvimA5w4MjvenuIn367zj+bz5eFE7YeQ0KG7NAdg2DkxD4W9CITAQYEQIA DAUCP/EDbQUJAeEzgAAKCRD3WGga9bCIIL8RAJ4o9zXtkqK5RMKXxJTmZejtDjTC kwCdFevBc9z4ermWaKb9BsDU7OYdgM8= =6Y3T -END PGP PUBLIC KEY BLOCK- __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] aov documentation page: question
Dear all I was looking at the aov documentation page and came across the following which seems like a contradiction to me: This provides a wrapper to |lm| for fitting linear models to balanced or unbalanced experimental designs. (I presume 'This' refers to aov) and |aov| is designed for balanced designs, and the results can be hard to interpret without balance So, do I use it for unbalanced designs? Thanks, AJ -- Dr Albertus J. Smit (Marine Ecologist/Algal Biologist) School of Biology and Conservation Science Faculty of Science University of KwaZulu-Natal Westville Campus P/B X54001 Durban 4000 South Africa Tel. (031) 260 7472 Fax (031) 260 7364 Please find our disclaimer at http://www.ukzn.ac.za/disclaimer gwavasig__ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aov documentation page: question
On Mon, 25 Oct 2004, AJ Smit wrote: I was looking at the aov documentation page and came across the following which seems like a contradiction to me: This provides a wrapper to |lm| for fitting linear models to balanced or unbalanced experimental designs. (I presume 'This' refers to aov) and |aov| is designed for balanced designs, and the results can be hard to interpret without balance and that is part of a Note, not even a whole sentence of it. In particular, the note has extra force for the multistratum designs mentioned there. So, do I use it for unbalanced designs? You _can_ use it, but the results _can_ be hard to interpret. That is not a `contradiction' -- perhaps you need to consult your dictionary? You may do better to use something else, like lme(), hence the `Note'. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] aov documentation page: question
AJ Smit [EMAIL PROTECTED] writes: Dear all I was looking at the aov documentation page and came across the following which seems like a contradiction to me: This provides a wrapper to |lm| for fitting linear models to balanced or unbalanced experimental designs. (I presume 'This' refers to aov) and |aov| is designed for balanced designs, and the results can be hard to interpret without balance So, do I use it for unbalanced designs? If you know how to interpret the results... In general, I would avoid it if there is unbalance in the random effects, but some designs with unbalance in the fixed effects are manageable. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] .Rprofile and RODBC
Since installing R 2.0 I've had the following 2 issues I can't find solutions for. I'm using Windows XP. 1) R 1.9 continues to read my .Rprofile file in my home directory but R 2.0 does not. How do I get R 2.0 to do this? 2) The following function no longer works in R 2.0 but continues to work in R 1.9: getExcel - function (x) { invisible(require(RODBC)) x - sqlFetch(odbcConnectExcel(file.choose()), exceldata, na.strings = NA) odbcCloseAll() #closes the connection invisible(edit(x)) } I use this function to choose an Excel file and open it using an ODBC connection. Why does this not work now? Thanks in advance for you help. ~Nick __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] `hist()' the weighted value
how about hist(rep(x,w)) i think it works. I have the numeric vector `x' and the weights `w' for it of the same length. I'd like to have hist of `x' weighted with `w'. How to do that? I found nothing about weights in the hist help page.. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reading sections of data files based on pattern matching
I am about to write general functions to read the output of simulations models. These model generate output files with different sections which I want to analyze plot etc. Since this will be used many people at the department I wanted to make sure that will do this in the best way. For instance I want to read a snippets of data from a text that look like this. --- Lots of stuff ... @@Start Values@@ Column1 Column2 Column3 ... Row1 1 2 3 ... ... @@End Values@@ More stuff ... @@Start OtherValues@@ Column1 Column2 Column3 ... Row11 2 3 ... ... @@End OtherValues@@ I looked in the help files and found grep which operates on character strings, do I have to like this then? 1. Read file with readLines(foo.txt) 2. grep this object for the start and end of each section -startline stopline 3. Read the file again with read.table(foo.txt,skip=startline,nrows=stoplin-startline) Or is there a more beautiful way? Cheers, - Henrik Andersson Netherlands Institute of Ecology - Centre for Estuarine and Marine Ecology P.O. Box 140 4400 AC Yerseke Phone: +31 113 577473 [EMAIL PROTECTED] http://www.nioo.knaw.nl/ppages/handersson __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Intro to R: lecture presentation
Hi All: A couple of weeks back, I asked a question on the list that I was invited to provide an introductory lecture on R to a group of academicians in Kolkata. I thank all of you who had generously guided me in providing me web links and words to the wise. Time to give back. I did the presentation on introduction to R and uploaded the presentation files at the following site: http://www.aloofhosting.com/arinbasu/Rtutorial/Rintroweb_files/frame.htm A shortened form of url is here (easy for cutting and pasting): http://tinyurl.com/3zsr6 Would greatly appreciate your feedbacks/opinions/advices on errors/omissions. /Arin Basu [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] problem with installation on Linux (beginners)
Hello, I'm new to the installation R on Linux and I've followed the instructions on the R Installation and Administration Manual and on the FAQs. I also have changed the path at the .bash_profile file but when I try to type R at the shell prompt, it says: Fatal error: R home directory is not defined I've tried many things but all the time it says the same. Any help would be appreciated. Regards, Alicia __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading sections of data files based on pattern matching
Henrik Andersson h.andersson at nioo.knaw.nl writes: : : I am about to write general functions to read the output of simulations : models. : : These model generate output files with different sections which I want : to analyze plot etc. : : Since this will be used many people at the department I wanted to make : sure that will do this in the best way. : : For instance I want to read a snippets of data from a text that look : like this. : --- : Lots of stuff : ... : at at Start Values at at : Column1 Column2 Column3 ... : Row1 1 2 3 ... : ... : at at End Values at at : : More stuff : ... : at at Start OtherValues at at : Column1 Column2 Column3 ... : Row1 1 2 3 ... : ... : at at End OtherValues at at : : : I looked in the help files and found grep which operates on character : strings, do I have to like this then? : : 1. Read file with readLines(foo.txt) : 2. grep this object for the start and end of each section -startline : stopline : 3. Read the file again with : read.table(foo.txt,skip=startline,nrows=stoplin-startline) : : Or is there a more beautiful way? You could adapt the following to your situation (i.e. multiple sections rather than just one): https://www.stat.math.ethz.ch/pipermail/r-help/2003-November/040184.html Also regarding your example, one potential gotcha to be aware of is that skip= skips lines but nrow= counts rows of the data frame so they are slightly different concepts. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with installation on Linux (beginners)
I presume R when executed from its bin directory works fine. Are you actually using bash shell. Try 'echo $SHELL'. If yes, then try 'which R' and see if it pointing to the right path. On Mon, 2004-10-25 at 15:55, Alicia Amadoz wrote: Hello, I'm new to the installation R on Linux and I've followed the instructions on the R Installation and Administration Manual and on the FAQs. I also have changed the path at the .bash_profile file but when I try to type R at the shell prompt, it says: Fatal error: R home directory is not defined I've tried many things but all the time it says the same. Any help would be appreciated. Regards, Alicia __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with installation on Linux (beginners)
On Mon, 2004-10-25 at 16:04, Peter Dalgaard wrote: Alicia Amadoz [EMAIL PROTECTED] writes: What happens if you type 'which R'? What is the version of R and what is in your path? I suspect you are somehow trying to run the R binary, bypassing the R shell script, which sets things like R_HOME. $ cd /usr/lib/R $ ./R (R works perfectly normally) $ ./R.bin __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with installation on Linux (beginners)
Please excuse my previous email. I was going to follow up Peter's post showing that if I run the R binary directly I get exactly the error message reported by the original poster. Unfortunately, after I decided that was too trivial to post, as my mouse headed towards the X button to kill the email for some reason the send button was depressed and the email sent. Apologies. Cheers, Ross-c __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] CRAN packages
Suzette Blanchard [EMAIL PROTECTED] writes: I am not able to download packages (xtable) from CRAN not even just a .zip file, I get that the page can not be found. Please could you help? Suzette Which CRAN mirror? There was a messup over the weekend where a router in Dortmund went down and the mirroring software misbehaved, deleting all the Windows packages from CRAN. However, CRAN master (cran.r-project.org) is back to normal now, and its mirrors should follow in a day or two. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] CRAN packages
Suzette Blanchard wrote: I am not able to download packages (xtable) from CRAN not even just a .zip file, I get that the page can not be found. Please could you help? Suzette = Suzette Blanchard, Ph.D. Research Scientist Frontier Science Hi Suzette, Please supply more information such as how you are downloading the package, what operating system you are using, and which version of R you have installed (or in general, read the posting guide). The easiest way to install a package is within R using ?install.packages. For example, install.packages(xtable) works perfectly fine for me in R-2.0.0 patched on Win2K. --sundar __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] CRAN packages
Hi Suzette, did you try several CRAN mirrors, for instance I'm able to download it from a UK mirror: http://www.stats.bris.ac.uk/R/src/contrib/Descriptions/xtable.html I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Suzette Blanchard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 25, 2004 5:16 PM Subject: [R] CRAN packages I am not able to download packages (xtable) from CRAN not even just a .zip file, I get that the page can not be found. Please could you help? Suzette = Suzette Blanchard, Ph.D. Research Scientist Frontier Science __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Intro to R: lecture presentation
Same behavior with Firefox 1.0Pr. /E Thomas Schönhoff wrote: Hello Arin, Arin Basu schrieb: A couple of weeks back, I asked a question on the list that I was invited to provide an introductory lecture on R to a group of academicians in Kolkata. I thank all of you who had generously guided me in providing me web links and words to the wise. Time to give back. I did the presentation on introduction to R and uploaded the presentation files at the following site: http://www.aloofhosting.com/arinbasu/Rtutorial/Rintroweb_files/frame.htm A shortened form of url is here (easy for cutting and pasting): http://tinyurl.com/3zsr6 Would greatly appreciate your feedbacks/opinions/advices on errors/omissions. Both links don't work for me, simply get an empty page and a black frame on both websites (IE optimzed?) running Mozilla-1.7.x on Debian GNU/Linux. sincerely Thomas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Dipl. bio-chem. Witold Eryk Wolski MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin tel: 0049-30-83875219 __(_ http://www.molgen.mpg.de/~wolski \__/'v' http://r4proteomics.sourceforge.net||/ \ mail: [EMAIL PROTECTED]^^ m m [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] printing ISO/8859-1 characters
Hi, I ran into an odd problem with the print command for R-2.0 on a windows machine. The icelandic character thorn (þ,Þ) which is included in in the Latin-1 character set [iso/8859-1 char# 222 (upper case) and #254 (lower case)] prints out incorrectly. Instead of getting the correct character I get the octal codes for upper and lower case thorn (\336 or \376). This only happens on a windows machine, but not on a linux box. This is not some problem generic to the Latin-1 characters. I get all accented characters correctly and also the character eth (ðÐ). Its only thorn thats problematic... This problem also shows up on the commandline a -Þ works ok, but print(a) or just: a returns the octal number. However, when using THORN in plotlabels it works fine. If anyone knows how to fix this I would be very happy to hear from them... Thanks Halldor -- -- Halldor Bjornsson ([EMAIL PROTECTED]) Vedurstofa Islands (Icelandic Met. Office) Bustadavegur 9, IS-150, Reykjavik, Iceland __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] box() and hist()
Hi, does anybody know why the following is not working: hist(rnorm(200)) box(bty=o) gives me a box without rounded corners. System: R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 0.0 $year [1] 2004 $month [1] 10 $day [1] 04 $language [1] R Thanks, Sven __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] building a package under windows
Hi, I have a package of my own which seems to work fine under linux. I want to make a compiled version for windows. (I work with windows 2000 and R 2.0) I have followed the steps described in the file readme.packages (in the top-level directory of the binary installation) and I had a trouble at this step (which aim is not documented): C:\Program Files\R\rw2000\src\gnuwin32make libR.a libRblas.a dlltool -k --as as --dllname R.dll --def R.exp --output-lib libR.a make: *** [libR.a] Error 255 But still, I tried to build my package by C:\Documents and Settings\guillot\Mes documents\packageRcmd check geneland and got : * checking for working latex ...latex: not found NO * using log directory 'C:/Documents and Settings/guillot/Mes documents/package/ eneland.Rcheck' * checking for file 'geneland/DESCRIPTION' ... OK * checking if this is a source package ... OK installing R.css in C:/DOCUME~1/guillot/MESDOC~1/package/GENELA~1.RCH -- Making package geneland adding build stamp to DESCRIPTION making DLL ... make[4]: *** [libR.a] Error 255 make[3]: *** [libR] Error 2 make[2]: *** [srcDynlib] Error 2 make[1]: *** [all] Error 2 make: *** [pkg-geneland] Error 2 *** Installation of geneland failed *** Removing 'C:/DOCUME~1/guillot/MESDOC~1/package/GENELA~1.RCH/geneland' ERROR Installation failed. What is wrong here ? Gilles -- _ Gilles GUILLOT INRA -Département Mathématiques et Informatique Appliquées Unité de Mixte de Recherche INRA - INAPG - ENGREF Institut National Agronomique de Paris-Grignon 16 rue Claude Bernard 75231 Paris cedex 5 Aile Claude Bernard Niveau cours +3 étages tel : +33 (0)1 44 08 72 71 fax : +33 (0)1 44 08 16 66 http://www.inapg.fr/ens_rech/mathinfo/personnel/guillot/welcome.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] printing ISO/8859-1 characters
On Mon, 25 Oct 2004, Halldor Björnsson wrote: Hi, I ran into an odd problem with the print command for R-2.0 on a windows machine. The icelandic character thorn (þ,Þ) which is included in in the Latin-1 character set [iso/8859-1 char# 222 (upper case) and #254 (lower case)] prints out incorrectly. Instead of getting the correct character I get the octal codes for upper and lower case thorn (\336 or \376). This only happens on a windows machine, but not on a linux box. This is not some problem generic to the Latin-1 characters. I get all accented characters correctly and also the character eth (ðÐ). Its only thorn thats problematic... This problem also shows up on the commandline a -Þ works ok, but print(a) or just: a returns the octal number. However, when using THORN in plotlabels it works fine. If anyone knows how to fix this I would be very happy to hear from them... It's a bug in your version of Windows. print() tests for printable characters, by if(isprint((int)*p)) in src/utils/printutils.c, and that in turn asks Windows about your locale. (The Rgui console used to do this, but Windows crashed too often when it did.) Assuming your machine is set correctly to an Icelandic locale, the only solution I know of is to write your own replacement for isprint and compile that into a build of R. If you can, it might be worth trying another version of Windows: we saw something similar in Czech that worked in Windows XP but not 2000. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Legend/Substitute/Plotmath problem
Thank you so much ... works now ... sooo much to learn ... Joh On Mon, 25 Oct 2004 09:56:35 +0200 Martin Maechler [EMAIL PROTECTED] wrote: Johannes == Johannes Graumann [EMAIL PROTECTED] on Sat, 23 Oct 2004 11:04:25 -0700 writes: Johannes == Johannes Graumann [EMAIL PROTECTED] on Sat, 23 Oct 2004 11:04:25 -0700 writes: Johannes Hello, Johannes I seem unable to construct a legend which contains Johannes a substitution as well as math symbols. I'm trying Johannes to do the following: strain2 - YJG48 legend.txt - c( substitute( strain * %==% * YJG45, rpn10 * %Delta%, list(strain=strain2) ), Verhulst/Logistic, Malthus ) Johannes . Do try to break down a problem into simple things -- particularly when you have problems! This substitute() call is simply invalid: ss - substitute( strain * %==% * YJG45, rpn10 * %Delta%, list(strain=strain2) ) Error: syntax error and the 'syntax error' should give you a clue: The first argument of substitute must be a syntactically correct R expression. Now you try more and more simple things till you 'see it' : Why should I expect 'A * %==% B' to be valid syntax? Both '*' and '%==%' are (diadic) operators: You can't juxtapose them, as well as you can't write 'A * = B'. Then, '%Delta%' (like any other '%foo%' !!) is a diadic operator too and hence can't be juxtaposed to '*'. But I'm pretty sure you rather mean (greek) 'Delta'. Hence: ss - substitute( strain %==% YJG45, rpn10 * Delta, list(strain=strain2) ) --- Once you have the expression you can go further; still step by step : c(ss, Verhulst) [[1]] YJG48 %==% YJG45, rpn10 * Delta [[2]] [1] Verhulst Hmm, a list; that won't work. You do need to pass either a character vector or an expression, i.e., an expression of length 3 in our case. We must build the expression somewhat manually: e - expression(1, Verhulst, Malthus)# '1' is a place holder expression(1, Verhulst, Malthus) e[[1]] - ss ## that's the trick! str(e) expression(YJG48 %==% YJG45, rpn10 * Delta, Verhulst, Malthus) plot(1); legend(1,1, leg = e) --- Maybe something to be added as an example to help(legend) or rather to help(expression) ? HTH, Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] printing ISO/8859-1 characters
Halldor Björnsson [EMAIL PROTECTED] writes: Hi, I ran into an odd problem with the print command for R-2.0 on a windows machine. The icelandic character thorn (þ,Þ) which is included in in the Latin-1 character set [iso/8859-1 char# 222 (upper case) and #254 (lower case)] prints out incorrectly. Instead of getting the correct character I get the octal codes for upper and lower case thorn (\336 or \376). This only happens on a windows machine, but not on a linux box. This is not some problem generic to the Latin-1 characters. I get all accented characters correctly and also the character eth (ðÐ). Its only thorn thats problematic... This problem also shows up on the commandline a -Þ works ok, but print(a) or just: a returns the octal number. However, when using THORN in plotlabels it works fine. If anyone knows how to fix this I would be very happy to hear from them... It happens if (and presumably only if) isprint('þ') is 0 in the internal C code. We have heard about similar bugs in Microsoft DLLs before. It is not a bug in R as such, but it might help to replace - I think it is - msvcrt.dll. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] output processing / ARMA order identification
Dear R users, I need to fit an ARMA model. As far as I've seen, EACF (extended ACF) is not available in R. 1. Let's say I fit a series of ARMA models in a loop. Given the code/output included below, how do I pull 'Model' and 'Fit' (AIC) from each summary() so that I can combine them into an array/data frame to be sorted by AIC? 2. Apart from EACF, are you aware perhaps of another function in R that can help solve the issue of ARMA order identification? Thank you, b. arma - arma(var, order=c(1,1), lag=NULL, coef=NULL, + include.intercept = TRUE, series = NULL) summary(arma) Call: arma(x = var, order = c(1, 1), lag = NULL, coef = NULL, include.intercept = TRUE, series = NULL) Model: ARMA(1,1) Residuals: Min 1Q Median 3Q Max -686.092 -68.4994.024 65.531 509.171 Coefficient(s): Estimate Std. Error t value Pr(|t|) ar10.9906530.003724 265.987 2e-16 *** ma1 -0.0195620.030110 -0.650 0.5159 intercept 90.940774 36.9146822.464 0.0138 * --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Fit: sigma^2 estimated as 14193, Conditional Sum-of-Squares = 17116373, AIC = 14983.22 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] sample variogram construction
Okay thanks! No I have the following difficulty implementing a variogram in the nlme package: cd1 - lme(count ~ time, data=cd4,random= ~ time | id) plot(Variogram(cd1, form= ~ time | id, robust=TRUE)) Error in as.array(X) : attempt to set an attribute on NULL Im not sure how to fix this, and apply this function to a longitudinal data with unequal times? Any help would be appreciated Quoting Dan Bebber [EMAIL PROTECTED]: Hi Matt, there are several R packages that will compute the sample variogram for you. Check out GeoR, sgeostat, nlme, spatial. There's no point in recoding the whole lot yourself, unless as a learning excercise. D p.s. For time series autocorrelations, you could use acf in package stats. Message: 9 Date: Mon, 25 Oct 2004 02:02:06 -0400 From: [EMAIL PROTECTED] Subject: [R] sample variogram construction To: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII Hi Im attempting to build a sample variogram for 300 obersvations of longitudinal data. So what I need to do is compute the half squared differences between pairs of residuals (for instance if a subject has 4 obersvations, this is 4 choose 2 paird differences) for each subject. Also, then I need the corresponding time differences within each individual. So the end result will be a 300 by 2 matrix with columns corresponding to paired difference residuals within subject and time differences within subject. Basically im having trouble coding this kind of matrix in R, if anyone can help me out or give me some tips id appreciate it. Thanks. Stuck in the for loop student __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] box() and hist()
[EMAIL PROTECTED] writes: Hi, does anybody know why the following is not working: hist(rnorm(200)) box(bty=o) gives me a box without rounded corners. Because that isn't what it is supposed to do. Did you expect 7 to give you a slanting right edge? And which letter should represent a full rectangle? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading sections of data files based on pattern matching
On Mon, 25 Oct 2004 15:56:37 +0200, Henrik Andersson [EMAIL PROTECTED] wrote : I am about to write general functions to read the output of simulations models. These model generate output files with different sections which I want to analyze plot etc. Since this will be used many people at the department I wanted to make sure that will do this in the best way. For instance I want to read a snippets of data from a text that look like this. --- Lots of stuff ... @@Start Values@@ Column1 Column2 Column3 ... Row1 1 2 3 ... ... @@End Values@@ More stuff ... @@Start OtherValues@@ Column1 Column2 Column3 ... Row1 1 2 3 ... ... @@End OtherValues@@ I looked in the help files and found grep which operates on character strings, do I have to like this then? 1. Read file with readLines(foo.txt) 2. grep this object for the start and end of each section -startline stopline 3. Read the file again with read.table(foo.txt,skip=startline,nrows=stoplin-startline) Or is there a more beautiful way? I would avoid putting mixing multiple tables in the same file. I think you'll run into fewer problems if you put each table into a separate file, and generate an index file to list all the tables. Each of the files in your scheme would then become a subdirectory in my scheme. If the multiplicity of files is a problem, you could use zip or winzip to put them all into a zip file; R can extract a file from one of those using zip.file.extract. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] building a package under windows
On Mon, 25 Oct 2004, Gilles GUILLOT wrote: Hi, I have a package of my own which seems to work fine under linux. I want to make a compiled version for windows. (I work with windows 2000 and R 2.0) There is no such version of R. I have followed the steps described in the file readme.packages (in the top-level directory of the binary installation) Clearly you haven't, as you don't have latex in your path, and I don't think you have the proper compilers either. and I had a trouble at this step (which aim is not documented): Yes, it is: it makes the libraries libR.a libRblas.a! Pretty self-explanatory don't you think? C:\Program Files\R\rw2000\src\gnuwin32make libR.a libRblas.a dlltool -k --as as --dllname R.dll --def R.exp --output-lib libR.a make: *** [libR.a] Error 255 So something is wrong with your compiler installation (if you have one), for dlltool or some of its components are missing. But still, I tried to build my package by C:\Documents and Settings\guillot\Mes documents\packageRcmd check geneland and got : * checking for working latex ...latex: not found and you are missing some more tools. NO * using log directory 'C:/Documents and Settings/guillot/Mes documents/package/ eneland.Rcheck' * checking for file 'geneland/DESCRIPTION' ... OK * checking if this is a source package ... OK installing R.css in C:/DOCUME~1/guillot/MESDOC~1/package/GENELA~1.RCH -- Making package geneland adding build stamp to DESCRIPTION making DLL ... make[4]: *** [libR.a] Error 255 make[3]: *** [libR] Error 2 make[2]: *** [srcDynlib] Error 2 make[1]: *** [all] Error 2 make: *** [pkg-geneland] Error 2 *** Installation of geneland failed *** Removing 'C:/DOCUME~1/guillot/MESDOC~1/package/GENELA~1.RCH/geneland' ERROR Installation failed. What is wrong here ? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] box() and hist()
On Mon, 2004-10-25 at 12:02, [EMAIL PROTECTED] wrote: Hi, does anybody know why the following is not working: hist(rnorm(200)) box(bty=o) gives me a box without rounded corners. You will not get rounded corners with box(). The 'bty' argument determines how many sides of the plot region are drawn using box(). o gives you all four sides (1:4) l gives you left and lower (2 and 1) 7 gives you upper and right (3:4) c gives you all except right (1:2, 3) u gives you all except upper (1:2, 4) ] gives you all except left (1, 3:4) Try this as an example: plot(1:10, axes = FALSE) box(bty = 7) Substitute each of the bty types to review further. HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] building a package under windows
Gilles GUILLOT wrote: Hi, I have a package of my own which seems to work fine under linux. I want to make a compiled version for windows. (I work with windows 2000 and R 2.0) I have followed the steps described in the file readme.packages (in the top-level directory of the binary installation) and I had a trouble at this step (which aim is not documented): C:\Program Files\R\rw2000\src\gnuwin32make libR.a libRblas.a dlltool -k --as as --dllname R.dll --def R.exp --output-lib libR.a make: *** [libR.a] Error 255 Hmm, don't know at this place (if the paths are correct and in the correct order, and all tools are installed). I'd rather try to build R from scratch, and you'll get libR.a. But still, I tried to build my package by C:\Documents and Settings\guillot\Mes documents\packageRcmd check geneland and got : * checking for working latex ...latex: not found NO So install LaTeX. * using log directory 'C:/Documents and Settings/guillot/Mes documents/package/ eneland.Rcheck' Does it really read eneland? Then something is wrong with the tools you have installed, I presume. And you have left out at least one sentence of readme.packages ... Uwe Ligges One last comment: Even if it works on some machines, I do never trust paths with blanks in it. * checking for file 'geneland/DESCRIPTION' ... OK * checking if this is a source package ... OK installing R.css in C:/DOCUME~1/guillot/MESDOC~1/package/GENELA~1.RCH -- Making package geneland adding build stamp to DESCRIPTION making DLL ... make[4]: *** [libR.a] Error 255 make[3]: *** [libR] Error 2 make[2]: *** [srcDynlib] Error 2 make[1]: *** [all] Error 2 make: *** [pkg-geneland] Error 2 *** Installation of geneland failed *** Removing 'C:/DOCUME~1/guillot/MESDOC~1/package/GENELA~1.RCH/geneland' ERROR Installation failed. What is wrong here ? Gilles __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] How to save a complete image of the current state of R ?
Date: Mon, 25 Oct 2004 14:10:15 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2654.89) Content-Type: text/plain; charset=iso-8859-1 It is possible to save all of these items using the save.session and restore.session functions provided by the 'session' package available from CRAN. -Greg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Andreas Buness Sent: Friday, October 22, 2004 1:05 PM To: [EMAIL PROTECTED] Subject: [R] How to save a complete image of the current state of R ? Hello, I like to save the complete state of R, i.e. including all environments, objects/workspaces, loaded packages etc.. This wish has arisen since I am not able to reproduce an error which occurs when running R CMD check. Many thanks for your advice in advance. Best Regards Andreas __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}} __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] par(usr) trouble in multiplot axis scaling
Hello, I'm blotting a series of growth curves into a multiplot environment created with layout(). since I want the four plots to be easily visually comparable, I do the following: #first plot plot(x,y,stuff) standarduser-par()$usr ... some fitting ... lines(spline(x, fitted_equation)) #everything all right till here # second plot plot(x,y,stuff) par(usr=standarduser) ... some fitting ... lines(spline(x, fitted_equation)) The problem here is, that the axis of the second plot seem to be scaled according to the parameters of the first, BUT the fitted curve in the second plot isn't! Any idea about what I'm doing wrong? Please help this newbie out of his misery! Joh __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Ref: Variable scope or function behaviour or array reassign
Dear R- helpers Following a draft structure of the R script for which I am facing problem Step 1 x - of type array with original values y - of type array with original values Step 2 for (ctr in 1:10) { # my problem here the both x and y still show the original values from step 1 # in spite of making changes to the old values of the arrays x and y in the function function (x,y) ??? } step3 output - function(parX,parY){ Variables for New X and Y newx - array(parX, dim=c(1,length(parX))) newy - array(parY, dim=c(1,length(parY))) # make some calculation and updated some arrays element in the newX and # #newY # finally assign the global original values x and y with newX and newY x- newx y- newy # if print here I can see the new values # but when the function gets called the second time the original values of # x and y get called hence failing my motive of passing update values of #the arrays to the function each time ??? } I believe there something to deal with env or new.env but never could get the concept of the variable scope .where the fact with the function the x and y get updated but while calling from the main loop the x and y are pointing to old values also I am keen to know as to is there a way to clear the array of old values and reasign new values..or the - operator take care of it by overwriting regards Kunal __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] output processing / ARMA order identification
On Mon, 25 Oct 2004, bogdan romocea wrote: Dear R users, I need to fit an ARMA model. As far as I've seen, EACF (extended ACF) is not available in R. But PACF is as well as ACF. 1. Let's say I fit a series of ARMA models in a loop. Given the code/output included below, how do I pull 'Model' and 'Fit' (AIC) from each summary() so that I can combine them into an array/data frame to be sorted by AIC? Look at the examples in tests/ts-tests.R. Or read the arima() help page more carefully, as it tells you where the results are (and they are not in summary(), which does not work for arima fits!). 2. Apart from EACF, are you aware perhaps of another function in R that can help solve the issue of ARMA order identification? It's a rather old-fashioned idea. Just fit all the target models and compare their performance. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plotting Bivariate Normal Data
Just a little addendum to Martin's comments below. It is well known that using LS centers and covariances for the M-distances is generally not a good way to do this, as these statistics, themselves, are distorted by the long tails (do 1D distributions have tails?) so that the problems are hidden (see Brian Ripley's comments on the R-Help robust regression with groups thread from last week). Hence, one should use a resistant center (the medioid, say) and a resistant covariance matrix (e.g., from cov.rob()) to compute the M-distances. ... But then, this begs the question: Why do normality testing at all? (again, see BR's comments). Better to use robust/resistant statistical procedures for estimation from the beginning, though, unfortunately, this shatters the nice simple mathematical framework for inference. -- 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 Since one of the more severe and common deviations from normality is long tailedness (in all it's vaguety), we have been recommending to QQ-plot mahalanobis distances against chi squared quantiles - even before looking at the univariate QQ plots. Exactly for this reason, in R, example(mahalanobis) shows a version of how to do this! Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Feature selection
Hello, I want to do feature selection for classification purpose (using lda). Can someone point me to any R package or S-plus package for this? Something like SFS or SFFS method would be useful for me. Thanks. Raj [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] par(usr) trouble in multiplot axis scaling
Johannes Graumann wrote: Hello, I'm blotting a series of growth curves into a multiplot environment created with layout(). since I want the four plots to be easily visually comparable, I do the following: #first plot plot(x,y,stuff) standarduser-par()$usr ... some fitting ... lines(spline(x, fitted_equation)) #everything all right till here # second plot plot(x,y,stuff) par(usr=standarduser) ... some fitting ... lines(spline(x, fitted_equation)) The problem here is, that the axis of the second plot seem to be scaled according to the parameters of the first, BUT the fitted curve in the second plot isn't! Any idea about what I'm doing wrong? Please help this newbie out of his misery! Can you specify a very simple reproducible example please? Uwe Ligges Joh __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Ref: Variable scope or function behaviour or array reassign
Kunal Shetty wrote: Dear R- helpers Following a draft structure of the R script for which I am facing problem Step 1 x - of type array with original values y - of type array with original values Step 2 for (ctr in 1:10) { # my problem here the both x and y still show the original values from step 1 # in spite of making changes to the old values of the arrays x and y in the function function (x,y) ??? } step3 output - function(parX,parY){ Variables for New X and Y newx - array(parX, dim=c(1,length(parX))) newy - array(parY, dim=c(1,length(parY))) # make some calculation and updated some arrays element in the newX and # #newY # finally assign the global original values x and y with newX and newY x- newx y- newy # if print here I can see the new values # but when the function gets called the second time the original values of # x and y get called hence failing my motive of passing update values of #the arrays to the function each time ??? } I believe there something to deal with env or new.env but never could get the concept of the variable scope.where the fact with the function the x and y get updated but while calling from the main loop the x and y are pointing to old values also I am keen to know as to is there a way to clear the array of old values and reasign new values..or the - operator take care of it by overwriting regards Kunal __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html I don't understand your question completely. Anyway, I guess you have missed the point that you can pass arguments to a function and that you can return an object (e.g. a list of other objects) from the function (please read An Introduction to R for more details). Assign the value returned by a function it to an object in the calling function. In most circumstances, don't think too much about accessing environments, because you don't want to do it! The mechanisms mentioned above are sufficient in most circumstances. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] par(usr) trouble in multiplot axis scaling
On Mon, 2004-10-25 at 13:19, Johannes Graumann wrote: Hello, I'm blotting a series of growth curves into a multiplot environment created with layout(). since I want the four plots to be easily visually comparable, I do the following: #first plot plot(x,y,stuff) standarduser-par()$usr ... some fitting ... lines(spline(x, fitted_equation)) #everything all right till here # second plot plot(x,y,stuff) par(usr=standarduser) ... some fitting ... lines(spline(x, fitted_equation)) The problem here is, that the axis of the second plot seem to be scaled according to the parameters of the first, BUT the fitted curve in the second plot isn't! Any idea about what I'm doing wrong? Please help this newbie out of his misery! Joh If I am correctly understanding what you are doing and what you want, you would like each of the four plots to have the same axis ranges? Part of the problem, I think, is that in your second plot(), the axis ranges are automatically set based upon the ranges of your x and y data in that call. These presumably are different than the x and y values in your first plot? Thus, the initial plot region scales are going to be different for each plot. By default, this will be range(x) +/- 4% and range(y) +/- 4%. When you force the second plot region's values to be 'standarduser', your underlying x,y plot, having already been drawn, and the new lines to be added are then on different scales in the same plot. If my assumptions are correct, you would be better off calling plot() each time using the 'xlim' and 'ylim' arguments to explicitly define the axis ranges with known common values. For example, if you know that the range of all x values is r.x and the range of all y values is r.y: #first plot plot(x, y, stuff, xlim = r.x, ylim = r.y) ... some fitting ... lines(spline(x, fitted_equation)) # second plot plot(x, y, stuff, xlim = r.x, ylim = r.y) ... some fitting ... lines(spline(x, fitted_equation)) This gets around the need to manipulate the pars directly and hopefully less confusion in reading the code. The key is knowing the common ranges of your x and y values in advance. Does that help? Marc Schwartz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] par(usr) trouble in multiplot axis scaling
You were right! 'ylim' does what I want! Thanks for deciphering my cryptic scribble and helping out! Joh On Mon, 25 Oct 2004 14:25:55 -0500 Marc Schwartz [EMAIL PROTECTED] wrote: On Mon, 2004-10-25 at 13:19, Johannes Graumann wrote: Hello, I'm blotting a series of growth curves into a multiplot environment created with layout(). since I want the four plots to be easily visually comparable, I do the following: #first plot plot(x,y,stuff) standarduser-par()$usr ... some fitting ... lines(spline(x, fitted_equation)) #everything all right till here # second plot plot(x,y,stuff) par(usr=standarduser) ... some fitting ... lines(spline(x, fitted_equation)) The problem here is, that the axis of the second plot seem to be scaled according to the parameters of the first, BUT the fitted curve in the second plot isn't! Any idea about what I'm doing wrong? Please help this newbie out of his misery! Joh If I am correctly understanding what you are doing and what you want, you would like each of the four plots to have the same axis ranges? Part of the problem, I think, is that in your second plot(), the axis ranges are automatically set based upon the ranges of your x and y data in that call. These presumably are different than the x and y values in your first plot? Thus, the initial plot region scales are going to be different for each plot. By default, this will be range(x) +/- 4% and range(y) +/- 4%. When you force the second plot region's values to be 'standarduser', your underlying x,y plot, having already been drawn, and the new lines to be added are then on different scales in the same plot. If my assumptions are correct, you would be better off calling plot() each time using the 'xlim' and 'ylim' arguments to explicitly define the axis ranges with known common values. For example, if you know that the range of all x values is r.x and the range of all y values is r.y: #first plot plot(x, y, stuff, xlim = r.x, ylim = r.y) ... some fitting ... lines(spline(x, fitted_equation)) # second plot plot(x, y, stuff, xlim = r.x, ylim = r.y) ... some fitting ... lines(spline(x, fitted_equation)) This gets around the need to manipulate the pars directly and hopefully less confusion in reading the code. The key is knowing the common ranges of your x and y values in advance. Does that help? Marc Schwartz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Ref: Variable scope or function behaviour or array reassign
Uwe Ligges thank you for u prompt reply my problem was in step3 where my function returns two different arrays. Yes i did try returning an object from the array. but the problem became...i tired returning the two arrays in a dataframe such as newXY - data.frame(newXmean=newx, newYmean =newy) but in the calling function or loop; i wasn't able to access each individual array as an array; from the assigned object. Output - algoResult(x,y,xNA,yNA,ctr); Output print(Output) ?? print(Output[1]) print(Output$newy) hence was trying to assign the global arrays within the function itself without bothering to return any object... any help on this.. regards Kunal Uwe Ligges [EMAIL PROTECTED] wrote: Kunal Shetty wrote: Dear R- helpers Following a draft structure of the R script for which I am facing problem Step 1 x - of type array with original values y - of type array with original values Step 2 for (ctr in 1:10) { # my problem here the both x and y still show the original values from step 1 # in spite of making changes to the old values of the arrays x and y in the function function (x,y) ??? } step3 output - function(parX,parY){ Variables for New X and Y newx - array(parX, dim=c(1,length(parX))) newy - array(parY, dim=c(1,length(parY))) # make some calculation and updated some arrays element in the newX and # #newY # finally assign the global original values x and y with newX and newY x- newx y- newy # if print here I can see the new values # but when the function gets called the second time the original values of # x and y get called hence failing my motive of passing update values of #the arrays to the function each time ??? } I believe there something to deal with env or new.env but never could get the concept of the variable scope .where the fact with the function the x and y get updated but while calling from the main loop the x and y are pointing to old values also I am keen to know as to is there a way to clear the array of old values and reasign new values..or the - operator take care of it by overwriting regards Kunal __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html I don't understand your question completely. Anyway, I guess you have missed the point that you can pass arguments to a function and that you can return an object (e.g. a list of other objects) from the function (please read An Introduction to R for more details). Assign the value returned by a function it to an object in the calling function. In most circumstances, don't think too much about accessing environments, because you don't want to do it! The mechanisms mentioned above are sufficient in most circumstances. Uwe Ligges Uwe Ligges [EMAIL PROTECTED] wrote: Kunal Shetty wrote: Dear R- helpers Following a draft structure of the R script for which I am facing problem Step 1 x - of type array with original values y - of type array with original values Step 2 for (ctr in 1:10) { # my problem here the both x and y still show the original values from step 1 # in spite of making changes to the old values of the arrays x and y in the function function (x,y) ??? } step3 output - function(parX,parY){ Variables for New X and Y newx - array(parX, dim=c(1,length(parX))) newy - array(parY, dim=c(1,length(parY))) # make some calculation and updated some arrays element in the newX and # #newY # finally assign the global original values x and y with newX and newY x- newx y- newy # if print here I can see the new values # but when the function gets called the second time the original values of # x and y get called hence failing my motive of passing update values of #the arrays to the function each time ??? } I believe there something to deal with env or new.env but never could get the concept of the variable scope .where the fact with the function the x and y get updated but while calling from the main loop the x and y are pointing to old values also I am keen to know as to is there a way to clear the array of old values and reasign new values..or the - operator
Re: [R] functions for special na handling?
Robert Sams wrote: hi, i need a function that can replace na's in univariate ts objects with a value interpolated linearly using the adjacent non-na values. for example, the function i need (myfun) would do the following x - ts(10,11.4,NA,12,9.7) y - myfun(x) y 10 11.4 11.7 12 9.7 i can code an na.action method myself to accomplish this, but has someone else already coded routines of this nature? many thanks, robert Robert Sams Hi Robert, Will the following do? na.approx - function(x) { na - is.na(x) if(all(!na)) return(x) i - seq(along = x) x[na] - approx(i[!na], x[!na], i[na])$y x } x - c(10,11.4,NA,12,9.7) na.approx(x) [1] 10.0 11.4 11.7 12.0 9.7 --sundar __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] functions for special na handling?
Sundar Dorai-Raj wrote: Robert Sams wrote: hi, i need a function that can replace na's in univariate ts objects with a value interpolated linearly using the adjacent non-na values. for example, the function i need (myfun) would do the following x - ts(10,11.4,NA,12,9.7) y - myfun(x) y 10 11.4 11.7 12 9.7 i can code an na.action method myself to accomplish this, but has someone else already coded routines of this nature? many thanks, robert Robert Sams Hi Robert, Will the following do? na.approx - function(x) { na - is.na(x) if(all(!na)) return(x) i - seq(along = x) x[na] - approx(i[!na], x[!na], i[na])$y x } x - c(10,11.4,NA,12,9.7) na.approx(x) [1] 10.0 11.4 11.7 12.0 9.7 One other note: na.approx as written above will return NA if the first or last element of your vector is missing. See ?approx on how to change this behaviour. --sundar __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Question on bioconductor: reading affymetrix data
Hi everyone, My purpose is to read a .CEL file into R. The .CEL file was created from a .CAB by using DTT software found on Affymetrix website I read the .CEL file in R using ReadAffy as follows: d2=ReadAffy(widget=T) and I complete the fields as required. It does not complain. For example I could find the description: description(d2) Experimenter name: BB Laboratory: FFL Contact information: Title: Heter URL: www.bioconductor.org A 1 word abstract is available. Use 'abstract' method. Information is available on: samples, preprocessing But if I want to see the values for MM I get an error: mm(d2)[1:2] Note: You did not specify a download type. Using a default value of: Win32 This will be fine for almost all users Error in if ((is.null(deps)) || (length(deps) == 0) || (deps == )) return(NULL) : missing value where TRUE/FALSE needed I appreciate any ideas you may have. Thank you. Melania Rm 15-433, ext 4886 Fax: (416) 946-2048 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Revision: post on Intro to R lecture
Much improved (patched Firefox 1.0pre on RH9) On 25 Oct 2004, Arin Basu wrote: Hi All: This follows my earlier post on webized slides on lecture presentation on introducing R. I learned that in Mozilla (Firefox) browsers, the slides did not show up. Sorry for the no show. As a reluctant windows user, I kind of carelessly clicked through Powerpoint to convert the presentation file to its html form, unwittingly leading to the mess. See if it got corrected now (I do not have firefox yet in my computer, so no way of knowing whether it works), and please let me know. Also, made some changes and reformatted the original slides to make them other browser compatible, thanks to comments from Gabor Grothendiek, Stuart Lesk, and Sundar Dorai-Raj. Here is the URL again: http://www.aloofhosting.com/arinbasu/Rintroweb.htm /Arin Basu [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Clint BowmanINTERNET: [EMAIL PROTECTED] Air Quality Modeler INTERNET: [EMAIL PROTECTED] Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:(360) 407-7534 Olympia, WA 98504-7600 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Scoping and nls.
A colleague of mine is trying to use nls() to effect an optimization, and is encountering a scoping problem. I should know how to solve it for him but well, I just don't. I also had a quick scrounge of the archives --- I know I've seen this topic addressed before --- but I couldn't track it down. So here's a toy example that demonstrates the problem: hhh - function(y,x) { g - function(a,b,x) {1/(1+a^2 + b^2*exp(x))} nls(y~g(a,b,x),data=data.frame(x=x,y=y)) } set.seed(123) x - runif(50,1,10) y - 1/(1+16 + 36*exp(x)) + rnorm(50,0,0.1) hhh(y,x) which results in an error Error in get(x, envir, mode, inherits) : variable g was not found So can one assign the function ``g'' somewhere where it **can** be found? I.e. use something like assign(g,g,envir=??) Or is there some other magic incantation that can be used here to get nls to deal with a ``g'' defined inside the function which call nsl()? In the real problem the function g is a complicated gadget, taking different forms in different parts of its domain, so it is inconvenient-to-impossible to specify it explicitly in the formula in the call to nls(). Thanks for any help you can give. cheers, Rolf Turner [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Question on bioconductor: reading affymetrix data
This is a question that should be asked on the bioconductor mailing list rather than R-help. Quick answer: library(reposTools) install.packages2(whateverchiptypethisiscdf) Where you have to replace whateverchiptypethisiscdf with e.g., hgu133acdf. HTH, Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 Pintilie, Melania [EMAIL PROTECTED] 10/25/04 4:53 PM Hi everyone, My purpose is to read a .CEL file into R. The .CEL file was created from a .CAB by using DTT software found on Affymetrix website I read the .CEL file in R using ReadAffy as follows: d2=ReadAffy(widget=T) and I complete the fields as required. It does not complain. For example I could find the description: description(d2) Experimenter name: BB Laboratory: FFL Contact information: Title: Heter URL: www.bioconductor.org A 1 word abstract is available. Use 'abstract' method. Information is available on: samples, preprocessing But if I want to see the values for MM I get an error: mm(d2)[1:2] Note: You did not specify a download type. Using a default value of: Win32 This will be fine for almost all users Error in if ((is.null(deps)) || (length(deps) == 0) || (deps == )) return(NULL) : missing value where TRUE/FALSE needed I appreciate any ideas you may have. Thank you. Melania Rm 15-433, ext 4886 Fax: (416) 946-2048 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Plotting Bivariate Normal Data
Dear Bert, The data.ellipse() function in the car package optionally uses the covariance matrix and location vector returned by cov.trob() (from the MASS package). I believe that any 1D function of the two variables is potentially problematic. As to why do it -- comparing the bivariate distribution to the bivariate normal might be an interesting way to think about the shape of the distribution. Regards, 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 Berton Gunter Sent: Monday, October 25, 2004 1:31 PM To: R-Help Subject: Re: [R] Plotting Bivariate Normal Data Just a little addendum to Martin's comments below. It is well known that using LS centers and covariances for the M-distances is generally not a good way to do this, as these statistics, themselves, are distorted by the long tails (do 1D distributions have tails?) so that the problems are hidden (see Brian Ripley's comments on the R-Help robust regression with groups thread from last week). Hence, one should use a resistant center (the medioid, say) and a resistant covariance matrix (e.g., from cov.rob()) to compute the M-distances. ... But then, this begs the question: Why do normality testing at all? (again, see BR's comments). Better to use robust/resistant statistical procedures for estimation from the beginning, though, unfortunately, this shatters the nice simple mathematical framework for inference. -- 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 Since one of the more severe and common deviations from normality is long tailedness (in all it's vaguety), we have been recommending to QQ-plot mahalanobis distances against chi squared quantiles - even before looking at the univariate QQ plots. Exactly for this reason, in R, example(mahalanobis) shows a version of how to do this! Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Feature selection
Raj, look at academic.uprm.edu/eacuna/softw.htm, I built a library of R functions for data preprocessing tasks including feature selection for supervised classification. Please send me your comments. Edgar On Mon, 25 Oct 2004, Rajdeep Das wrote: Hello, I want to do feature selection for classification purpose (using lda). Can someone point me to any R package or S-plus package for this? Something like SFS or SFFS method would be useful for me. Thanks. Raj [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Plotting Bivariate Normal Data
From: Berton Gunter Just a little addendum to Martin's comments below. It is well known that using LS centers and covariances for the M-distances is generally not a good way to do this, as these statistics, themselves, are distorted by the long tails (do 1D distributions have tails?) How about `long skirt' or some such? That seems descriptive, at least for 2D... Andy so that the problems are hidden (see Brian Ripley's comments on the R-Help robust regression with groups thread from last week). Hence, one should use a resistant center (the medioid, say) and a resistant covariance matrix (e.g., from cov.rob()) to compute the M-distances. ... But then, this begs the question: Why do normality testing at all? (again, see BR's comments). Better to use robust/resistant statistical procedures for estimation from the beginning, though, unfortunately, this shatters the nice simple mathematical framework for inference. -- 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 Since one of the more severe and common deviations from normality is long tailedness (in all it's vaguety), we have been recommending to QQ-plot mahalanobis distances against chi squared quantiles - even before looking at the univariate QQ plots. Exactly for this reason, in R, example(mahalanobis) shows a version of how to do this! Martin Maechler, ETH Zurich __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] computing distribution function online
Hi, I am looking for a means to compute empirical distribution function for a very large data set and evolution of that edf with time. Here are some specifics. Each day I have an estimate of a distribution function and a new sample of about 1e4 points from the distribution in question. I want to update my estimate to include the new observations (with some aging coefficient to adapt to the changes of the df w/ time). Is there any R (or even non-R) code that can do this? Any relevant references will be appreciated as well. Thanks, Vadim [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Scoping and nls.
Rolf Turner rolf at math.unb.ca writes: : : A colleague of mine is trying to use nls() to effect an optimization, : and is encountering a scoping problem. I should know how to solve it : for him but well, I just don't. : : I also had a quick scrounge of the archives --- I know I've seen this : topic addressed before --- but I couldn't track it down. : : So here's a toy example that demonstrates the problem: : : hhh - function(y,x) { : g - function(a,b,x) {1/(1+a^2 + b^2*exp(x))} : nls(y~g(a,b,x),data=data.frame(x=x,y=y)) : } : set.seed(123) : x - runif(50,1,10) : y - 1/(1+16 + 36*exp(x)) + rnorm(50,0,0.1) : hhh(y,x) : : which results in an error : : Error in get(x, envir, mode, inherits) : variable g was not found : : So can one assign the function ``g'' somewhere where it **can** : be found? I.e. use something like : : assign(g,g,envir=??) : : Or is there some other magic incantation that can be used here : to get nls to deal with a ``g'' defined inside the function : which call nsl()? : : In the real problem the function g is a complicated gadget, taking : different forms in different parts of its domain, so it is : inconvenient-to-impossible to specify it explicitly in the formula in : the call to nls(). : You can assign g in the global environment. Alternately, note from ?nls that functions in the formula are looked up in the environment of the formula so just be sure to set up your formula so that the its environment is the one inside hhh. Thus any of these should work: 1. add the statement assign(g, g, .GlobalEnv) after the definition of g. (This has the drawback of adding variable g to the your Global Environment possibly clobbering any g that was already there.) 2. replace the nls statement with: fo - y ~ g(a,b,x) nls(fo,data=data.frame(x=x,y=y),start=c(a=0,b=0)) 3. replace the nls statement with: nls(as.formula(y~g(a,b,x)),data=data.frame(x=x,y=y),start=c(a=0,b=0)) __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Ref: Variable scope or function behaviour or array reassign
Kunal Shetty kshe4 at student.monash.edu writes: : : Uwe Ligges :thank you for u prompt reply : my problem was in step3 : where my function returns two different arrays. : Yes i did try returning an object from the array. : but the problem became...i tired returning the two arrays in a dataframe such as : : newXY - data.frame(newXmean=newx, newYmean =newy) : : but in the calling function or loop; i wasn't able to access each individual array as an array; from the : assigned object. : : Output - algoResult(x,y,xNA,yNA,ctr); Output : : print(Output) ?? : print(Output[1]) : print(Output$newy) : : hence was trying to assign the global arrays within the function itself without bothering to return any object... : :any help on this.. : : regards : Kunal You need to be clearer in your questions. Reduce your problem to a short reproduceable example that runs and then manually provide the exact output that you want it to produce but it is not producing. Reproducable means that someone can copy it from your email, paste it into their R session and see the output as you do. Read the posting guide for more info. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html