Re: [R] subsetting, aggregating and zoo
I think the following does what you want: (d - structure(c(6586, 6586, 6589, 6593, 6593, 6593, 6598, 6598, 6598, 6598), class = Date)) [1] 1988-01-13 1988-01-13 1988-01-16 1988-01-20 1988-01-20 1988-01-20 1988-01-25 [8] 1988-01-25 1988-01-25 1988-01-25 (td - table(d)) d 6586 6589 6593 6598 2134 names(td) - as.Date(as.numeric(names(td))) # to make the names more readable print(td) 1988-01-13 1988-01-16 1988-01-20 1988-01-25 2 1 3 4 HTH, Tobias -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez Sent: 02 November 2006 09:58 AM To: Gabor Grothendieck Cc: R-Help Subject: Re: [R] subsetting, aggregating and zoo Dear Gabor, The solution below was very useful for me, but I have, I hope, one last question about extracting some specific data. How to count , from below, the number of times a date is repeated, that is: starts [1] 1988-01-13 1988-01-13 1988-01-16 1988-01-20 1988-01-20 [6] 1988-01-20 1988-01-25 1988-01-25 1988-01-25 1988-01-25 dput(starts[1:10], control = all) structure(c(6586, 6586, 6589, 6593, 6593, 6593, 6598, 6598, 6598, 6598), class = Date) So I need to know how many times, for example, 1988-01-03 is repeated (in this case, 2 times) Can't find what function to use. Best regards, Antonio Gabor Grothendieck escribió: Sorry, the line starting idx - should have time(z) in place of z. That is, year - as.Date(c( 1988-01-13, 1988-01-14, 1988-01-16, 1988-01-20, 1988-01-21, 1988-01-22, 1988-01-25, 1988-01-26, 1988-01-27, 1988-01-28)) x - c( 7.973946, 9.933518, 7.978227, 7.512960, 6.641862, 5.667780, 5.721358, 6.863729, 9.60, 9.049846) z - zoo(x, year) idx - cumsum(c(1, diff(time(z)) != 1)) starts - time(z)[match(idx, idx)] ends - time(z)[cumsum(table(idx))[idx]] aggregate(z, starts, mean) By the way, dput(v, control = all) will output variable v in a form easily pastable by someone else into their session. On 10/29/06, antonio rodriguez [EMAIL PROTECTED] wrote: Gabor Grothendieck escribió: Try this: # test data x - c(1:4, 6:8, 10:14) z - zoo(x, as.Date(x)) # idx is 1 for first run, 2 for second run, etc. idx - cumsum(c(1, diff(z) != 1)) # starts replaces each time with the start time of that run # ends is similar but for ends starts - time(z)[match(idx, idx)] ends - time(z)[cumsum(table(idx))[idx]] # average over each run using the time of the end of run for the result # replace ends with starts if that is preferred aggregate(z, ends, mean) Yes it's OK in your example, but when I try to do it with my data I don't get the same figure. is.zoo(z) [1]TRUE atributes(z) $index [1] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 ... ... [3861] 2005-12-20 2005-12-23 2005-12-24 2005-12-25 2005-12-26 [3866] 2005-12-27 2005-12-30 $class [1] zoo z[1:10] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 1988-01-22 1988-01-25 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 1988-01-26 1988-01-27 1988-01-28 6.863729 9.60 9.049846 If I follow your instructions, idx - cumsum(c(1, diff(z) != 1)) starts - time(z)[match(idx, idx)] ends - time(z)[cumsum(table(idx))[idx]] s1 - aggregate(z, starts, mean) s1[1:10] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 1988-01-22 1988-01-25 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 1988-01-26 1988-01-27 1988-01-28 6.863729 9.60 9.049846 s2 - aggregate(z, starts, mean) s2[1:10] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 1988-01-22 1988-01-25 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 1988-01-26 1988-01-27 1988-01-28 6.863729 9.60 9.049846 Always the same. Don't know why (there are not NA's in the series) Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Nedbank Limited Reg No 1951/09/06. The following link displays the names of the Nedbank Board of Directors and Company Secretary. [ http://www.nedbank.co.za/terms/DirectorsNedbank.htm ] This email is confidential and is intended for the addressee only. The following link will take you to Nedbank's legal notice. [ http://www.nedbank.co.za/terms/EmailDisclaimer.htm ] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and
Re: [R] axis labels title not visible
J Greenbaum wrote: Dear all, I recently upgraded to R-2.4.0 and have had some difficulties with axis labels. When I create a plot on the X11 display, the labels (including the title) are not visible. However, if I execute the exact same command on the pdf display, the labels are printed. I've tried explicitly setting axes=TRUE, but the result is the same. I have also tried downgrading to 2.3.1 and that didn't help. This has to be something really obvious that I can't see for some reason. Any ideas? Have you changed some default in some startup script? What is the code that reproduces your problem? Uwe Ligges FYI, I am running this on Ubuntu 6.10 (Edgy Eft). Thanks! -Jay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting, aggregating and zoo
Brandt, T. (Tobias) escribió: I think the following does what you want: (d - structure(c(6586, 6586, 6589, 6593, 6593, 6593, 6598, 6598, 6598, 6598), class = Date)) [1] 1988-01-13 1988-01-13 1988-01-16 1988-01-20 1988-01-20 1988-01-20 1988-01-25 [8] 1988-01-25 1988-01-25 1988-01-25 (td - table(d)) Dear Tobias, Yes it does!! And it's enough with the last sentence: td-table(d) since the following outputs (don't know why, probably because I'm working with a zoo object?): names(td) - as.Date(as.numeric(names(td))) # to make the names more readable Warning message: NAs introducidos por coerción print(td) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 213654343111 101 12 Thanks a lot! Antonio d 6586 6589 6593 6598 2134 names(td) - as.Date(as.numeric(names(td))) # to make the names more readable print(td) 1988-01-13 1988-01-16 1988-01-20 1988-01-25 2 1 3 4 HTH, Tobias __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with chooseCRANmirror()
This is a problem with internet connectivity from your machine (or cran.r-project.org was down at the time, but it is not now). You may well need to set a proxy, for example: see ?download.file if you do. On Wed, 1 Nov 2006, Perry Macdonald wrote: I get this error when using chooseCRANmirror(). chooseCRANmirror() Error in open.connection(file, r) : unable to open connection In addition: Warning message: unable to connect to 'cran.r-project.org' on port 80. The TclTk window comes up and I can scroll and select a mirror, but it doesn't appear that I can connect properly. I am using RedHat Enterprise. I also can't connect to download the akima package install.packages(akima) --- Please select a CRAN mirror for use in this session --- Error in open.connection(file, r) : unable to open connection In addition: Warning message: unable to connect to 'cran.r-project.org' on port 80. Loading Tcl/Tk interface ... done Warning: unable to access index for repository http://www.biometrics.mtu.edu/CRAN/src/contrib Warning in download.packages(pkgs, destdir = tmpd, available = available, : no package 'akima' at the repositories I appreciate any direction that I can be given... Perry __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] poly() question
On Wed, 1 Nov 2006, Jonathan Greenberg wrote: Besides the primary citation, Kennedy, W. J. Jr and Gentle, J. E. (1980) Statistical Computing Marcel Dekker. (which is $300 and my library doesn't have it), is there any other documentation on how to take a poly() object and predict by hand new data? Yes, the R code for poly! It would be nice to be given credit for providing both a precise reference *and* access to the code for the algorithm used. E.g. What do those coefficients actually mean (The orthogonal polynomial is summarized by the coefficients, which can be used to evaluate it via the three-term recursion...)? We created a GLM model with a poly() term and I'm trying to apply this model in another program (grass gis via mapcalc) without requiring the direct link with R if at all possible. We'd like to avoid making a lookup table if at all possible. Thanks! The three-term recursion is obvious in the R code for poly(). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Complex plotting problem
Hello, I would like to make a plot (preferably lines, but points will do too), where the line segment changes color depending on the value of the y-axis. For example, let's suppose the y-axis range is from -1 to 1. Points close to -1 would be colored blue, while points close to 1 will be colored red. Points in between will be varying degrees of blue/red depending on how close they are to -1 or +1. If the above is not possible, would it be possible to set a decision boundary on the plot, where any point above this boundary will be a particular color, and any point below will be a different color? Any suggestions as to how I might accomplish this would be much appreciated. Regards, Wee-Jin p.s. The data set I'm talking about has about 20,000 points. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting, aggregating and zoo
aggregate can also be used: aggregate(d, list(d = d), length) # output is data frame or using zoo: library(zoo) aggregate(zoo(as.vector(d)), d, length) # output is a zoo object If what you actually have is a zoo object such as this one: z - zoo(1:10, d) then the last statement could be written aggregate(z, time(z), length) Note that z has non-unique times so strictly speaking z is an illegal zoo object.although at least currently such objects can be constructed by zoo or read.zoo and operated on by aggregate.zoo though most other zoo operations will not accept them. On 11/2/06, antonio rodriguez [EMAIL PROTECTED] wrote: Brandt, T. (Tobias) escribió: I think the following does what you want: (d - structure(c(6586, 6586, 6589, 6593, 6593, 6593, 6598, 6598, 6598, 6598), class = Date)) [1] 1988-01-13 1988-01-13 1988-01-16 1988-01-20 1988-01-20 1988-01-20 1988-01-25 [8] 1988-01-25 1988-01-25 1988-01-25 (td - table(d)) Dear Tobias, Yes it does!! And it's enough with the last sentence: td-table(d) since the following outputs (don't know why, probably because I'm working with a zoo object?): names(td) - as.Date(as.numeric(names(td))) # to make the names more readable Warning message: NAs introducidos por coerción print(td) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 213654343111 101 12 Thanks a lot! Antonio d 6586 6589 6593 6598 2134 names(td) - as.Date(as.numeric(names(td))) # to make the names more readable print(td) 1988-01-13 1988-01-16 1988-01-20 1988-01-25 2 1 3 4 HTH, Tobias __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] repeating symbols and colors
Charles Annis, P.E. wrote: Here’s an easy one. Well, easy for those more clever than I am. I am plotting several groups and use symbols 15:25, pch - 15:25 Sometimes, however, I need more than those and would like to have them recycled automatically so that pch[12] = pch[1]. Perhaps I can use %% or kludge up a multi-line, multi-if solution, but hope that a kind helper can suggest something more elegant. maybe rep(...,length.out=...) ? I am also using RColorBrewer and like Set1 but that has only 9 colors. I don't want infinitesimal color gradations and would prefer to re-use those colors if I can find a way to recycle them too. Since the number of available colors and available symbols differ, the color/symbol combinations will be unique for the recycled usage. color.gradient in the plotrix package allows the user to build a set of colors with a specified number of elements, from simply interpolating between two endpoints to specifying every RGB component. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Complex plotting problem
Wee-Jin Goh wrote: Hello, I would like to make a plot (preferably lines, but points will do too), where the line segment changes color depending on the value of the y-axis. For example, let's suppose the y-axis range is from -1 to 1. Points close to -1 would be colored blue, while points close to 1 will be colored red. Points in between will be varying degrees of blue/red depending on how close they are to -1 or +1. If the above is not possible, would it be possible to set a decision boundary on the plot, where any point above this boundary will be a particular color, and any point below will be a different color? Any suggestions as to how I might accomplish this would be much appreciated. Have a look at the examples for color.scale and color.scale.lines in the plotrix package. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to run R code without R enviorment at Windows?
Hi I sometimes use R installation on USB flash memory and start R directly from it. However I do not know if it can be done in your case. HTH Petr On 1 Nov 2006 at 8:14, Wang, Luyong (SCR US) wrote: Date sent: Wed, 1 Nov 2006 08:14:00 -0800 From: Wang, Luyong (SCR US) [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] How to run R code without R enviorment at Windows? Hello. I have a problem with R code running. Since I need to run my R code at a Windows Server rountinely. But I can not install R language on that windows machine. Is there anyway to package R code into standalone executables, which does not need the administrator to install R on that machine? Any advice is appreciated! Thanks a lot for your help, Victor [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] splitting very long character string
Hello, thanks a lot for your help on splitting the string to get a numeric vector. I'm now writign the string to a tempfile and read it in via scan - this is fast enough for me: library(XML); ... tmp = xmlElementsByTagName(root, 'tofDataSample', recursive=T); tmp = xmlValue(tmp[[1]]); cat(paste('splitting', nchar(tmp), 'string ...\n')); tmp.file = tempfile(); sink(tmp.file); cat(tmp); sink(); tmp = scan(tmp.file); unlink(tmp.file); cat(paste('splitting done,', length(tmp), 'elements\n')); thanks again and kind regards, Arne -Original Message- From: john seers (IFR) [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 01, 2006 17:01 To: Muller, Arne PH/FR; r-help@stat.math.ethz.ch Subject: RE: [R] splitting very long character string Hi Arne If you are reading in from files and they are just one number per line it would be more efficient to use scan directly. ?scan For example: filen-C:/temp/tt.txt i-scan(filen) Read 5 items i [1] 12345 5643765674 63566565666 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 01 November 2006 15:47 To: r-help@stat.math.ethz.ch Subject: [R] splitting very long character string Hello, I've a very long character array (500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string. The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this: 12345 564376 5674 6356656 5666 I've to read about a hundred of these files and was wondering whether there's a more efficient way to turn this string into an array of numerics. Any ideas? thanks a lot for your help and kind regards, Arne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] splitting very long character string
You could use the file= argument on cat to avoid the two calls to sink: cat(tmp, file = tmp.file) On 11/2/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, thanks a lot for your help on splitting the string to get a numeric vector. I'm now writign the string to a tempfile and read it in via scan - this is fast enough for me: library(XML); ... tmp = xmlElementsByTagName(root, 'tofDataSample', recursive=T); tmp = xmlValue(tmp[[1]]); cat(paste('splitting', nchar(tmp), 'string ...\n')); tmp.file = tempfile(); sink(tmp.file); cat(tmp); sink(); tmp = scan(tmp.file); unlink(tmp.file); cat(paste('splitting done,', length(tmp), 'elements\n')); thanks again and kind regards, Arne -Original Message- From: john seers (IFR) [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 01, 2006 17:01 To: Muller, Arne PH/FR; r-help@stat.math.ethz.ch Subject: RE: [R] splitting very long character string Hi Arne If you are reading in from files and they are just one number per line it would be more efficient to use scan directly. ?scan For example: filen-C:/temp/tt.txt i-scan(filen) Read 5 items i [1] 12345 5643765674 63566565666 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 01 November 2006 15:47 To: r-help@stat.math.ethz.ch Subject: [R] splitting very long character string Hello, I've a very long character array (500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string. The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this: 12345 564376 5674 6356656 5666 I've to read about a hundred of these files and was wondering whether there's a more efficient way to turn this string into an array of numerics. Any ideas? thanks a lot for your help and kind regards, Arne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Likelihood of multiple random processes
Is there a method in R for estimating the likelihood that two (or more) random variables generated a univariate sample? For a single random variable there is: x - c(rnorm(20,10,3),rnorm(20,20,5)) plot(density(x)) logLik(fitdistr(x,normal)) Is there a way of of specifying that more than one normal distribution should be fitted? If so, then I suppose that the AIC of the two models could be calculated. Many thanks, Dan Bebber Department of Plant Sciences University of Oxford __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simple question about Lists
Hello, I know this must be a very simple problem, but I can't work it out from the documentation that is available. I've got a list of data I would like to plot (the weights of a single neuron that was trained using the neural package). The problem I'm encountering is that this set of weights, are in the form of a list. network$weigth[1] [[1]] [,1] [1,] -0.04687623 [2,] -0.54087443 [3,] -1.68130221 [4,] -0.82295266 [5,] 1.60848361 [6,] 1.55903277 [7,] 0.29005900 [8,] 1.24387657 [9,] -0.05129092 [10,] -1.22469042 [11,] -2.64470326 [12,] 0.10517494 [13,] 1.87561741 [14,] 1.93962447 [15,] 0.99212323 [16,] 0.46430803 [17,] -0.31660246 [18,] -0.81997588 [19,] 0.22277782 [20,] 0.97456769 [21,] 0.46083111 [22,] 1.46876956 [23,] -0.19702465 [24,] -0.34898054 [25,] 1.22504724 Now, I've tried as.vector to convert it to a vector for plotting. Doesn't work. Tried as.matrix, that too doesn't work. I've tried accessing individual elements, but that doesn't work as network$weigth [1] returns what seems to me is a matrix but it doens't act like a matrix. Any help would be much obliged. Wee-Jin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Likelihood of multiple random processes
Do you know which observations came from which process (you do in your example, but it whatever it is supposed to emulate)? If not, you want to estimate a mixture distribution. This is covered in chapter 16 of the book fitdistr() supports as well as in several CRAN packages. On Thu, 2 Nov 2006, Dan Bebber wrote: Is there a method in R for estimating the likelihood that two (or more) random variables generated a univariate sample? For a single random variable there is: x - c(rnorm(20,10,3),rnorm(20,20,5)) plot(density(x)) logLik(fitdistr(x,normal)) Is there a way of of specifying that more than one normal distribution should be fitted? If so, then I suppose that the AIC of the two models could be calculated. Many thanks, Dan Bebber Department of Plant Sciences University of Oxford __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple question about Lists
Hello, You can try to merge network$wieght in the data frame, and the plot a first row from it. DataF - do.call (rbind,network$weight) Andris On Ceturtdiena, 2. Novembris 2006 12:53, Wee-Jin Goh wrote: Hello, I know this must be a very simple problem, but I can't work it out from the documentation that is available. I've got a list of data I would like to plot (the weights of a single neuron that was trained using the neural package). The problem I'm encountering is that this set of weights, are in the form of a list. network$weigth[1] [[1]] [,1] [1,] -0.04687623 [2,] -0.54087443 [3,] -1.68130221 [4,] -0.82295266 [5,] 1.60848361 [6,] 1.55903277 [7,] 0.29005900 [8,] 1.24387657 [9,] -0.05129092 [10,] -1.22469042 [11,] -2.64470326 [12,] 0.10517494 [13,] 1.87561741 [14,] 1.93962447 [15,] 0.99212323 [16,] 0.46430803 [17,] -0.31660246 [18,] -0.81997588 [19,] 0.22277782 [20,] 0.97456769 [21,] 0.46083111 [22,] 1.46876956 [23,] -0.19702465 [24,] -0.34898054 [25,] 1.22504724 Now, I've tried as.vector to convert it to a vector for plotting. Doesn't work. Tried as.matrix, that too doesn't work. I've tried accessing individual elements, but that doesn't work as network$weigth [1] returns what seems to me is a matrix but it doens't act like a matrix. Any help would be much obliged. Wee-Jin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple question about Lists
Try this: L - list(matrix(1:10, 10)) L [[1]] [,1] [1,]1 [2,]2 [3,]3 [4,]4 [5,]5 [6,]6 [7,]7 [8,]8 [9,]9 [10,] 10 plot(L[[1]]) If your object is somehow different then please display it like this: dput(x, control = all) where x is your object so we can reproduce it exactly. On 11/2/06, Wee-Jin Goh [EMAIL PROTECTED] wrote: Hello, I know this must be a very simple problem, but I can't work it out from the documentation that is available. I've got a list of data I would like to plot (the weights of a single neuron that was trained using the neural package). The problem I'm encountering is that this set of weights, are in the form of a list. network$weigth[1] [[1]] [,1] [1,] -0.04687623 [2,] -0.54087443 [3,] -1.68130221 [4,] -0.82295266 [5,] 1.60848361 [6,] 1.55903277 [7,] 0.29005900 [8,] 1.24387657 [9,] -0.05129092 [10,] -1.22469042 [11,] -2.64470326 [12,] 0.10517494 [13,] 1.87561741 [14,] 1.93962447 [15,] 0.99212323 [16,] 0.46430803 [17,] -0.31660246 [18,] -0.81997588 [19,] 0.22277782 [20,] 0.97456769 [21,] 0.46083111 [22,] 1.46876956 [23,] -0.19702465 [24,] -0.34898054 [25,] 1.22504724 Now, I've tried as.vector to convert it to a vector for plotting. Doesn't work. Tried as.matrix, that too doesn't work. I've tried accessing individual elements, but that doesn't work as network$weigth [1] returns what seems to me is a matrix but it doens't act like a matrix. Any help would be much obliged. Wee-Jin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Likelihood of multiple random processes
Do you know which observations came from which process (you do in your example, but it whatever it is supposed to emulate)? No- I need to determine whether more than one process could have been involved. If not, you want to estimate a mixture distribution. This is covered in chapter 16 of the book fitdistr() supports as well as in several CRAN packages. Many thanks- I didn't know they were called mixture models. Page 437 is in front of me now. On Thu, 2 Nov 2006, Dan Bebber wrote: Is there a method in R for estimating the likelihood that two (or more) random variables generated a univariate sample? For a single random variable there is: x - c(rnorm(20,10,3),rnorm(20,20,5)) plot(density(x)) logLik(fitdistr(x,normal)) Is there a way of of specifying that more than one normal distribution should be fitted? If so, then I suppose that the AIC of the two models could be calculated. Many thanks, Dan Bebber Department of Plant Sciences University of Oxford __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.409 / Virus Database: 268.13.23/513 - Release Date: 02/11/2006 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] avoiding a loop: cumsum-like
Hello Rhelpers, I need to run the following loop over a large number of data-sets, and was wondering if it could somehow be vectorized. It's more or less a cumulative sum, but slightly more complex. Here's the code, and an example dataset (called tab in my code) follows. Thanks in advance for any suggestions! res-0 for (i in min(tab$Date):max(tab$Date)) { if (is.na(tab$posit.lat[tab$Date==i])==T) { res-c(res,res[length(res)]+tab$x.jour[tab$Date==i]) } else { if (res[tab$posit.lat[tab$Date==i]+1]30) { res-c(res,res[length(res)]+tab$x.jour[tab$Date==i]) } else { res-c(res,res[length(res)]+tab$x.jour[tab$Date==i]+0.8*res[tab$posit.lat[tab$Date==i]+1]) } } } res[-1] Datex.jour posit.lat 35804 0 NA 35805 0 NA 35806 0 NA 35807 0 NA 35808 0 NA 35809 2.97338883 NA 35810 2.796389915 NA 35811 0 NA 35812 0 NA 35813 1.000711886 NA 35814 0.894422571 NA 35815 0 NA 35816 0 NA 35817 0 NA 35818 0 NA 35819 0 NA 35820 0 NA 35821 0 NA 35822 0 NA 35823 0 NA 35824 0 NA 35825 0 NA 35826 0 NA 35827 0 NA 35828 0 NA 35829 0 NA 35830 0 NA 35831 0 NA 35832 0 NA 35833 0 NA 35834 0 NA 35835 0 NA 35836 0 NA 35837 0 NA 35838 0 NA 35839 0 NA 35840 2.47237455 NA 35841 0 2 35842 0 3 35843 0 4 35844 0 5 35845 0 6 35846 0 7 35847 4.842160488 8 35848 2.432125036 9 35849 0 10 35850 0 12 35851 0 14 35852 0 16 35853 3.739683882 18 35854 1.980214421 20 35855 0 22 35856 0 24 35857 5.953444078 27 35858 6.455722475 29 35859 0 31 35860 3.798690334 32 35861 6.222993364 34 35862 3.746243098 35 35863 0 35 35864 0 36 35865 0 37 35866 0 38 35867 0 38 35868 0 39 35869 0 40 35870 0 41 35871 0 42 35872 0 43 35873 0 44 35874 0 45 35875 0 46 35876 0 47 35877 1.951774892 48 35878 0 49 35879 0 50 35880 1.702837643 50 35881 0 52 35882 0 53 35883 0 54 35884 0 55 35885 5.953444078 57 35886 0 58 35887 5.737515358 59 35888 0 61 35889 6.215941227 63 35890 4.731576675 64 35891 0 66 35892 2.255448314 66 35893 3.782283008 67 35894 3.244474546 68 35895 1.808553193 69 35896 2.622680002 70 35897 0 71 35898 0 72 35899 0 72 35900 1.7084177 73 35901 1.28455982 74 35902 2.320013736 76 35903 0 77 35904 0 78 35905 0 79 35906 0 79 35907 0 80 35908 6.716812458 81 35909 0 82 35910 6.796571531 84 35911 5.573668337 85 35912 5.42513958 86 35913 3.774513877 86 35914 0 87 35915 0 89 35916 0 90 35917 4.208252725 91 35918 0 92 35919 0 93 35920 0 95 35921 5.70023661 97 35922 0 98 35923 0 100 35924 0 102 35925 0 103 35926 0 104 David Gouache Arvalis - Institut du Végétal Station de La Minière 78280 Guyancourt Tel: 01.30.12.96.22 / Port: 06.86.08.94.32 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] simulation with rpois
Hi there, I need some helpo with one simulation. I have a matrix of 4x21 I want ro generate 100 random Chi2 distribution but inly from the first row of my matrix. This is what I try: Option (a): lambda=1:100 f=function(x)chisq(4,0,x) lapply(lambda,f) It doesn't work! option(b): m=mean(matrix[1,]) x-rpois(100,lambda=m) Works, but only generates a row of 25 values. The point is: I need a matrix of 100(rows) x 4(columns) thanks a lot! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subsetting, aggregating and zoo
Dear Gabor, Many thanks!! Best regards, Antonio Gabor Grothendieck escribió: aggregate can also be used: aggregate(d, list(d = d), length) # output is data frame or using zoo: library(zoo) aggregate(zoo(as.vector(d)), d, length) # output is a zoo object If what you actually have is a zoo object such as this one: z - zoo(1:10, d) then the last statement could be written aggregate(z, time(z), length) Note that z has non-unique times so strictly speaking z is an illegal zoo object.although at least currently such objects can be constructed by zoo or read.zoo and operated on by aggregate.zoo though most other zoo operations will not accept them. On 11/2/06, antonio rodriguez [EMAIL PROTECTED] wrote: Brandt, T. (Tobias) escribió: I think the following does what you want: (d - structure(c(6586, 6586, 6589, 6593, 6593, 6593, 6598, 6598, 6598, 6598), class = Date)) [1] 1988-01-13 1988-01-13 1988-01-16 1988-01-20 1988-01-20 1988-01-20 1988-01-25 [8] 1988-01-25 1988-01-25 1988-01-25 (td - table(d)) Dear Tobias, Yes it does!! And it's enough with the last sentence: td-table(d) since the following outputs (don't know why, probably because I'm working with a zoo object?): names(td) - as.Date(as.numeric(names(td))) # to make the names more readable Warning message: NAs introducidos por coerción print(td) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 213654343111 101 12 Thanks a lot! Antonio d 6586 6589 6593 6598 2134 names(td) - as.Date(as.numeric(names(td))) # to make the names more readable print(td) 1988-01-13 1988-01-16 1988-01-20 1988-01-25 2 1 3 4 HTH, Tobias __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RE : Individual Based Model and/or Cellular automata
try this package: simecol and check out its website: http://hhbio.wasser.tu-dresden.de/projects/simecol/ -Message d'origine- De : Milton Cezar Ribeiro [mailto:[EMAIL PROTECTED] Envoyé : jeudi 2 novembre 2006 03:16 À : r-help@stat.math.ethz.ch Objet : [R] Individual Based Model and/or Cellular automata Hi R-gurus, Is there someone working with Individual-Based-Models (IBM) or Agent-Based-Models (ABM) with our withour Cellular Automata (CA) in R? I´m looking for develop some ecological applications, Kind regards, Miltinho Brazil - [[alternative HTML version deleted]] David Gouache Arvalis - Institut du Végétal Station de La Minière 78280 Guyancourt Tel: 01.30.12.96.22 / Port: 06.86.08.94.32 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] poly() question
Dear Jonathan, An alternative is to use the raw argument to poly(), possibly after centering the predictor. This probably will work OK as long as the degree of the polynomial isn't high. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Greenberg Sent: Wednesday, November 01, 2006 9:39 PM To: R-help Subject: [R] poly() question Besides the primary citation, Kennedy, W. J. Jr and Gentle, J. E. (1980) Statistical Computing Marcel Dekker. (which is $300 and my library doesn't have it), is there any other documentation on how to take a poly() object and predict by hand new data? E.g. What do those coefficients actually mean (The orthogonal polynomial is summarized by the coefficients, which can be used to evaluate it via the three-term recursion...)? We created a GLM model with a poly() term and I'm trying to apply this model in another program (grass gis via mapcalc) without requiring the direct link with R if at all possible. We'd like to avoid making a lookup table if at all possible. Thanks! --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research Center MS 242-4 Moffett Field, CA 94035-1000 Office: 650-604-5896 Cell: 415-794-5043 AIM: jgrn307 MSN: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulation with rpois
I think there's only one mistake in your instructions. Try this: lambda=1:100 f=function(x)rchisq(4,0,x) lapply(lambda,f) It generates a list of 4-length vectors. Notice that the function 'chisq' doesn't exists. I suppose it has to be replaced by 'rchisq'. Isaac. -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de Pablo Andres Enviado el: jueves, 02 de noviembre de 2006 12:59 Para: R-help@stat.math.ethz.ch Asunto: [R] simulation with rpois Hi there, I need some helpo with one simulation. I have a matrix of 4x21 I want ro generate 100 random Chi2 distribution but inly from the first row of my matrix. This is what I try: Option (a): lambda=1:100 f=function(x)chisq(4,0,x) lapply(lambda,f) It doesn't work! option(b): m=mean(matrix[1,]) x-rpois(100,lambda=m) Works, but only generates a row of 25 values. The point is: I need a matrix of 100(rows) x 4(columns) thanks a lot! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix manipulation with a for loop
Your for-loops aren't set up properly: try for(i in 1:NCOL(F.zoo)) HTH, Fabian Scheipl -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question on cross-validation in rpart
Hi R folks, I am using R version 2.2.1 for Unix. I am exploring the rpart function, in particular the rpart.control parameter. I have tried using different values for xval (0, 1, 10, 20) leaving other parameters constant but I receive the same tree after each run. Is the10 fold cross-validation default still running every time? I would expect the trees to change at least a little when I change the number of folds in the cross-validation but this is not the case in my tests. Any advice would be greatly appreciated. Thanks, -- Brian Sanborn [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question on cross-validation in rpart
On Thu, 2 Nov 2006, Brian Sanborn wrote: Hi R folks, I am using R version 2.2.1 for Unix. I am exploring the rpart function, in particular the rpart.control parameter. I have tried using different values for xval (0, 1, 10, 20) leaving other parameters constant but I receive the same tree after each run. Is the10 fold cross-validation default still running every time? I would expect the trees to change at least a little when I change the number of folds in the cross-validation but this is not the case in my tests. Any advice would be greatly appreciated. Why do you expect that? 1) The tree returned is not pruned, and the cross-validation affects other information in the rpart object. 2) The cross-validation is used in choosing the cost-complexity parameter cp, that is the degree of pruning to be applied via e.g. printcp or plotcp. I think you need to study the documentation about using rpart, either its technical reports or MASS chapter 9. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] axis labels title not visible
No, I haven't changed anything like that. I did recently change my xorg.conf file to get the fglrx driver running and I have a feeling that has something to do with it, since I can login from another PC and issue plot commands that result in graphs w/ axes. I will try reverting to my old xorg.conf file, and see if that helps. I'll keep you posted. As for code that reproduces the problem...any plotting command that I have tried (plot,boxplot,etc.) all result in plots w/ no axes. On 11/2/06, Uwe Ligges [EMAIL PROTECTED] wrote: J Greenbaum wrote: Dear all, I recently upgraded to R-2.4.0 and have had some difficulties with axis labels. When I create a plot on the X11 display, the labels (including the title) are not visible. However, if I execute the exact same command on the pdf display, the labels are printed. I've tried explicitly setting axes=TRUE, but the result is the same. I have also tried downgrading to 2.3.1 and that didn't help. This has to be something really obvious that I can't see for some reason. Any ideas? Have you changed some default in some startup script? What is the code that reproduces your problem? Uwe Ligges FYI, I am running this on Ubuntu 6.10 (Edgy Eft). Thanks! -Jay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R and texmacs
hi all! i'm using texmacs 1.0.6 together with R. My problem is that i can't display figure at all.. it display them in a graphical window, not in texmacs document. thanks for any help, nelson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] correlation argument for lmer?
Dear r-help members, Can lmer() in the lme4 package fit models that have a specified within-group correlation structure, as provided, for example, by the correlation argument to lme() in the nlme package? Thanks, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and texmacs
nelson - [EMAIL PROTECTED] writes: hi all! i'm using texmacs 1.0.6 together with R. My problem is that i can't display figure at all.. it display them in a graphical window, not in texmacs document. You might get better response in a texmacs forum. I think the construction used is to say v() whenever you want to generate a view of a plot inside texmacs, and you could probably do worse than looking at the material at http://email.eva.mpg.de/~lachmann/R-course-2006/index.htm I believe Lachmann actually wrote the R plugin, so he should know what he's doing. (Last I looked, there were things in the plugin, I wasn't too happy with. In particular, there was no way to rerun all the R code in sequence and no sequential order. One R process was running, and the interface sort of assumed R to be stateless, which of course it isn't, so results on page 1 may depend on computations on page 20. Improving the plugin would be a major project, though.) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] correlation argument for lmer?
Not currently. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Fox Sent: Thursday, November 02, 2006 9:51 AM To: 'R-help' Subject: [R] correlation argument for lmer? Dear r-help members, Can lmer() in the lme4 package fit models that have a specified within-group correlation structure, as provided, for example, by the correlation argument to lme() in the nlme package? Thanks, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Adding to user-contributed documentation
I was wondering if anyone knows who should be contacted to add to the R user-contributed documentation at http://www.r-project.org/other-docs.html There doesn't appear to be any information on the page as to how one would add their new resource. I'd like to add a guide I created called Producing Simple Graphs with R http://www.cs.odu.edu/~fmccown/R/ I plan on adding additional graphs (like scatterplots) as time permits. Thanks, Frank __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Prediction intervals for predict.gls
I am using R 2.3.0, Is there a way to get prediction intervals using predict.gls? Any ideas would be appreciated. thanks, Spencer On 11/2/06, Frank McCown [EMAIL PROTECTED] wrote: I was wondering if anyone knows who should be contacted to add to the R user-contributed documentation at http://www.r-project.org/other-docs.html There doesn't appear to be any information on the page as to how one would add their new resource. I'd like to add a guide I created called Producing Simple Graphs with R http://www.cs.odu.edu/~fmccown/R/ I plan on adding additional graphs (like scatterplots) as time permits. Thanks, Frank __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] axis labels title not visible
Replacing my xorg.conf file didn't work either. Any more ideas? Thanks! -Jay On 11/2/06, J Greenbaum [EMAIL PROTECTED] wrote: No, I haven't changed anything like that. I did recently change my xorg.conf file to get the fglrx driver running and I have a feeling that has something to do with it, since I can login from another PC and issue plot commands that result in graphs w/ axes. I will try reverting to my old xorg.conf file, and see if that helps. I'll keep you posted. As for code that reproduces the problem...any plotting command that I have tried (plot,boxplot,etc.) all result in plots w/ no axes. On 11/2/06, Uwe Ligges [EMAIL PROTECTED] wrote: J Greenbaum wrote: Dear all, I recently upgraded to R-2.4.0 and have had some difficulties with axis labels. When I create a plot on the X11 display, the labels (including the title) are not visible. However, if I execute the exact same command on the pdf display, the labels are printed. I've tried explicitly setting axes=TRUE, but the result is the same. I have also tried downgrading to 2.3.1 and that didn't help. This has to be something really obvious that I can't see for some reason. Any ideas? Have you changed some default in some startup script? What is the code that reproduces your problem? Uwe Ligges FYI, I am running this on Ubuntu 6.10 (Edgy Eft). Thanks! -Jay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [OT} Pie chart joke
Hat tip to the irreverent Boing Boing group blog: http://www.boingboing.net/2006/11/02/hilarious_piechartvi.html Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT} Pie chart joke
On Thu, 2006-11-02 at 10:26 -0600, Dirk Eddelbuettel wrote: Hat tip to the irreverent Boing Boing group blog: http://www.boingboing.net/2006/11/02/hilarious_piechartvi.html Dirk Wonderful! Be sure to look at the other chart junk linked in the 'update'. Regards, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help went away from top emacs window :-(
Duncan == Duncan Murdoch [EMAIL PROTECTED] on Thu, 02 Nov 2006 06:34:19 -0500 writes: Duncan On 11/1/2006 11:59 PM, Richard M. Heiberger wrote: This is a change in the default in the Windows version of R in 2.4.0. It is not an ESS issue. To change it back, type options(chmhelp=FALSE) Duncan, I think this change in Help default should be added to the Windows FAQ. Duncan It's an install option. The fact that it is now Duncan user-settable is mentioned in the CHANGES file. I Duncan guess the change to the default should also have Duncan been mentioned there (I'll add it), but I wouldn't Duncan call this question frequent. maybe not yet, but accumlated over (future) time ? I presume it does not only affect ESS users but also those of other (non-standard) [G]UIs. OTOH, maybe, it *is* something the GUI authors should take care, i.e., we should consider for the next version of ESS, to issue options(chmhelp=FALSE) automatically by default when we see to be on Windows. Martin Maechler Duncan Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Individual Based Model and/or Cellular automata
Prezado Milton, There is a good article with examples of ABM models in R-news 3/3 2003 here: http://cran.r-project.org/doc/Rnews/Rnews_2003-3.pdf The authors of that article later developed a package to facilitate the development of ecological models, called simecol. Try: install.packages(simecol) library(simecol) ?simecol Regards, Francisco Dr. Francisco J. Zagmutt College of Veterinary Medicine and Biomedical Sciences Colorado State University From: Milton Cezar Ribeiro [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] Individual Based Model and/or Cellular automata Date: Wed, 1 Nov 2006 23:15:41 -0300 (ART) Hi R-gurus, Is there someone working with Individual-Based-Models (IBM) or Agent-Based-Models (ABM) with our withour Cellular Automata (CA) in R? I´m looking for develop some ecological applications, Kind regards, Miltinho Brazil - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. _ Try Search Survival Kits: Fix up your home and better handle your cash with Live Search! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help went away from top emacs window :-(
On 11/2/2006 11:59 AM, Martin Maechler wrote: Duncan == Duncan Murdoch [EMAIL PROTECTED] on Thu, 02 Nov 2006 06:34:19 -0500 writes: Duncan On 11/1/2006 11:59 PM, Richard M. Heiberger wrote: This is a change in the default in the Windows version of R in 2.4.0. It is not an ESS issue. To change it back, type options(chmhelp=FALSE) Duncan, I think this change in Help default should be added to the Windows FAQ. Duncan It's an install option. The fact that it is now Duncan user-settable is mentioned in the CHANGES file. I Duncan guess the change to the default should also have Duncan been mentioned there (I'll add it), but I wouldn't Duncan call this question frequent. maybe not yet, but accumlated over (future) time ? It's only a change for a relatively short time. Soon it will be the status quo. So I don't expect it to be a FAQ, but it belongs in the CHANGES file. I presume it does not only affect ESS users but also those of other (non-standard) [G]UIs. It affects all users who use the installer and don't change the default. OTOH, maybe, it *is* something the GUI authors should take care, i.e., we should consider for the next version of ESS, to issue options(chmhelp=FALSE) automatically by default when we see to be on Windows. Or do what the installer does, and when you install ESS set it in the R_HOME/etc/Rprofile.site file. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rotated figures within Sweave?
I can't recall (or find an example of) how to rotate figures in Sweave: fig=TRUE, echo=false, width=9, landscape=TRUE= ??? fig=TRUE, echo=false, width=9, rotate=true= ??? fig=TRUE, echo=false, width=9, sideways=TRUE= ??? fig=TRUE, echo=false, width=9, par=(something)= ??? Does anyone know how to do this? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help went away from top emacs window :-(
I agree with both Duncan and Martin. With Duncan, that this is not a Windows FAQ. With Martin, that it is an FAQ. I recommend that it go on the R FAQ page, prior to the current 7.24. Here is a draft of the question and an outline of the answer. 7.24 Why does the help information, for example when I type ?lm, show up in (a browser window, an emacs buffer in its own frame, an emacs buffer in the same frame as *R*, in a Windows-style help window, in a new frame inside the Rgui window, in a new frame on the computer screen)? I really want it in the (choose from the same list). The answer includes at least the following: On Windows, set options(chmhelp=TRUE/FALSE). With Java, use help.start() In emacs, set the emacs variable ess-help-frame On the correct default for ESS, I am not sure for myself. I can see a case both for help in emacs buffers and in the chmhelp window. This week I am tending to the chmhelp window, even when on emacs. Rich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing rgl package on linux suse 10.1
Dear, Many thanks for your help. Rgl is up and running! Kind regards, Steven Gorlé Op woensdag 1 november 2006 19:36, schreef Gavin Simpson: On Wed, 2006-11-01 at 15:52 +0100, Steven Gorlé wrote: Dear R wizards, In windows I get really cool graphs with the rgl package. However on linux, it seems that I can't install one of my favourite packages. I get a error message on X11, but all X11 packages are installed on my linux desktop. Who can help me out here? Guessing that you don't have the development headers for X. I've never used SUSE, but on my Fedora system the relevant package is: xorg-x11-devel I think suse uses the Xorg flavour of X so there is a chance the package will be similarly named. If so, install it (or the correct package) and try again. At a terminal, typing rpm -qa | grep x11 might help show you if the basic package is xorg-x11 for which you'd need the devel package mentioned above, or point you in the direction of the correct package to install HTH G Thanks! Steven Gorlé install.packages() * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/lib/R/library/rgl' The downloaded packages are in /tmp/RtmpUAg2Xh/downloaded_packages Warning message: installation of package 'rgl' had non-zero exit status in: install.packages() __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rotated figures within Sweave?
On Thu, 2006-11-02 at 11:03 -0800, Jeff D. Hamann wrote: I can't recall (or find an example of) how to rotate figures in Sweave: fig=TRUE, echo=false, width=9, landscape=TRUE= ??? fig=TRUE, echo=false, width=9, rotate=true= ??? fig=TRUE, echo=false, width=9, sideways=TRUE= ??? fig=TRUE, echo=false, width=9, par=(something)= ??? Does anyone know how to do this? Jeff, I don't know if Sweave can do this directly, though I have not tried. Rather, there are LaTeX packages that can do this. The key is whether or not you want to rotate just the figure, the figure and the caption or the entire page upon which the figure is located. Typically, I do the latter and use the 'landscape' environment for one or more entire pages (notably where I have wide tables). This rotates the entire page, but leaves any headers/footers in portrait mode. There are also 'sidewaysfigure' and 'sidewaystable' environments and other options that might be applicable to what you want. There is a PDF file that covers this called rotating.pdf. A link to it is: www.perce.de/LaTeX/rotating.pdf with a CTAN link here: http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=rotating The former has examples of rotated figures within a portrait orientation page and other such machinations. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Res: graphics not find source
R or X[Edgy] The problem is not with R. It is with font path settings for X. The FontPath in /etc/X11/xorg.cong is not pointing to the correct directories. I changed the lines (following a lead from here: http://www.ubuntuforums.org/showthread.php?t=268024): # FontPath /usr/share/X11/fonts/misc # FontPath /usr/share/X11/fonts/cyrillic # FontPath /usr/share/X11/fonts/100dpi/:unscaled # FontPath /usr/share/X11/fonts/75dpi/:unscaled # FontPath /usr/share/X11/fonts/Type1 # FontPath /usr/share/X11/fonts/100dpi # FontPath /usr/share/X11/fonts/75dpi to these: FontPath /usr/share/fonts/X11/misc FontPath /usr/share/fonts/X11/cyrillic FontPath /usr/share/fonts/X11/100dpi/:unscaled FontPath /usr/share/fonts/X11/75dpi/:unscaled FontPath /usr/share/fonts/X11/Type1 FontPath /usr/share/fonts/X11/100dpi FontPath /usr/share/fonts/X11/75dpi and it started working. However, a proper fix should be done in order to set the font path correctly. Bruno Churata Ricardo Arias Brito wrote: In ubuntu 6,06 the R normally run, but latter to install the a vesion 6,10 plot this not appearing. computer with problem: /usr/share/X11/fonts$ ls misc Type1 X11R7 In computer OK: /usr/share/X11/fonts$ls 100dpi(*) 75dpi encodings fonts.cache-1 misc Type1 - Mensagem original De: Peter Dalgaard [EMAIL PROTECTED] Para: Ricardo Arias Brito [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Enviadas: Quarta-feira, 1 de Novembro de 2006 18:29:14 Assunto: Re: [R] graphics not find source Ricardo Arias Brito [EMAIL PROTECTED] writes: Hi, The plot function not produces graphics in linux. The msg: Error in X11(): it was not possible to find no source X11 Verifity if the way of sources is correct. Any ideas? Hmm, maybe you shouldn't have tried to translate the message back to English I believe there is a similar message that has to do with _fonts_. If so, then the problem could be related to the font path or to locale issues. What happens if you do LC_ALL=C R ? It could be useful to know more about your system than linux. Which distribution and which version? Compiled yourself or installed from binaries? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rotated figures within Sweave?
Doh! I completely forgot about the LaTeX \begin{}\end{} environments! \begin{figure}[p] \centering fig=TRUE, echo=false, width=9= plot( ... ) @ \end{figure} should have been... \begin{sidewaysfigure}[p] \centering fig=TRUE, echo=false, width=9= plot( ... ) @ \end{sidewaysfigure} And since I use the sidewaysfigure environment all the time, I should have known... my bad. Jeff. -- Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon 97339-1421 On Thu, 2006-11-02 at 11:03 -0800, Jeff D. Hamann wrote: I can't recall (or find an example of) how to rotate figures in Sweave: fig=TRUE, echo=false, width=9, landscape=TRUE= ??? fig=TRUE, echo=false, width=9, rotate=true= ??? fig=TRUE, echo=false, width=9, sideways=TRUE= ??? fig=TRUE, echo=false, width=9, par=(something)= ??? Does anyone know how to do this? Jeff, I don't know if Sweave can do this directly, though I have not tried. Rather, there are LaTeX packages that can do this. The key is whether or not you want to rotate just the figure, the figure and the caption or the entire page upon which the figure is located. Typically, I do the latter and use the 'landscape' environment for one or more entire pages (notably where I have wide tables). This rotates the entire page, but leaves any headers/footers in portrait mode. There are also 'sidewaysfigure' and 'sidewaystable' environments and other options that might be applicable to what you want. There is a PDF file that covers this called rotating.pdf. A link to it is: www.perce.de/LaTeX/rotating.pdf with a CTAN link here: http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=rotating The former has examples of rotated figures within a portrait orientation page and other such machinations. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to Trace Back the Warning Messages
Dear All, I modified a script of mine to allow it to work with complex numbers. I now have some warnings of this kind: Warning messages: 1: imaginary parts discarded in coercion 2: imaginary parts discarded in coercion and so on. I would like to be able to find out where in the code something triggers these messages. I am asking if there is some tool to help debug an R script (even something which allows you to execute only part of a long script and monitor which quantities get changed would be very useful). Kind Regards Lorenzo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Markov blanket
Hi, Is there an R implementation of the HITON Markov blanket discovery algorithm that is referenced for example in the following paper? http://citeseer.ist.psu.edu/cache/papers/cs/27027/http:zSzzSzdiscover1.mc.va nderbilt.eduzSzdiscoverzSzpubliczSzPublicationszSzHITON.pdf/aliferis03hiton. pdf I would also appreciate tips to any related algorithms/methods that are implemented in R. Thanks, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to Trace Back the Warning Messages
I think this is something of an FAQ, though it may not appear in the official listings of such. Execute options(warn=2) That converts warnings to errors; then you can use traceback() to discern where the errors occurred. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Better y-axis labels, and x-axis scaling
Hello I'm plotting some data using matplot with a logarithmic scale on the y-axis. This is the call to matplot I'm using: matplot(turns, distances, type = l, log = y, lty = solid, ylab = , xlab = Time steps, col = c(black)) The values for the 'distances' vector are always between 0 and 1. The result can be seen at http://sneakymustard.com/tmp/plot.jpg As you can see, the default y axis labels are not very nice, as it uses irregular intervals. I tried using variations of axis(2, at = pretty(c(0, ceiling(max(distances))), 5)) or yaxp = c(round(mind, 2), round(maxd, 2), -4) in the matplot() call. Is there anything else I could try for better labeling of values between 0 and 1 in a log-scale axis? Hints or pointers to the appropriate docs are appreciated :) Also, is there a command/option to change the plotted spacing between the labels in a plot? In the plot above, I'd like to make the space between each label in the x-axis smaller (maybe something similar to the width/space options in barplot()). Thanks in advance, Andre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better y-axis labels, and x-axis scaling
Andre Nathan andre at digirati.com.br writes: Hello I'm plotting some data using matplot with a logarithmic scale on the y-axis. This is the call to matplot I'm using: matplot(turns, distances, type = l, log = y, lty = solid, ylab = , xlab = Time steps, col = c(black)) Hmmm. What do you mean by not very nice? This graph seems (to me) to be a typical logarithmic scaling axis. If you really wanted equal scaling you could do matplot(...,axes=FALSE) axis(side=1) pvec - 10^seq(-3,-1,by=0.5) axis(side=2,at=pvec,labels=round(pvec,3)) box() or something like that... warning, totally untested ... (the only way I can think of to get pretty and equally spaced ticks is to use ONLY powers of ten ...) Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] generic arrays in R
Dear R users, Are there any generic arrays (arrays which can store arbitrary objects) in R? Something along the lines of f - function(x) x^2 a - array(f,c(2,2)) etc. I have found fasp in the spatstat package, but in my particular case, I need an array of polynomials, not functions. I know how to hack this together (polynomials can be represented as vectors, so I just extend the dimension) but I am looking for something more generic, and later I might switch to splines. The numerical problem I am solving is the following: I have an array with four indices (a[i,j,k,l]), and I would like to fit something smooth on of one the dimensions, say l, because I need interpolated/smoothed values for intermediate points. Thanks, Tamas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better y-axis labels, and x-axis scaling
On Thu, 2006-11-02 at 23:10 +, Ben Bolker wrote: If you really wanted equal scaling you could do [...] Thanks Ben. Do you know how the the x axis can be made shorter? Best regards, Andre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better y-axis labels, and x-axis scaling
On Thu, 2006-11-02 at 21:49 -0200, Andre Nathan wrote: Do you know how the the x axis can be made shorter? I did it setting the width in the postscript() call, not sure if that's the best way. Andre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ANOVA in Randomized-complete blocks design
Dear all, I am trying to repeat an example from Sokal and Rohlfs Biometry -- Box 11.4, example of a randomized-complete-blocks experiment. The data is fairly simple: series genotype weight 1 pp 0.958 1 pb 0.985 1 bb 0.925 2 pp 0.971 2 pb 1.051 2 bb 0.952 3 pp 0.927 3 pb 0.891 3 bb 0.892 4 pp 0.971 4 pb 1.010 4 bb 0.955 The model used for ANOVA in the book is Y_{ij} = \mu + \alpha_i + B_i + [(\alpha B)_{ij}] + \epsilon_{ij} (I am not quite confident how to represent this model in R, see below) The ANOVA table from SR looks like this: MSBseries 3 0.021 0.007 10.23 ** MSAgenotypes 2 0.010 0.005 6.97 * MSEerror 6 0.004 0.001 In R, I am using the following model (is this correct?) aov.ob = aov( genotype ~ genotype + series ) However, my results are DfSum Sq Mean Sq F value Pr(F) series 3 0.0135867 0.0045289 6.6360 0.02469 * genotype 2 0.0056732 0.0028366 4.1563 0.07367 . Residuals6 0.0040948 0.0006825 What am I doing wrong? Regards, January -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ANOVA in Randomized-complete blocks design
You have mis-transcribed the data: SeriesGenotypeWeight 1pb0.986 3bb0.829 anova(aov(weight ~ series + genotype, data=dat)) gives the correct results when compared to SR. Cheers, Simon. January Weiner wrote: Dear all, I am trying to repeat an example from Sokal and Rohlfs Biometry -- Box 11.4, example of a randomized-complete-blocks experiment. The data is fairly simple: series genotype weight 1 pp 0.958 1 pb 0.985 1 bb 0.925 2 pp 0.971 2 pb 1.051 2 bb 0.952 3 pp 0.927 3 pb 0.891 3 bb 0.892 4 pp 0.971 4 pb 1.010 4 bb 0.955 The model used for ANOVA in the book is Y_{ij} = \mu + \alpha_i + B_i + [(\alpha B)_{ij}] + \epsilon_{ij} (I am not quite confident how to represent this model in R, see below) The ANOVA table from SR looks like this: MSBseries 3 0.021 0.007 10.23 ** MSAgenotypes 2 0.010 0.005 6.97 * MSEerror 6 0.004 0.001 In R, I am using the following model (is this correct?) aov.ob = aov( genotype ~ genotype + series ) However, my results are DfSum Sq Mean Sq F value Pr(F) series 3 0.0135867 0.0045289 6.6360 0.02469 * genotype 2 0.0056732 0.0028366 4.1563 0.07367 . Residuals6 0.0040948 0.0006825 What am I doing wrong? Regards, January -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] maps. display hierararchical cluster analysis results on a map?
All, I have done a cluster analysis analysis of some spatial locations, based on variables other than lat-long, and want to show the results on a map to see if my clusters have some geographic meaning. For kmeans (etc.) I would just use different symbols (etc.) to distinguish the clusters, but I am doing hierarchical CA. I am looking for ideas or (better) code. One idea would be to display the convex hull of each cluster on the map. Another would be to place some graph on the map, connecting the locations, with the same topology as my dendrogram. It seems like something useful would have been developed by biologists studying geographic variation of a species. Any ideas will be greatly appreciated. regards, Farrar [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help needed on data management
Hi, I am quite new in R, but want to try the following data aggregation in R. The data has three columns, and the fourth is what i am trying to get. I created this in SAS, and would like to learn to do it in R. Here is some snapshot of the dataset. I have a list of different users, and on different dates (sorted), they had played several rounds of plays. Date here is coded ascendingly. On each date per user, I want to sum the total number of plays for a span of 3 days counting backward. For example, on the date of 16528 for user 1, the back3 should the sum of 9+3+8=20. For those dates that can only go back for less than 3 days, sum the number of plays on available dates. For example, on date 16527 for userid 1, there are only 2 days, so the sum is 3+8=11. Userid plays dateback3 1 8 16526 8 1 3 16527 11 1 9 16528 20 1 4 16529 16 1 3 16531 16 1 12 16532 19 1 3 16533 18 1 16 16534 31 1 6 16535 25 1 16 16536 38 1 10 16537 32 2 30 16528 30 2 16 16529 46 2 15 16530 61 2 11 16531 42 2 9 16532 35 2 11 16533 31 2 24 16534 44 2 21 16535 56 2 37 16536 82 2 6 16537 64 2 58 16538 101 2 34 16539 98 2 19 16540 111 2 18 16541 71 2 23 16542 60 2 35 16543 76 2 10 16544 68 2 7 16545 52 2 1 16546 18 2 15 16547 23 2 10 16548 26 2 12 16549 37 2 20 16550 42 2 18 16551 50 2 12 16552 50 2 8 16553 38 2 8 16554 28 2 32 16555 48 2 12 16556 52 2 13 16557 57 2 25 16610 50 3 1 16574 1 3 1 16576 2 3 1 16577 3 3 1 16578 3 3 2 16587 4 3 2 16588 5 3 1 16590 5 3 4 16602 7 3 1 16603 6 3 1 16624 6 3 6 16625 8 3 3 16626 10 3 4 16653 13 3 3 16654 10 Any help is appreciated. Alfred __ (http://advision.webevents.yahoo.com/mailbeta) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ANOVA in Randomized-complete blocks design
Ops, sorry. OK, as you see, I am going through SR and doing the examples using R. I have a further question, on the nested ANOVA example from Box 10.1 (mosquito female wing lengths). I made sure that the data is correct :-) (data below). I am not sure how to create in R a Model II nested ANOVA. aov( wing ~ cage / female ) which is, I believe, a fixed effect nested ANOVA where females are nested within cages produced the correct sum of squares, but computates a different F value for the cage effect: Df Sum Sq Mean Sq F valuePr(F) cage 2 665.68 332.84 255.70 1.452e-10 *** cage:female 9 1720.68 191.19 146.88 6.981e-11 *** Residuals 12 15.621.30 (whereas in SR, among cages F = 1.741; the rest is same). The F value for the cage:female effect is the same as in SR. Why do I get a higly significant cage effect? In SR, the significance of the cage effect is done by F = MSamong / MSsubgr = 332.84 / 191.19 = 1.74. In the R model, F = 255.70, and I do not understand where this value comes from (at first I thought that it is MSamong / MSerror = 332.84 / 1.3 = 256.0308). I am confused... How should I modify the model? Another question: is there a way to automatically estimate the variance components, or do I have to take the respective MS' and calculate it myself? Thanks, January OK, here is the data: cage female wing cage1 f1 58.5 cage1 f1 59.5 cage1 f2 77.8 cage1 f2 80.9 cage1 f3 84.0 cage1 f3 83.6 cage1 f4 70.1 cage1 f4 68.3 cage2 f1 69.8 cage2 f1 69.8 cage2 f2 56.0 cage2 f2 54.5 cage2 f3 50.7 cage2 f3 49.3 cage2 f4 63.8 cage2 f4 65.8 cage3 f1 56.6 cage3 f1 57.5 cage3 f2 77.8 cage3 f2 79.2 cage3 f3 69.9 cage3 f3 69.2 cage3 f4 62.1 cage3 f4 64.5 Cheers, January -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ANOVA in Randomized-complete blocks design
## tmp.dat is your data in a file. wing - read.table(tmp.dat, header=TRUE) wing.aov - aov( wing ~ cage + Error(cage:female), data=wing ) anova(wing.aov) ## Notice that at full precision, the R values of the mean squares ## give the number you are looking for 332.84 / 1.3017 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ANOVA in Randomized-complete blocks design
## tmp.dat is your data in a file. wing - read.table(tmp.dat, header=TRUE) wing.aov - aov( wing ~ cage + Error(cage:female), data=wing ) anova(wing.aov) Thanks for the answer! However, I am not able to run the above: wing - read.table(nested.txt, header=TRUE) names(wing) [1] cage female wing wing.aov - aov( wing ~ cage + Error(cage:female), data=wing ) Warning message: Error() model is singular in: aov(wing ~ cage + Error(cage:female), data = wing) anova( wing.aov ) Error in anova(wing.aov) : no applicable method for anova j. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help needed on data management
First create your running sum function and then tapply it to the groups: runsum - function(x, k = 3) diff(c(rep(0, k), cumsum(x)), k) DF$back - unlist(tapply(DF$plays, DF$Userid, runsum)) Note that there is a survey of running sum/mean/etc. here: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/43050.html On 11/2/06, Alfred Xuan [EMAIL PROTECTED] wrote: Hi, I am quite new in R, but want to try the following data aggregation in R. The data has three columns, and the fourth is what i am trying to get. I created this in SAS, and would like to learn to do it in R. Here is some snapshot of the dataset. I have a list of different users, and on different dates (sorted), they had played several rounds of plays. Date here is coded ascendingly. On each date per user, I want to sum the total number of plays for a span of 3 days counting backward. For example, on the date of 16528 for user 1, the back3 should the sum of 9+3+8=20. For those dates that can only go back for less than 3 days, sum the number of plays on available dates. For example, on date 16527 for userid 1, there are only 2 days, so the sum is 3+8=11. Userid plays dateback3 1 8 16526 8 1 3 16527 11 1 9 16528 20 1 4 16529 16 1 3 16531 16 1 12 16532 19 1 3 16533 18 1 16 16534 31 1 6 16535 25 1 16 16536 38 1 10 16537 32 2 30 16528 30 2 16 16529 46 2 15 16530 61 2 11 16531 42 2 9 16532 35 2 11 16533 31 2 24 16534 44 2 21 16535 56 2 37 16536 82 2 6 16537 64 2 58 16538 101 2 34 16539 98 2 19 16540 111 2 18 16541 71 2 23 16542 60 2 35 16543 76 2 10 16544 68 2 7 16545 52 2 1 16546 18 2 15 16547 23 2 10 16548 26 2 12 16549 37 2 20 16550 42 2 18 16551 50 2 12 16552 50 2 8 16553 38 2 8 16554 28 2 32 16555 48 2 12 16556 52 2 13 16557 57 2 25 16610 50 3 1 16574 1 3 1 16576 2 3 1 16577 3 3 1 16578 3 3 2 16587 4 3 2 16588 5 3 1 16590 5 3 4 16602 7 3 1 16603 6 3 1 16624 6 3 6 16625 8 3 3 16626 10 3 4 16653 13 3 3 16654 10 Any help is appreciated. Alfred __ (http://advision.webevents.yahoo.com/mailbeta) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ANOVA in Randomized-complete blocks design
my apologies. anova() doesn't work on class aovlist. It is necessary to use summary(). They are similar for aov, but not for aovlist. wing - read.table(tmp.dat, header=TRUE) wing.aov - aov( wing ~ cage + Error(cage:female), data=wing ) summary(wing.aov) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ANOVA in Randomized-complete blocks design
January Weiner wrote: Ops, sorry. OK, as you see, I am going through SR and doing the examples using R. I have a further question, on the nested ANOVA example from Box 10.1 (mosquito female wing lengths). I made sure that the data is correct :-) (data below). I am not sure how to create in R a Model II nested ANOVA. aov( wing ~ cage / female ) which is, I believe, a fixed effect nested ANOVA where females are nested within cages produced the correct sum of squares, but computates a different F value for the cage effect: Df Sum Sq Mean Sq F valuePr(F) cage 2 665.68 332.84 255.70 1.452e-10 *** cage:female 9 1720.68 191.19 146.88 6.981e-11 *** Residuals 12 15.621.30 (whereas in SR, among cages F = 1.741; the rest is same). The F value for the cage:female effect is the same as in SR. Why do I get a higly significant cage effect? In SR, the significance of the cage effect is done by F = MSamong / MSsubgr = 332.84 / 191.19 = 1.74. In the R model, F = 255.70, and I do not understand where this value comes from (at first I thought that it is MSamong / MSerror = 332.84 / 1.3 = 256.0308). I am confused... aov(wing ~ cage/female) gives you a test of cage against the residual variance and cage:female against the residual variance. As you noticed, the residual variance is the wrong error stratum for the cage effect. To get the correct test of the cage effect, try: summary(aov(wing ~ cage + Error(female))) You will get the correct F test from that. To get the variance components, it is easier to use the lme function in the nlme package: fit - lme(wing ~ cage, random=~1|female) summary(fit) where cage is fixed and female is random. Compare: fit - lme(wing ~ 1, random=~1|cage/female) summary(fit) This treats both cage and female as random effects. VarCorr(fit) will give you the variance components, or you can read off the standard deviations (sqrt of variance components) from summary(fit). Yet another way to analyse the problem is with the lmer function (package lme4). Cheers, Simon. How should I modify the model? Another question: is there a way to automatically estimate the variance components, or do I have to take the respective MS' and calculate it myself? Thanks, January OK, here is the data: cage female wing cage1 f1 58.5 cage1 f1 59.5 cage1 f2 77.8 cage1 f2 80.9 cage1 f3 84.0 cage1 f3 83.6 cage1 f4 70.1 cage1 f4 68.3 cage2 f1 69.8 cage2 f1 69.8 cage2 f2 56.0 cage2 f2 54.5 cage2 f3 50.7 cage2 f3 49.3 cage2 f4 63.8 cage2 f4 65.8 cage3 f1 56.6 cage3 f1 57.5 cage3 f2 77.8 cage3 f2 79.2 cage3 f3 69.9 cage3 f3 69.2 cage3 f4 62.1 cage3 f4 64.5 Cheers, January -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] would like to see R plots on local X display
Dear useRs, Sorry, if this is a FAQ. I just need the direction to dig. I am working on the linux box (its DNS name is raccoon, to be definite), Fedora Core 3. I connect with ssh to another linux box (Debian, dns name chena) and run R on it. When I call a plotting function from the R command line, it produces the file Rplots.ps, containing the required plot. I am running X on the raccoon. When I run R on the raccoon and call a plotting function, I see a window with plots inside. I would like to see similar window on the raccoon, as a result of call to plotting function when R runs on chena. Is it possible? I played a bit with setting the DISPLAY environment on chena, but without success. --- Best regards, Vladimirmailto:[EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Better y-axis labels, and x-axis scaling
Andre Nathan andre at digirati.com.br writes: Thanks Ben. Do you know how the the x axis can be made shorter? If you want to shorten the x interval, use xlim=c(0,750) Otherwise, if you want to decrease the physical width of your plot, you should use the width= argument in call to png, when initializing your plotting device. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Complex plotting problem
I did this with points by supplying the vector in the col= argument. That is, plot(x=x.vector,y=y.vector,col=col.table[y.vector*100+100],pch=16) It is presumed, that col.table contains 200 colors, and y.vector is in (-1,1) range. You can write your own expression to define the color for particular value, depending on your task. pch=16 - afair, it is a big solid square (may be wrong) colors in table should be as character hexadecimal strings of the form #rrggbb. Did you define the palette? Some cute color tables could be grabbed from here http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml Also, the GIMP (http://www.gimp.org) can generate palettes and even saves them in the text files, which can be very easily imported in R. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] something wrong with the R repository USA(WA) (fhcrc.org)
I have temporarily changed my working place and now checking for updates the R repository at the University of Washington, closest to me. It doesn't give updates. call update.packages(ask=FALSE) with repository USA(WA) didn't do anything, but call update.packages(ask=FALSE) with repository Austria has updated the lattice package. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] would like to see R plots on local X display
On 11/2/06, Vladimir Eremeev [EMAIL PROTECTED] wrote: Dear useRs, Sorry, if this is a FAQ. I just need the direction to dig. I am working on the linux box (its DNS name is raccoon, to be definite), Fedora Core 3. I connect with ssh to another linux box (Debian, dns name chena) and run R on it. When I call a plotting function from the R command line, it produces the file Rplots.ps, containing the required plot. I am running X on the raccoon. When I run R on the raccoon and call a plotting function, I see a window with plots inside. I would like to see similar window on the raccoon, as a result of call to plotting function when R runs on chena. Is it possible? I played a bit with setting the DISPLAY environment on chena, but without success. Depending on the settings, you usually need to give the -X flag to ssh, e.g: [EMAIL PROTECTED] ssh -X chena If that doesn't work, try -Y. If that doesn't work, look inside /etc/ssh/sshd_config on chena to see if X forwarding is disabled. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] something wrong with the R repository USA(WA) (fhcrc.org)
On 11/2/06, Vladimir Eremeev [EMAIL PROTECTED] wrote: I have temporarily changed my working place and now checking for updates the R repository at the University of Washington, closest to me. It doesn't give updates. call update.packages(ask=FALSE) with repository USA(WA) didn't do anything, but call update.packages(ask=FALSE) with repository Austria has updated the lattice package. Mirrorring is not instantaneous. Mirrors are usually updated sometime during the night local time. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ssh and X11 forwarding (would like to see R plots on local X display)
Deepayan Sarkar deepayan.sarkar at gmail.com writes: I am working on the linux box (its DNS name is raccoon, to be definite), Fedora Core 3. I connect with ssh to another linux box (Debian, dns name chena) and run R on it. When I call a plotting function from the R command line, it produces the file Rplots.ps, containing the required plot. Depending on the settings, you usually need to give the -X flag to ssh, e.g: user at racoon$ ssh -X chena If that doesn't work, try -Y. If that doesn't work, look inside /etc/ssh/sshd_config on chena to see if X forwarding is disabled. Deepayan Thanks for the direction! Everything is enabled, but still doesn't work. xeyes and xclock give errors (Error: Can't open display: localhost:10.0), R produces Rplots.ps I also have a windows box, and go to chena using PuTTY. I have cygwin with X server installed on it. If I enable X11 forwarding in PuTTY, start cygwin's X11 server on Windows and try to run xeyes or xclock, I see their windows on my local MS Windows desktop, R still produces Rplots.ps. Will try to catch sysadmins and fix the things with them (I don't have the root access to everything, unfortunately). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Compare linear regressios for significant differences of the slopes
Hi I haven't received any ideas yet - I just wanted to confirm if this is a simple question? Should I follow the idea of checking if slope +- stddev slope overlap? Thanks, Rainer Rainer M Krug wrote: Hi I have (8 measures * 96 groups) = 768 datasets for which I did linear regressions using lm(). Now I want to compare the slopes for each of the 8 measures in each of the 96 groups. As I understand , I can not use anova(lm1, ..., lm8) as the lm1 ... lm8 are based on different datasets. I also read in previous discussions in this list, that I can see if the slope +- stddev(slope) overlap, but this seems a long process for the huge number of comparisons. Therefore my question: is there a way to compare the slopes of lm() which are based on different datasets and what is the easiest way to do it for this large number of datasets? Thanks in advance for your help, Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] generic arrays in R
On Thu, 2 Nov 2006, Tamas K Papp wrote: Dear R users, Are there any generic arrays (arrays which can store arbitrary objects) in R? Something along the lines of Yes. Arrays are vectors with dim attributes, and lists are generic vectors. f - function(x) x^2 a - array(f,c(2,2)) The error message is f - function(x) x^2 a - array(f,c(2,2)) Error in as.vector(x, mode) : cannot coerce to vector but a - array(list(f),c(2,2)) a[[2,1]] will work. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.