Re: [R] change fitted line colour in lme() trellis plot?

2006-01-20 Thread Bill Simpson
On Thu, 2006-01-19 at 16:21 -0600, Deepayan Sarkar wrote: On 1/19/06, Deepayan Sarkar [EMAIL PROTECTED] wrote: On 1/19/06, Bill Simpson [EMAIL PROTECTED] wrote: If I used a groupedData object, if I do fit-lme(blah) then plot(augPred(fit)) produces a nice trellis plot of the data

[R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Bill Simpson
If I used a groupedData object, if I do fit-lme(blah) then plot(augPred(fit)) produces a nice trellis plot of the data along with the fitted lines However I find that the lines and the data points are in the same colour (light blue against a medium grey background). Is there a way to make the

[R] lme model specification

2006-01-17 Thread Bill Simpson
=???|subject???, data=df1) I am familiar with the steps of model building using lm(), exploring different models etc, so I think I will be OK once I get the idea of specifying the basic lme model. I have Pinheiro and Bates (2000) here. Thanks very much for any help Bill Simpson

[R] ugly loop

2005-04-22 Thread Bill Simpson
The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! Bill

Re: [R] ugly loop

2005-04-22 Thread Bill Simpson
To clarify: I want to get rid of the loop over i,j Here is a simpler example. ver is a 2D matrix count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-ver[i,j] } Bill __ R-help@stat.math.ethz.ch mailing list

Re: [R] ugly loop

2005-04-22 Thread Bill Simpson
Thanks Marc for your help. The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better.

Re: [R] ugly loop

2005-04-22 Thread Bill Simpson
On Fri, 22 Apr 2005, Marc Schwartz wrote: Thus, I just need to use t(ver) instead of ver: x - pt$x[t(ver)] y - pt$y[t(ver)] z - pt$z[t(ver)] That should do it? Yep!! Thanks very much Marc and others who suggested this. Cheers Bill __

RE: [R] flatten a matrix and unflatten it

2005-03-22 Thread Bill Simpson
Sorry -- I meant to say dataframe instead of matrix. Anyway I see that my troubles are gone when I scan the data in as a vector then convert to matrix. (I had troubles doing such manipulations when I read in the data using read.table) x-scan(/home/wsimpson/papers/face/max.dat) xx-matrix(x,

[R] flatten a matrix and unflatten it

2005-03-21 Thread Bill Simpson
I want to flatten a matrix and unflatten it again. Please tell me how to do it. 1. given a matrix: x1 y1 z1 x2 y2 z2 ... xk yk zk convert it to a vector: x1, y1, z1, x2, y2, z2, ..., xk, yk, zk 2. given a vector: x1, y1, z1, x2, y2, z2, ..., xk, yk, zk convert it to a matrix x1 y1 z1 x2 y2 z2

[R] How to read in .jpeg files

2005-02-04 Thread Bill Simpson
In case others are looking for a simple way to read in .jpeg files as ordinary matrices, here is my solution. I am only interested in greyscale images, so you will have to alter the following if you want colour. Most .jpegs are colour, so first step is to open the file with ImageMagick display

Re: [R] How to read in .jpeg files

2005-02-04 Thread Bill Simpson
for(i in 1:dims[1]) x[i,]-rev(x[i,]) #flip the image vertically Courtesy of Rolf Turner, here is a much better way to flip vertically: x - x[,ncol(x):1] Bill __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] principal components question

2004-09-29 Thread Bill Simpson
appropriate for what I am doing. Any pointers on how to do that in R or to any info are appreciated. Bill Simpson __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting

[R] prcomp eigenvectors

2004-06-22 Thread Bill Simpson
help Bill Simpson __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Contour plots

2003-12-09 Thread Bill Simpson
I am drawing several contour plots in one page. I use image, and get several contours. But I don't know how to control the color in more than one plots. For example, same color corresponds to different dependent values in different plots. For example, yellow means z=100(the highest value) in

[R] model formula

2003-11-18 Thread Bill Simpson
appears to be: if z==1, y~x+z; else y~z (y~z + z:x isn't it) How can I express this model in lm()? If I can't express it properly in lm(), what is the best way to fit the model? Thanks for any help. Bill Simpson __ [EMAIL PROTECTED] mailing list https

Re: [R] model formula

2003-11-18 Thread Bill Simpson
Thanks very much John Peter for your help. Bill __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

[R] average of y at each level of x?

2003-11-07 Thread Bill Simpson
I would like to compute p = count1/(count0 +count1). For example, for x=0.012289, p= 12/(1+12)= 0.923077. Please tell me how to do it. Maybe there is a better way to do this without going through table(). Thanks very much for any help. Bill Simpson

Re: [R] average of y at each level of x?

2003-11-07 Thread Bill Simpson
one way that works is: sapply(split(y,x), mean) Bill __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help