[R] problem loading package Hmisc

2006-11-25 Thread Ritwik Sinha
Hi,

I installed the package Hmisc with the command
install.packages(Hmisc) without errors. When I try to load the
library with command library(Hmisc) I get the error

 library(Hmisc)
Error in library(Hmisc) : there is no package called 'Hmisc'


 version
   _
platform   i386-pc-linux-gnu
arch   i386
os linux-gnu
system i386, linux-gnu
status
major  2
minor  4.0
year   2006
month  10
day03
svn rev39566
language   R
version.string R version 2.4.0 (2006-10-03)


Any help is appreciated. Unfortunately the RSiteSearch is not working
now, so the question may not be well researched.

Thanks
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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 loading package Hmisc

2006-11-25 Thread Ritwik Sinha
Sorry about the question. I had installed the package locally and
hence the library command was not working as stated. library(Hmisc,
lib.loc=~/R/) did the trick.



On 11/25/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
 Hi,

 I installed the package Hmisc with the command
 install.packages(Hmisc) without errors. When I try to load the
 library with command library(Hmisc) I get the error

  library(Hmisc)
 Error in library(Hmisc) : there is no package called 'Hmisc'


  version
_
 platform   i386-pc-linux-gnu
 arch   i386
 os linux-gnu
 system i386, linux-gnu
 status
 major  2
 minor  4.0
 year   2006
 month  10
 day03
 svn rev39566
 language   R
 version.string R version 2.4.0 (2006-10-03)


 Any help is appreciated. Unfortunately the RSiteSearch is not working
 now, so the question may not be well researched.

 Thanks
 Ritwik Sinha
 Graduate Student
 Epidemiology and Biostatistics
 Case Western Reserve University
 [EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Problems with plot and X11 in ubuntu

2006-11-11 Thread Ritwik Sinha
Hi Everyone,

Thanks for the question and the answer. It helped me solve the problem
which I too faced.

Ritwik.

On 11/11/06, Oscar [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Take a look at this link:

 http://www.ubuntuforums.org/showthread.php?t=268024

 HTH

 Oscar

 On Nov 11, 2006, at 04:19, Bagatti Davide wrote:

  About Ubuntu, it's a new installation (ubuntu 6.10, code name Edgy
  Eft). About R, it's a new installation.
 
  Thank you very much
 
 
  2006/11/10, [EMAIL PROTECTED] [EMAIL PROTECTED]:
  A few questions before I may help.
 
  Is this a NEW installation or an upgrade?
  If an upgrade, what version are you upgrading from?
 
  Regards,
 
  Oscar
 
  From: Bagatti Davide [EMAIL PROTECTED]
  Date: 2006/11/10 Fri AM 09:22:24 CST
  To: r-help@stat.math.ethz.ch
  Subject: [R] Problems with plot and X11 in ubuntu
 
  Hello,
  
  I am an italian student, who is trying to use R 2.3.1 with Ubuntu
  6.10 (last
  version). When I try to use the plot command, I get the error:
  
  could not find any X11 fonts Check that the Font Path is correct
  
  How can I solve this problem?
  
  Thank you very much
  
  Davide
  
 [[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.



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Multivariate regression

2006-10-27 Thread Ritwik Sinha
You can use gee (
http://finzi.psych.upenn.edu/R/library/geepack/html/00Index.html) or maybe
the function gls in nlme.

Ritwik.

On 10/27/06, Ravi Varadhan [EMAIL PROTECTED] wrote:

 Hi,



 Suppose I have a multivariate response Y (n x k) obtained at a set of
 predictors X (n x p).  I would like to perform a linear regression taking
 into consideration the covariance structure of Y within each unit - this
 would be represented by a specified matrix V (k x k), assumed to be the
 same
 across units.  How do I use lm to do this?



 One approach that I was thinking of is as follows:



 Flatten Y to a vector, say, Yvec (n*k x 1).  Create Xvec (n*k, p*k) such
 that it is made up of block matrices Bij (k x k), where Bij is a diagonal
 matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p).  Now I can use
 lm in a univariate mode to regress Yvec against Xvec, with covariance
 matrix Vvec (n*k x n*k).  Vvec is a block-diagonal matrix with blocks of V
 along the diagonal.  This seems like a valid approach, but I still don't
 know how to specify the covariance structure to do weighted least squares.



 Any help is appreciated.



 Best,

 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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

[[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] Replacing for loop with apply type function.

2006-10-23 Thread Ritwik Sinha
Hi Everyone,

I want to replace the following for loop with an apply type function
to (possibly) speed up the process.

# The for loop I want to replace

x - numeric(10)
for(i in 2:10)
x[i] - x[i-1]+1

x

To give you some more background, I am running a Metropolis Hastings
MCMC chain with k parameters. So, if x represents the sample from
the chain, the ith row (representing the ith iteration) depends on the
(i-1)th row.

Thanks in advance,
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] lattice: adding text to plots

2006-10-09 Thread Ritwik Sinha

Hi Gabor,

Thanks for your reply. The solution you gave me and the one that I had
attempted have the same problem. The plots don't differentiate between
y1 and y2, in other words, they loose the groups attribute. This is
what 'does not work' means. I am attaching a ps file (I hope that does
not get stripped). In each panel there should be two lines, but this
has just one (group lost).

This plot was produced with R 2.4 on windows and lattice 0.14-9.

Thanks and regards,
Ritwik.

On 10/9/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:

Could you explain what does not work means.  It seems to produce a
graph with x-y numbers on it in R 2.4.0 on Windows.

At any rate, I would have done it like this although I think you can
leave off the [1] on subscripts and it will still work.

library(lattice)
library(grid)
xyplot(y1 + y2 ~ x | g * h, data = DF, type = l,
   panel = function(x, y, subscripts, groups, ...) {
  panel.xyplot(x, y, ...)
  grid.text(DF$f[subscripts[1]], .1, .9)
})


On 10/9/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
 Hi Everyone,

 I know there was a thread recently that dealt with a similar issue,
 but this one is a little different.

 I have the following data frame

 DF - data.frame(x = 1:12, y1 = rnorm(12), y2 = rnorm(12), g =
 gl(2,6), h = rep(c(1, 2), 6), f = c(rep(c(1-1,1-2),3),
 rep(c(2-1,2-2),3)))

 I essentially want this plot

 xyplot(y1+y2~x|g*h, data=DF, type=l)

 However, now I want to add a different text to each panel, the text
 being from column f of the data frame. In other words, I want text
 1-1 in the panel where g=1 and h=1 and so on. I tried to pass groups
 and subscript to the panel function but could not get what I was
 looking for. The following attempt does not work.

 xyplot(y1+y2~x|g*h, data=DF, type=l, auto.key=TRUE,
panel=function(x,y,..., groups, subscripts){panel.xyplot(x,y,...);
panel.text(x=4,y=0, labels=DF$f[subscripts])})

 My R version is 2.2.1 and lattice version is  0.12-11 (sorry they are
 not the latest ones, these are on the server).

 --
 Ritwik Sinha
 Graduate Student
 Epidemiology and Biostatistics
 Case Western Reserve University
 [EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

 __
 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.





--
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha


Rplots.ps
Description: PostScript document
__
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] lattice: adding text to plots

2006-10-09 Thread Ritwik Sinha
On 10/9/06, Deepayan Sarkar [EMAIL PROTECTED] wrote:
 Just out of curiosity, what's wrong with

 xyplot(y1 + y2 ~ x | interaction(g, h, sep = -), data = DF, type =
 l, auto.key = TRUE)

The reason would be that I want to add information to the plot that is
not of the form i-j. My example happens to be an over
simplification.

 ? Not having to do the other sort of callisthenics is the whole point
 of having strips.

 I should point out a subtle effect here (even hinted at in the
 documentation, miraculously), which can be seen with

  xyplot(y1 + y2 ~ x | g * h, data=DF,
 + panel = function(x, y, ..., subscripts) print(subscripts) )
 [1]  1  3  5 13 15 17
 [1]  7  9 11 19 21 23
 [1]  2  4  6 14 16 18
 [1]  8 10 12 20 22 24

 Note that the last three values of 'subscripts' in each panel is 12 +
 i, where i is the true subscript (DF has only 12 rows). This is a
 consequence of the fact that DF is internally 'reshape()'d. Gabor's
 solution avoids this by using subscripts[1] in each panel (and also
 because 'x' and 'y' are not recycled to be as long as the labels in
 grid.text), but it's something to be generally aware of.

Thanks for the clarification. I had realized that the internal reshape
makes this change.


 -Deepayan

 
  Thanks and regards,
  Ritwik.
 
  On 10/9/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
   Could you explain what does not work means.  It seems to produce a
   graph with x-y numbers on it in R 2.4.0 on Windows.
  
   At any rate, I would have done it like this although I think you can
   leave off the [1] on subscripts and it will still work.
  
   library(lattice)
   library(grid)
   xyplot(y1 + y2 ~ x | g * h, data = DF, type = l,
  panel = function(x, y, subscripts, groups, ...) {
 panel.xyplot(x, y, ...)
 grid.text(DF$f[subscripts[1]], .1, .9)
   })
  
  
   On 10/9/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
Hi Everyone,
   
I know there was a thread recently that dealt with a similar issue,
but this one is a little different.
   
I have the following data frame
   
DF - data.frame(x = 1:12, y1 = rnorm(12), y2 = rnorm(12), g =
gl(2,6), h = rep(c(1, 2), 6), f = c(rep(c(1-1,1-2),3),
rep(c(2-1,2-2),3)))
   
I essentially want this plot
   
xyplot(y1+y2~x|g*h, data=DF, type=l)
   
However, now I want to add a different text to each panel, the text
being from column f of the data frame. In other words, I want text
1-1 in the panel where g=1 and h=1 and so on. I tried to pass groups
and subscript to the panel function but could not get what I was
looking for. The following attempt does not work.
   
xyplot(y1+y2~x|g*h, data=DF, type=l, auto.key=TRUE,
   panel=function(x,y,..., groups, 
subscripts){panel.xyplot(x,y,...);
   panel.text(x=4,y=0, labels=DF$f[subscripts])})
   
My R version is 2.2.1 and lattice version is  0.12-11 (sorry they are
not the latest ones, these are on the server).



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] lattice: adding text to plots

2006-10-08 Thread Ritwik Sinha
Hi Everyone,

I know there was a thread recently that dealt with a similar issue,
but this one is a little different.

I have the following data frame

DF - data.frame(x = 1:12, y1 = rnorm(12), y2 = rnorm(12), g =
gl(2,6), h = rep(c(1, 2), 6), f = c(rep(c(1-1,1-2),3),
rep(c(2-1,2-2),3)))

I essentially want this plot

xyplot(y1+y2~x|g*h, data=DF, type=l)

However, now I want to add a different text to each panel, the text
being from column f of the data frame. In other words, I want text
1-1 in the panel where g=1 and h=1 and so on. I tried to pass groups
and subscript to the panel function but could not get what I was
looking for. The following attempt does not work.

xyplot(y1+y2~x|g*h, data=DF, type=l, auto.key=TRUE,
panel=function(x,y,..., groups, subscripts){panel.xyplot(x,y,...);
panel.text(x=4,y=0, labels=DF$f[subscripts])})

My R version is 2.2.1 and lattice version is  0.12-11 (sorry they are
not the latest ones, these are on the server).

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Plotting text with lattice

2006-10-05 Thread Ritwik Sinha
Hi,

On a related note, if I wanted to add different texts to different
panels, should I stick to using trellis.focus() for each text in each
panel? I cannot figure out a way to do it using a panel function.

Ritwik.

On 9/29/06, Deepayan Sarkar [EMAIL PROTECTED] wrote:
 On 9/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  Here are two possibilities.  The first use trellis.focus/trellis/unfocus to
  add text subsequent to drawing the xyplot and the second uses a
  custom panel:
 
  xyplot(x ~ x, data = data.frame(x = 1:10))
  trellis.focus(panel, 1, 1)
  panel.text(x=2, y=4, labels=Text)
  trellis.unfocus()
 
  xyplot(x ~ x, data = data.frame(x = 1:10), panel = function(...) {
  panel.xyplot(...)
  panel.text(x=2, y=4, labels=Text)
  })

 Right, on a more general note, this is necessary because it is not clear what

 ltext(x=2, y=4, labels=Text)

 should do for a multi-panel plot. On an even more general note, you
 will keep getting in trouble when using lattice if you (1) try to
 follow the incremental addition approach of standard graphics or (2)
 use the par() system in any way.

 Deepayan

  On 9/29/06, McGehee, Robert [EMAIL PROTECTED] wrote:
   Hello,
   I've decided to take the leap and try my hand at the lattice package,
   though I am getting stuck at what one might consider a trivial problem,
   plotting text at a point in a graph. Apologies in advance if (that) I'm
   missing something extremely basic.
  
   Consider in base graphics:
plot(1:10)
text(2, 4, Text)
   In the above you will see text centered at the point (2, 4) on the
   graph.
  
   Now I would like to try to do the same thing using the lattice package:
  
xyplot(x ~ x, data = data.frame(x = 1:10))
ltext(x=2, y=4, labels=Text)
panel.text(x=2, y=4, labels=Text)
grid.text(label=Text, x=2, y=4)
grid.text(label=Text, x=unit(2, native), y=unit(4, native))
  
   None of the above four commands puts the Text at the (2, 4) point on
   the graph. Any help with this would be appreciated! Also, if I have more
   than one panel and would like to place text at different points on
   different panels how would I do this?
  
   Also, note that I'm hoping to use text to label interesting points in a
   levelplot, but am using the above xyplot as an example.
  
   Thanks,
   Robert
  
  
   Robert McGehee
   Quantitative Analyst
   Geode Capital Management, LLC
   53 State Street, 5th Floor | Boston, MA | 02109
   Tel: 617/392-8396Fax:617/476-6389
   mailto:[EMAIL PROTECTED]
  
  
  
   This e-mail, and any attachments hereto, are intended for us...{{dropped}}
  
   __
   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.
 


 --
 http://www.stat.wisc.edu/~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.



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Plotting text with lattice

2006-10-05 Thread Ritwik Sinha
Thanks Gabor,

I realized I could also use this code

xyplot(x ~ x | g, data = data.frame(x = 1:12, g = gl(3,4)), groups=g,
panel = function(..., groups, subscripts) {
  panel.xyplot(...)
  panel.text(x=2, y=4, labels=groups[subscripts])
})

Which is essentially a rewrite of one of the examples of xyplot.
Ritwik.

On 10/5/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 I seem to have omitted g

 library(lattice)
 xyplot(x ~ x | g, data = data.frame(x = 1:12, g = gl(3,4)), panel =
 function(...) {
panel.xyplot(...)
panel.text(x=2, y=4, labels=which.packet())
 })


 On 10/5/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  This requires R 2.4.0.  Its the same as my earlier example except
  the labels= arg has been changed to labels=which.packet().
 
 
  xyplot(x ~ x | g, data = data.frame(x = 1:12), panel = function(...) {
panel.xyplot(...)
panel.text(x=2, y=4, labels=which.packet())
 
  })
 
 
  On 10/5/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
   Hi,
  
   On a related note, if I wanted to add different texts to different
   panels, should I stick to using trellis.focus() for each text in each
   panel? I cannot figure out a way to do it using a panel function.
  
   Ritwik.
  
   On 9/29/06, Deepayan Sarkar [EMAIL PROTECTED] wrote:
On 9/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Here are two possibilities.  The first use 
 trellis.focus/trellis/unfocus to
 add text subsequent to drawing the xyplot and the second uses a
 custom panel:

 xyplot(x ~ x, data = data.frame(x = 1:10))
 trellis.focus(panel, 1, 1)
 panel.text(x=2, y=4, labels=Text)
 trellis.unfocus()

 xyplot(x ~ x, data = data.frame(x = 1:10), panel = function(...) {
 panel.xyplot(...)
 panel.text(x=2, y=4, labels=Text)
 })
   
Right, on a more general note, this is necessary because it is not 
clear what
   
ltext(x=2, y=4, labels=Text)
   
should do for a multi-panel plot. On an even more general note, you
will keep getting in trouble when using lattice if you (1) try to
follow the incremental addition approach of standard graphics or (2)
use the par() system in any way.
   
Deepayan
   
 On 9/29/06, McGehee, Robert [EMAIL PROTECTED] wrote:
  Hello,
  I've decided to take the leap and try my hand at the lattice 
  package,
  though I am getting stuck at what one might consider a trivial 
  problem,
  plotting text at a point in a graph. Apologies in advance if (that) 
  I'm
  missing something extremely basic.
 
  Consider in base graphics:
   plot(1:10)
   text(2, 4, Text)
  In the above you will see text centered at the point (2, 4) on the
  graph.
 
  Now I would like to try to do the same thing using the lattice 
  package:
 
   xyplot(x ~ x, data = data.frame(x = 1:10))
   ltext(x=2, y=4, labels=Text)
   panel.text(x=2, y=4, labels=Text)
   grid.text(label=Text, x=2, y=4)
   grid.text(label=Text, x=unit(2, native), y=unit(4, native))
 
  None of the above four commands puts the Text at the (2, 4) point 
  on
  the graph. Any help with this would be appreciated! Also, if I have 
  more
  than one panel and would like to place text at different points on
  different panels how would I do this?
 
  Also, note that I'm hoping to use text to label interesting points 
  in a
  levelplot, but am using the above xyplot as an example.
 
  Thanks,
  Robert
 
 
  Robert McGehee
  Quantitative Analyst
  Geode Capital Management, LLC
  53 State Street, 5th Floor | Boston, MA | 02109
  Tel: 617/392-8396Fax:617/476-6389
  mailto:[EMAIL PROTECTED]
 
 
 
  This e-mail, and any attachments hereto, are intended for 
  us...{{dropped}}
 
  __
  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.

   
   
--
http://www.stat.wisc.edu/~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.
   
  
  
   --
   Ritwik Sinha
   Graduate Student
   Epidemiology and Biostatistics

Re: [R] only need the p-value

2006-09-30 Thread Ritwik Sinha
This is how you go about doing this.

summary(results)$coefficients[1,5]

You will have to check this for you code. But the idea is that
summary(results) is a list (?) and one of its components is called
coefficients, which is a matrix. So the problem is just to extract
one element of this matrix.

I am not well versed with coxph so there may be some minor details I
am missing, but that is the general idea (same as with lm, glm etc.).

Ritwik.

On 9/30/06, Boks, M.P.M. [EMAIL PROTECTED] wrote:


 Dear R users,



 I am calculating several cox proportional hazard models after each other (I 
 know this is unusual, but I am just exploring the data). For the purpose of 
 multiple testing correction I need to construct an array of these p-values. 
 However since the output is not an array in itself, I cannot find a way to 
 obtain the p-value only.



  attach(tms)

 

  goal-rep(0.7*FREQUENC[1:13],6)

  event- Surv(TIJD,FREQUENCgoal)

  results-coxph(event~ TYPETREA)

  summary(results)



 Call:

 coxph(formula = event ~ TYPETREA)



   n=76 (2 observations deleted due to missing)

  coef exp(coef) se(coef) z p

 TYPETREAnon-guided -0.826 0.4380.484 -1.71 0.088



exp(coef) exp(-coef) lower .95 upper .95

 TYPETREAnon-guided 0.438   2.28 0.169  1.13



 Rsquare= 0.041   (max possible= 0.829 )

 Likelihood ratio test= 3.2  on 1 df,   p=0.0737

 Wald test= 2.91  on 1 df,   p=0.088

 Score (logrank) test = 3.08  on 1 df,   p=0.0794



 Does anyone now how to extract the p-value?

 Many thanks!,

 Marco

 __
 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.



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Print/Save/Cat/Write list

2006-09-30 Thread Ritwik Sinha
Hi,

I would like to write a list to an ascii file.
I tried the following

y - list(a = 1, b = c(TRUE,FALSE), c = oops)
save(y, file=y.data, ascii=TRUE)
# Not satisfactory

print does not have a file= option
cat cannot handle lists.
write does not handle lists
write.table converts it to a d.f

Perhaps I could loop through the elements of a list and keep appending
its elements to a file, but that will have a problem if any of the
elements of the list is a list. I suppose there must be a simple
function that does what I need. Sorry if I have missed anything
obvious, my searches did not return anything useful.

Thanks and regards,
Ritwik.

Here is my version

platform i686-redhat-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
language R

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Print/Save/Cat/Write list

2006-09-30 Thread Ritwik Sinha
thanks.

Ritwik.

On 9/30/06, jim holtman [EMAIL PROTECTED] wrote:
 try:

 sink(y.data)
 y
 sink()

 On 9/30/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
  Hi,
 
  I would like to write a list to an ascii file.
  I tried the following
 
  y - list(a = 1, b = c(TRUE,FALSE), c = oops)
  save(y, file=y.data, ascii=TRUE)
  # Not satisfactory
 
  print does not have a file= option
  cat cannot handle lists.
  write does not handle lists
  write.table converts it to a d.f
 
  Perhaps I could loop through the elements of a list and keep appending
  its elements to a file, but that will have a problem if any of the
  elements of the list is a list. I suppose there must be a simple
  function that does what I need. Sorry if I have missed anything
  obvious, my searches did not return anything useful.
 
  Thanks and regards,
  Ritwik.
 
  Here is my version
 
  platform i686-redhat-linux-gnu
  arch i686
  os   linux-gnu
  system   i686, linux-gnu
  status
  major2
  minor2.1
  year 2005
  month12
  day  20
  svn rev  36812
  language R
 
  --
  Ritwik Sinha
  Graduate Student
  Epidemiology and Biostatistics
  Case Western Reserve University
  [EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha
 
  __
  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.
 


 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Heteroskedasticity test

2006-09-30 Thread Ritwik Sinha
you may also try to levene test. Once again i think it is for a known
change point.

http://finzi.psych.upenn.edu/R/library/car/html/levene.test.html

On 9/30/06, Achim Zeileis [EMAIL PROTECTED] wrote:
 On Fri, 29 Sep 2006, Alberto Monteiro wrote:

  Is there any heteroskedasticity test in the package? Something
  that would flag a sample like
 
   x - c(rnorm(1000), rnorm(1000, 0, 1.2))

 The package lmtest contains several tests for heteroskedasticity, in
 particular the Breusch-Pagan test (and also the Goldfeld-Quandt test for
 known change point). Furthermore, some of the structural change tests in
 strucchange can be used to test for non-constant variances, e.g, the
 Nyblom-Hansen test.
 Z

  Alberto Monteiro
 
  __
  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.



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] Histogram

2006-09-27 Thread Ritwik Sinha
Hi,

There may be an easier way but here is one way you can do it.

# create vector that has Y[i] X[i]s
new.data - rep(X,Y)

hist(new.data, breaks=c(0,.1,.4,.6)) # or something like that look at
what exactly breaks should be.

Ritwik.

On 9/27/06, Mohsen Jafarikia [EMAIL PROTECTED] wrote:
 Dear all,

 I want to design a histogram and I need to have the frequency at certain
 points. For example I have the following 2 columns:

 *X  Y*

 0.125
 0.422
 0.45  11
 0.55  21

 I want the chart to have 4 columns. First column is from 0.0-0.1 (on X) and
 frequency is 25. Next colum is wider and form 0.1-0.4 with 22 frequency.
 Next column is narrow with 11 frequency and the last column is the same as
 the first one with 21 frequency.

 Can anybody tell me how I can have this chart.

 Thanks,
 Mohsen

 [[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.



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
[EMAIL PROTECTED] | +12163682366 | http://darwin.cwru.edu/~rsinha

__
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] creation of new variables

2006-09-26 Thread Ritwik Sinha
Depends on what these variables are. Are these vectors?
if so a simple
a*b etc should work.
If they are columns of a data frame DF?
then DF$a*DF$b.

If these variables are part of a function then also a*b should work.

On 9/26/06, nalluri pratap [EMAIL PROTECTED] wrote:

 Hello All,

   I have 8 variables named

a b c d e f g h

   I need to create four variables from these 8 vraibles in R.

   the new variables are ab,cd,ef,gh.

   Can anyone pleas help me

   thanks,
   Pratap




 -


 [[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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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] Statitics Textbook - any recommendation?

2006-09-24 Thread Ritwik Sinha
How about this book by Julian Faraway.

http://www.stat.lsa.umich.edu/~faraway/book/

It covers only regression and anova, but I really like the book. It
gives a good overview of the important topics in linear regression and
anova. Also it is on the web and hence free.

Ritwik

On 9/22/06, Wolfgang Lindner [EMAIL PROTECTED] wrote:
 Iuri Gavronski schrieb:
  Other text I am trying to find is multivariate data analysis (EFA,
  cluster, mult regression, MANOVA, etc.) with examples with R.

 Hi Iuri,

 for your second answer I would recommend
 B. Everitt: An R and S-PLUS Companion to Multivariate Analysis. Springer 2005.
 isbn 1-85233-882-2.

 Best
   Wolfgang
 --
 privat:  Wolfgang Lindner, Stieglitzweg 6, D-42799 Leichlingen

 __
 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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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 delete some columns from a matrix based on some other indicator variable

2006-09-24 Thread Ritwik Sinha
Hi,

The problem might be mode of the vector r. Try this

D[,as.character(r)==1]

But I am not sure that is the problem. Sometimes factors tend to
complicate things. Look for factor in the R FAQ page.

Ritwik.

On 9/20/06, David Barron [EMAIL PROTECTED] wrote:
 You don't need a loop.  You could try

  r - c(0,0,1,1)
  matD - matrix(1:12,nrow=3)
  matD
  [,1] [,2] [,3] [,4]
 [1,]147   10
 [2,]258   11
 [3,]369   12

  matD[,r==1]
  matD[,r==1]
  [,1] [,2]
 [1,]7   10
 [2,]8   11
 [3,]9   12


 On 20/09/06, Ya-Hsiu Chuang [EMAIL PROTECTED] wrote:
  Hello,
 
  I am not very familiar with R and need help in deleting a few columns in a
  matrix.
 
  Suppose I have a indicator variable called r and it's defined as r = (0, 0,
  1, 1). A matrix D is a 3X4 matrix. If I want a new matrix which contains
  only the columns of D corresponding to the elements of r that equal to 1.
  how can i write a loop which creat a new matrix that contains only the last
  2 columns of D in this case? thanks
 
  __
  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.
 


 --
 =
 David Barron
 Said Business School
 University of Oxford
 Park End Street
 Oxford OX1 1HP

 __
 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.



-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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] About truncated distribution

2006-09-12 Thread Ritwik Sinha
However, if you know the point(s) of truncation then you should be able to
work your way back. Look for the mean and variance of a truncated normal, it
will involve mu, sigma and c (point of truncation). You will need to solve
for mu and sigma from two equation. For example look at the wikipedia page
on normal distribution, it has the mean of a truncated normal distribution.
Many standard statistics books should have the rest of the information.

On 9/12/06, Berton Gunter [EMAIL PROTECTED] wrote:

 
  But my question is a bit different. What I know is the mean
  and sd after truncation. If I assume the distribution is
  normal, how I am gonna develope the original distribution
  using this two parameters?

 You can't, as they are plainly not sufficient (you need to know the amount
 of truncation also). If you have only the mean and sd and neither the
 actual
 data nor the truncation point you're through.

 -- Bert Gunter
 Genentech


 Could anybody give me some advice?
  Thanks in advance!
 
  Jen
 
[[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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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] covariance matrix of predictions

2006-08-27 Thread Ritwik Sinha
Hi,

If I understand correctly the

Var(X \hat{\beta}) = X (X'X)^{-1}X' \sigma^2, where X will now be x.pred.

Which should be easily obtained by performing the matrix computation and
multiplying it with the estimate of the variance.

For more details about different aspects of the estimate and variance of the
predictor refer to page 39 of http://www.stat.lsa.umich.edu/~faraway/book/

Ritwik Sinha

On 8/23/06, Arnab mukherji [EMAIL PROTECTED] wrote:

 Hi !

 I am trying to get at the covariance of the predictions of a linear model.
 Suppose the we have:

  x-runif(1000)
  y-2 + 25x*x +rnorm(1000)
  lm1 -lm(y~x, data = data.frame(y  = y, x=x))
  x.pred -runif(10)
  y.hat - predict(lm1, newdata = data.frame(x=x.pred))

 I was wondering how to get an estimate of the covariance of y.hat which
 would be a 10 x 10 matrix telling be the uncertainty in each of the
 predictions.

 thanks

 Arnab

 __
 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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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] two density curves in one plot?

2006-08-27 Thread Ritwik Sinha
Hi Gabor and Dimitris,

I was wondering if this question was frequent enough to be in the R
FAQ under R Miscellanea and thought of something like this

Q. How do I plot two curves on the same graph?

A. Plot the first curve using the plot() command and add lines using
lines(). For example

d1 - density(rnorm(100))
d2 - density(rnorm(100))
plot(range(d1$x, d2$x), range(d1$y, d2$y), type = n, xlab = x,
ylab = Density)
lines(d1, col = red)
lines(d2, col = blue)

Alternatively one can use points() to add points to the plot.

If you think this question should be in the FAQ and if you have any
comments/changes to the QA then I can request the maintainer of the
FAQ to include it. We could also include a lattice solution but I was
thinking of not complicating things.

Ritwik Sinha

On 8/27/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Not sure who maintains the FAQ but its not me.


 On 8/27/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
  This seems to be a common question for new commers to R, does it make sense
  to add it to the R FAQ page? I checked it is not currently there.
 
  Ritwik
 
 
  On 8/23/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  
  With lattice graphics:
 
  library(lattice)
  d1 - rnorm(100)
  d2 - runif(100)
  densityplot(~ d1 + d2, auto.key = TRUE)
 
  On 8/23/06, Antje [EMAIL PROTECTED]  wrote:
   Hello,
  
   I was wondering if I can plot two curves I get from density(data) into
   one plot. I want to compare both.
   With the following commad, I just get one curve plotted:
  
   plot( density(mydata) )
  
   Sorry for this stupid question but I could not find a solution until
  now...
  
   Antje
  
   __
   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.
 
 
 
 
  --
  Ritwik Sinha
  Graduate Student
  Epidemiology and Biostatistics
  Case Western Reserve University
 
  http://darwin.cwru.edu/~rsinha




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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] Implementing EM Algorithm in R!

2006-08-26 Thread Ritwik Sinha
Implementing the EM algorithm will be easy if you know what the algorithm is
for your particular problem. This will be very specific to your problem. The
trick is to augment your data to get something for which there is an easy ML
estimate. I do not believe there is a unique recipe to perform the EM
algorithm for any problem.

On 8/26/06, Pushkar Kumar [EMAIL PROTECTED] wrote:

 Hi All,
 I need some help in how one can implement maximumlikelihood estimation for
 models with discrete hidden variables in EM in R.

 Regards

 [[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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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] plotting picture data

2006-08-04 Thread Ritwik Sinha
Just a suggestion. It seems like each square can be denoted by x and y
coordinates. Then you essentially have a two dimensional histogram/density
that you need to plot. You can use the lattice functions
cloud/wireframe. You can also go for a heat map/contour plot, the
lattice functions for that will be levelplot/contourplot. In case the
number of squares are small, you might prefer a two-dimensional histogram,
cloud in lattice has an option to plot the point as histogram.

Ritwik.

On 8/4/06, Gichangi, Anthony [EMAIL PROTECTED] wrote:

 Hi R users

 I have a dataset which represents points that are market by patients as
 the
 source of pain.
 Basically the patients indicates by a cross on a chest pictures where
 he/she
 thinks is the
 source of pain. The data was then digitalized by divinding the chest into
 small squares and each
 square was give value 1 if it was the center 2 if it was touched by the
 markings and 3 if it was not
 touched.  I would like to plot this data on the chest like graph showing
 the
 intesities of different
 points and later stratify the grouping variables to see the difference.

 Has anybody got an idea how I can go around this ?

 Help is highly appreciated.

 Regards

 Anthony Gichangi, M. sc.
 Department of Statistics.
 JB. Winsløvej 9B,
 DK 5000 Odense C.
 Tel:   00 45 6550 3379
 Mobile:  00 45 61105805

 __
 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.




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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] Rearrange data.

2006-07-19 Thread Ritwik Sinha
Hi,

I am trying to rearrange the following data

d.f - data.frame(x=c(1,1,2,2), y=c(1,2,1,2), vals=c(a11, a12,
a21, a22))

to look like a table with x as the rows and y as the columns, something like

y  1 2
x
1a11 a12
2a21 a22

I tried doing this

funny - function(x,y){d.f[d.f$x==x  d.f$y==y,3]}

outer(1:2,1:2, FUN=funny)
But get the error

Error in outer(1:2, 1:2, FUN = funny) : dim- : dims [product 4] do
not match the length of object [2]

What am I doing wrong? I am sure there are a hundred different ways of
doing this.

version

platform i486-pc-linux-gnu
arch i486
os   linux-gnu
system   i486, linux-gnu
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
language R

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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] FW: Large datasets in R

