[R] compute ROC curve?

2007-08-09 Thread gallon li
Hello, i have continuous test results for dieased and nondiseased subjects, say X and Y. Both are vectors of numbers. is there any R function which can generate the step function of ROC curve automatically? Thanks! [[alternative HTML version deleted]]

[R] test for contingency table when there are many zeros

2007-08-08 Thread gallon li
Here is my table tt A B 1 297 398 2 470 376 3 30 23 4 3 3 5 0 0 b/c two cells are zero, I can't use chisq.test() in R which gives the following output; chisq.test(tt) Pearson's Chi-squared test data: tt X-squared = NaN, df = 4, p-value = NA Warning message:

[R] change default alphabetic order for bwplot

2007-07-13 Thread gallon li
when producing boxplot from bwplot, I have five groups: Nitrogen, Duration, Pressure, A, Z. I wish the graphical display is according to the original order. But the R-function bwplot seems to automatically adjust the groups according to the alphabetic oder and thus creat a graph for A, Duration,

[R] comparing two vectors

2007-06-10 Thread gallon li
Suppose I have a vector A=c(1,2,3) now I want to compare each element of A to another vector L=c(0.5, 1.2) and then recode values for sum(A0.5) and sum(A1.2) to get a result of (3,2) how can I get this without writing a loop of sums? [[alternative HTML version deleted]]

[R] find position

2007-06-10 Thread gallon li
find the position of the first value who equals certain number in a vector: Say a=c(0,0,0,0,0.2, 0.2, 0.4,0.4,0.5) i wish to return the index value in a for which the value in the vector is equal to 0.4 for the first time. in this case, it is 7. [[alternative HTML version deleted]]

[R] how to install a package in R on a linux machine?

2007-02-22 Thread gallon li
I downloaded the tar.gz file from r-project website (and saved it in a local directory) and wish to use the package in R. But I am not sure how to use the install.packages command. I tried a few times and still couldn't figure out the correct way to install this package. [[alternative

[R] how to handle a longitudinal data

2007-01-27 Thread gallon li
i have a data set with repeated measures on same people, structure like below: id x1 x2 ... 001 10 20 ... 001 8 45 ... 001 4 2 ... 002 002 ... 002 002 003 ... what is the easist way to show how many observations for each subject id? [[alternative HTML version

[R] Fwd: how to handle a longitudinal data

2007-01-27 Thread gallon li
[EMAIL PROTECTED] wrote: gallon li wrote: i have a data set with repeated measures on same people, structure like below: id x1 x2 ... 001 10 20 ... 001 8 45 ... 001 4 2 ... 002 002 ... 002 002 003 ... what is the easist way to show how many

[R] unequal number of observations for longitudinal data

2007-01-27 Thread gallon li
i have a large longitudinal data set. The number of observations for each subject is not the same across the sample. The largest number of a subject is 5 and the smallest number is 1. now i want to make each subject to have the same number of observations by filling zero, e.g., my original sample

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread gallon li
Two questions: 1. How do I replace NA with 0? 2. How can I sort the observations by their id instead of by time? (actually i can see what you produced is automatically sorted by id; but in my case, the output data is sorted by time) On 1/27/07, Chuck Cleland [EMAIL PROTECTED] wrote: gallon li

Re: [R] unequal number of observations for longitudinal data

2007-01-27 Thread gallon li
what if i want to order within each id by their time? is there such an option? (right now some observation at time 100 were placed before 50 b/c R treated 1 first) On 1/27/07, Chuck Cleland [EMAIL PROTECTED] wrote: gallon li wrote: Two questions: 1. How do I replace NA with 0? df.long2

[R] Matrix question: obtaining the square root of a positive definite matrix?

2007-01-23 Thread gallon li
I want to compute B=A^{1/2} such that B*B=A. For example a=matrix(c(1,.2,.2,.2,1,.2,.2,.2,1),ncol=3) so a [,1] [,2] [,3] [1,] 1.0 0.2 0.2 [2,] 0.2 1.0 0.2 [3,] 0.2 0.2 1.0 a%*%a [,1] [,2] [,3] [1,] 1.08 0.44 0.44 [2,] 0.44 1.08 0.44 [3,] 0.44 0.44 1.08 b=a%*%a i have

[R] plot axises on both sides of a graph

2006-09-06 Thread gallon li
Usually the y-axis is shown on the left-hand-side of a graph, is it possible to artifically creat one more y-axis on the right-hand-side in R? What is the main reference? Thank you in advance. [[alternative HTML version deleted]] __

[R] histogram in the background?

2006-09-06 Thread gallon li
I intend to draw a plot of y against x. In the background of this graph I wish to creat a histogram of the horizontal variable x. Does any expert know how to produce such a plot? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch

[R] Fwd: plot axises on both sides of a graph

2006-09-06 Thread gallon li
-- Forwarded message -- From: gallon li [EMAIL PROTECTED] Date: Sep 6, 2006 7:48 PM Subject: Re: [R] plot axises on both sides of a graph To: Jim Lemon [EMAIL PROTECTED] Both of your suggestions are so helpful. By combining what you told me, now I am able to produce a second y