Re: [R] defining color sequence in image()

2006-12-26 Thread talepanda
one solution is: img1-matrix(1:5) img2-matrix(2:5) col-1:5 # col-c(green,yellow,...) image(img1,col=col[sort(unique(img1))]) image(img2,col=col[sort(unique(img2))]) On 12/26/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: Dear All, How can I define a color sequence for each image value? I

Re: [R] extend summary.lm for hccm?

2006-12-26 Thread Achim Zeileis
On Sun, 24 Dec 2006, John Fox wrote: If I remember Freedman's recent paper correctly, he argues that sandwich variance estimator, though problematic in general, is not problematic in the case that White described -- an otherwise correctly specified linear model with heteroscedasticity

[R] HOW TO: vectorize an iterative process.

2006-12-26 Thread Geoffrey Zhu
SGkgRXZlcnlvbmUsDQogDQpJIGFtIHN0dWNrIHdpdGggYSBzaW1wbGUgcHJvYmxlbS4gU3Vw cG9zZSBJIGhhdmUgYSB2ZWN0b3IgeCwgYW5kIEkgd2FudCB0byBjYWxjdWxhdGUgeVtpXT14 W2krMV0teFtpXSwgaXQgaXMgdmVyeSBlYXN5LiBJIGp1c3QgbmVlZCB0byB3cml0ZSB5PC14 WzI6bGVuZ3RoKHgpXS14WzE6bGVuZ3RoKHgpLTFdLiANCiANCk5vdyBpZiBJIGtub3cgeSwg

[R] writing to S-PLUS .dat file

2006-12-26 Thread Sebastian Michalski
Dear Users, I am new to R. I use write() to write my data in .txt format. I'd like to write to a disc any kind of data in a .dat S-PLUS format. Please help. SM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] sequential row selection in dataframe

2006-12-26 Thread Michael Kubovy
On Dec 26, 2006, at 12:07 AM, Pedro Mardones wrote: I'm wondering if there is any 'efficient' approach for selecting a sample of 'every nth rows' from a dataframe. For example, let's use the dataframe GAGurine in MASS library: length(GAGurine[,1]) [1] 314 # select an 75% of the dataset,

[R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
Hi Everyone, I am stuck with a simple problem. Suppose I have a vector x, and I want to calculate y[i]=3Dx[i+1]-x[i], it is very easy. I just need to write y-x[2:length(x)]-x[1:length(x)-1]. Now if I know y, and want to know the vector x defined by x[i]=3Dx[i-1]+y[i-1] for all i, how can I do

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Richard M. Heiberger
x[i]=3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? It looks like x - cumsum(y) What does 3D mean? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
Hi Richard, 3D is automatically generated by the mailing list software, probably because I had ] followed by =3D without a space in the original post. What I meant was to calculate x[i] =3D x[i-1] + y[i-1] For example, if X - 1:10 Then I want the vector Y to be 1, 3, 6, 10, 15, 21, 28, 36,

Re: [R] vectorizing an iterative process.