2006-07-18 Thread Ritwik Sinha
Hi,

I have a related question. How differently do other statistical
softwares handle large data?

The original post claims that 350 MB is fine on Stata. Some one
suggested S-Plus. I have heard people say that SAS can handle large
data sets. Why can others do it and R seem to have a problem? Don't
these softwares load the data onto RAM.

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

__
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] Saving R graphics with version 2.3.1

2006-06-14 Thread Ritwik Sinha
Hi,

Have a

jpeg()

your plot function

dev.off()

That will direct your graphs to a file called Rplots.jpg. Look for
function jpeg and png.



On 6/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 HI !

 I´ve installed the latest R version (2.3.1) and I´ve had problems to
 save my graphics as JPEG, PNG and the others available formats.
 R saves the file with no extension. Then, I have to open this file
 using an image visualizer and save it as PNG, for instance.

 Previous R versions work without problems.

 Has everyone had a similar problem?
 Is it a bug of R 2.3.1?

 Thanks in advance.


 Ilka Afonso Reis

 __
 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




-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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

Re: [R] negative binomial: expected number of events?

2006-06-05 Thread Ritwik Sinha
Hi,

This page should answer your questions.

http://mathworld.wolfram.com/NegativeBinomialDistribution.html

Ritwik Sinha
http://darwin.cwru.edu

On 6/5/06, Werner Tell [EMAIL PROTECTED] wrote:

 Hi

 I'm fitting poisson and negative binomial distributions to event data. I'm
 interested in the expected number of events occuring in a time period. For
 the poisson this is determined by the parameter lambda only.
 For the neg. binomial, is the expected number of events determined by the
 parameter mu only or does parameter size influence the first moment as
 well?

 thank you,
 wt

 _
 Die MSN Homepage liefert Ihnen alle Infos zu Ihren Lieblingsthemen.

 __
 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


[[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


Re: [R] negative binomial: expected number of events?

2006-06-05 Thread Ritwik Sinha
Hi,

The wikipedia page http://en.wikipedia.org/wiki/Negative_binomial also does
a great job of explaining the negative binomial distribution.

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

[[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


Re: [R] Fastest way to do HWE.exact test on 100K SNP data?

2006-06-05 Thread Ritwik Sinha

Hi Anna,

I am not really answering your question, but, here goes my (unsolicited)
suggestion. Some time back I did some simulations to see how the HWE tests
performed. In particular I compared the exact test and the chi squared test.
Look at the attached figure Rplots.ps. I saw that for null simulations with
40 individuals, the HWE chi squared test was reasonably close to the
(expected) uniform distribution. However this was obtained using the
function HWE.chisq(X, simulate.p.value=F), the default seemed to have some
issues. Hence my suggestion would be, if you feel comfortable, to replace
the exact test with a chi sq test, at least at the screening level. Once you
identify a set of SNPs with small p-values, you could follow them up with
the exact test.

--
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha http://darwin.cwru.edu/%7Ersinha


Rplots.ps
Description: PostScript document
__
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

Re: [R] lm() variance covariance matrix of coefficients.

2006-06-03 Thread Ritwik Sinha
Thanks Everybody,

I found it moments after I posted the question.

Ritwik.

On 03 Jun 2006 01:34:48 +0200, Peter Dalgaard [EMAIL PROTECTED]
wrote:

 Rolf Turner [EMAIL PROTECTED] writes:

  Peter Dalgaard wrote:
 
   Rolf Turner [EMAIL PROTECTED] writes:
  
summary(object)$cov.unscaled
  
   You need to multiply that with sigma. However, vcov(object) is easier.
 
Well, I thought unscaled meant unscaled --- the plain
unvarnished covariance matrix!  I figure that multiplying
the *covariance* matrix by something would be scaling
it.  Silly me.

 Think (quasi-)binomial glm() and things become clearer. Unscaled
 corresponds to a scale factor of 1.

Also:
 
(a) Shouldn't that be ``multiply by sigma^2'' rather
than by sigma?

 Yup

(b) Wouldn't it be helpful to have a pointer (``see also'')
to vcov() in the help on summary.lm()?

 Well, it *is* in ?lm ...

 --
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


[[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

[R] lm() variance covariance matrix of coefficients.

2006-06-02 Thread Ritwik Sinha
Hi,

I am running a simple linear model with (say) 5 independent variables. Is
there a simple way of getting the variance-covariance matrix of the
coeffcient estimates?  None of the  values of the lm() seem to provide this.

Thanks in advance,

Ritwik Sinha
[EMAIL PROTECTED]
Grad Student
Case Western Reserve University

[[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


Re: [R] Is there a way to draw 3d plot?

2006-05-29 Thread Ritwik Sinha
Hi,

I am not aware what this function does in matlab, but I was wondering why
cloud or wireframe in the lattice package has not entered the
discussion. Sorry if I am being naive.

Ritwik.

http://darwin.cwru.edu/~rsinha

[[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


Re: [R] uniform and clumped point plots

2006-05-18 Thread Ritwik Sinha
Hi,

If you are looking for data clustered in two dimenstions you can use the
multivariate normal package.

Ritwik Sinha
http://darwin.cwru.edu/~rsinha

[[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


Re: [R] plot with abscissa in hours/weekdays

2006-05-15 Thread Ritwik Sinha

Hi,

You can use the axis() command.

For example

plot(xvec,yvec, xaxt=n)
axis(side=1, labels=c(Mon, Tue), at=c(0,1))

The xaxt sets up the axis but does not plot it. And axis does the rest.

Ritwik.
Case Western Reserve University
http://darwin.cwru.edu/~rsinha




m p wrote:

Hello,
How can I use plot and have abscissa in hours
say (20:00,22:00,00:00,02:00 etc) and also weekdays
say (Mon, Tue, Wed, ...) ?
Is there a command that I can put into
plot(xvec,yvec...,axes=...) that would enable that?
Thanks for help,
Mark

__
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

  


__
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