2006-12-26 Thread hadley wickham
x[i]=3Dx[i-1]+y[i-1] for all i, how can I do this without a loop? It looks like x - cumsum(y) What does 3D mean? The =3D is probably an encoding error - it should just be =. In general to vectorise an iterative problem, you will need to solve the recurrence relation

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
I meant x[i] - x[i-1] + y[i-1] and Y[i] - y[i-1] + x[i] below. The mailing list software just keep adding 3D's. Sorry. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey Zhu Sent: Tuesday, December 26, 2006 10:03 AM To: Richard M. Heiberger;

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Christos Hatzis
In your case, the recurrence relationship for x can be solved easily: Notice that sum{i=1,n}(x[i]-x[i-1]) = x[n] - x[0] and therefore x[n] = x[0] + sum{i=1,n}(y[i-1] for n=1, N, with the appropriate initial condition for i=0, (x[0],y[0]). Thus cumsum on y will give you a direct answer.

Re: [R] Problem to generate training data set and test data set

2006-12-26 Thread Charles C. Berry
What you describe is called stratified sampling. It was discusssed last month (and other times) on this list: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/90220.html Using RSiteSearch(stratified sampling) will produce many hits to relevant articles and packages. On Mon,

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Geoffrey Zhu
Yes, this solves my problem. Thanks for your help. -Original Message- From: Christos Hatzis [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 26, 2006 10:58 AM To: Geoffrey Zhu; r-help@stat.math.ethz.ch Subject: RE: [R] vectorizing an iterative process. In your case, the recurrence

[R] Rating competitors

2006-12-26 Thread Jeff Newmiller
I am looking for hints on how to estimate ratings for competitors in an ongoing pairwise competition using R... my particular area of interest being the game of Go, but the idea of identifying ratings (on a continuous scale) rather than relative rankings seems easily generalized to other

Re: [R] vectorizing an iterative process.

2006-12-26 Thread Peter Dalgaard
Geoffrey Zhu wrote: I meant x[i] - x[i-1] + y[i-1] and Y[i] - y[i-1] + x[i] below. The mailing list software just keep adding 3D's. Sorry. Rather, I suspect that *your* mailer is sending in Quoted-Printable, without setting the appropriate headers. Take a look at

Re: [R] Rating competitors

2006-12-26 Thread Spencer Graves
Have you considered Bradley-Terry models? RSiteSearch(bradley, functions) just returned 31 hits for me. Hope this helps. Spencer Graves Jeff Newmiller wrote: I am looking for hints on how to estimate ratings for competitors in an ongoing pairwise competition using R...

Re: [R] Rating competitors

2006-12-26 Thread Charles C. Berry
There is a substantial literature on 'statistics in sports' and pairwise comparisons are of obvious interest. Here is a starting point: http://www.amstat.org/sections/sis/ You might browse the newsletters posted there. You might enjoy: Bridging Different Eras in Sports by Scott M.

[R] slightly inconsistent behavior

2006-12-26 Thread ivo welch
dear R experts: This is just a minor, minor nuisance, but I thought I would point it out: dataset - read.table(file=pipe(cmdline), header =T, + na.strings=c(NaN, C,I,M, E), sep=,, as.is=T, nrows=); Error: cannot allocate vector of size 781249 Kb If I extend nrows by a

Re: [R] Rating competitors

2006-12-26 Thread Michael Kubovy
I would start with elimination-by-aspects models: ?eba I would read the Tversky 1972 paper (cited on the help page for the eba() function), which is brilliant. Jeff Newmiller wrote: I am looking for hints on how to estimate ratings for competitors in an ongoing pairwise competition using

Re: [R] Rating competitors

2006-12-26 Thread Greg Snow
One approach that is already coded in R is the Bradley-Terry model (found in the BradleyTerry package of all places). This could be a good place to start if you want something quick, others have given you references if you want more detail and/or control. -- Gregory (Greg) L. Snow Ph.D.

[R] McNemar test in R SPSS

2006-12-26 Thread Bob Green
Hello, I am hoping someone can clarify why I might obtain a quite different value in R SPSS for a McNemar test I ran. Firstly, here is the R syntax output R OUTPUT mctest - as.table(matrix(c(128,29,331,430), + ncol =2, dimnames = list(group=c(preMHT,postMHT), + assault=c(yes,no

Re: [R] McNemar test in R SPSS

2006-12-26 Thread Peter Dalgaard
Bob Green wrote: Hello, I am hoping someone can clarify why I might obtain a quite different value in R SPSS for a McNemar test I ran. Firstly, here is the R syntax output R OUTPUT mctest - as.table(matrix(c(128,29,331,430), + ncol =2, dimnames = list(group=c(preMHT,postMHT), +

Re: [R] extend summary.lm for hccm?

2006-12-26 Thread Charles C. Berry
On Mon, 25 Dec 2006, Achim Zeileis wrote: On Sun, 24 Dec 2006, John Fox wrote: If I remember Freedman's recent paper correctly, he argues that sandwich variance estimator, though problematic in general, is not problematic in the case that White described -- an otherwise correctly specified

Re: [R] McNemar test in R SPSS

2006-12-26 Thread Bob Green
Peter, Thanks for your reply. To perform the analysis in R, I used the table format suggested in the book by Everitt Hothorn, whereas in SPSS the analysis was performed directly from the 2 variables, rather than using count data. There is still something I don't understand - I tried to

Re: [R] McNemar test in R SPSS

2006-12-26 Thread Peter Dalgaard
Bob Green wrote: Peter, Thanks for your reply. To perform the analysis in R, I used the table format suggested in the book by Everitt Hothorn, whereas in SPSS the analysis was performed directly from the 2 variables, rather than using count data. You still need the right table.

[R] xyplot line colors

2006-12-26 Thread Osman Al-Radi
Hello, I have a longitudinal data with about 30 subjects. I used xyplot() to plot the longitudinal data. One problem is that xyplot() recycles the color of auto.key so that every 7th subject has the same color (symbol if setps() was used). Is there a way so that every subject will have a unique

Re: [R] xyplot line colors

2006-12-26 Thread Gabor Grothendieck
Set the colors yourself using the par.settings= argument of xyplot or trellis.par.set. See ?xyplot and ?trellis.par.set for more info. If you follow the instructions on the last line of every post to r-help you will get more detailed answers. On 12/26/06, Osman Al-Radi [EMAIL PROTECTED] wrote:

Re: [R] Bayesian data mining

2006-12-26 Thread David Farrar
Frank, You might want to use a package that is associated with some textbook that can give you guidance and examples. A lot of people would do this with WinBUGS, which is usually run separately although it has some kind of R interface. I'm sure there are lots of nice texts about that

[R] plotting time series with zoo pckg

2006-12-26 Thread ahmad ajakh
Hi all, I am using the zoo package to plot time series. I have a problem with formatting the axes. my zoo object (z) looks like the following. c1 1992-01-10 21 1992-01-17 34 1992-01-24 33 1992-01-31 41 1992-02-07 39 1992-02-14

Re: [R] plotting time series with zoo pckg

2006-12-26 Thread Gabor Grothendieck
Try this: # test data library(zoo) z - structure(c(21, 34, 33, 41, 39, 38, 37, 28, 33, 40), index = structure(c(8044, 8051, 8058, 8065, 8072, 8079, 8086, 8093, 8100, 8107), class = Date), class = zoo) z # plot without X axis plot(z, xaxt = n) # unlabelled tick at each point axis(1,

Re: [R] plotting time series with zoo pckg

2006-12-26 Thread ahmad ajakh
Dear Gabor, Thank you for your quick reply. This solution works for my univariate zoo class time series. I first tried it for a timeseries with 4 columns of data, it did not plot the labels nor the ticks, I tried it on a one dim timeseries (one column zoo class data as the example in the

Re: [R] writing to S-PLUS .dat file

2006-12-26 Thread ahmad ajakh
Hi Sebastian try save(x,y, file = filename.txt, ascii = TRUE) where x, y are your R objects. You should read ?save good luck AA. - Original Message From: Sebastian Michalski [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, December 25, 2006 7:36:50 AM Subject: [R] writing to

[R] how to transform string to variable name in a fuction?

2006-12-26 Thread jingjiangyan
there is a data frame, like this: df aa bb 1 a 20.27802 2 b 22.10664 3 c 21.33470 4 a 22.32898 5 b 19.73760 6 c 20.38979 .(suppressed) what I want to do is to copy the data frame's rows into different data frames according to the levels of 'aa' column,

Re: [R] how to transform string to variable name in a fuction?

2006-12-26 Thread Wensui Liu
try ?assign On 12/26/06, jingjiangyan [EMAIL PROTECTED] wrote: there is a data frame, like this: df aa bb 1 a 20.27802 2 b 22.10664 3 c 21.33470 4 a 22.32898 5 b 19.73760 6 c 20.38979 .(suppressed) what I want to do is to copy the data frame's

Re: [R] plotting time series with zoo pckg

2006-12-26 Thread Gabor Grothendieck
Please read the last line of every message to r-help and follow that. On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote: Dear Gabor, Thank you for your quick reply. This solution works for my univariate zoo class time series. I first tried it for a timeseries with 4 columns of data, it did not

Re: [R] how to transform string to variable name in a fuction?

2006-12-26 Thread Gabor Grothendieck
In the following the components of ss are the data frames in question: ss - split(df, df$aa) On 12/26/06, jingjiangyan [EMAIL PROTECTED] wrote: there is a data frame, like this: df aa bb 1 a 20.27802 2 b 22.10664 3 c 21.33470 4 a 22.32898 5 b 19.73760 6

Re: [R] McNemar test in R SPSS

2006-12-26 Thread Bob Green
Peter, I now see the original E H table was based on matched pairs not the raw counts. I now understand this much better and have the syntax generates results that correspond with your results (and SPSS), Thanks again, Bob __

Re: [R] Rating competitors

2006-12-26 Thread Jeff Newmiller
Spencer Graves wrote: Have you considered Bradley-Terry models? RSiteSearch(bradley, functions) just returned 31 hits for me. Hope this helps. Spencer Graves Thanks to everyone who responded... this was very helpful. I have a bit of reading and investigation to do. I think