[R] How to display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525258/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525258p26525258.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525259/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525259p26525259.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525263/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525263p26525263.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525269/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525269p26525269.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525261/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525261p26525261.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525260/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525260p26525260.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525268/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525268p26525268.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Peter Dalgaard

Vladimir Eremeev wrote:
Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 


The r-project would prefer to see one and only one copy of your post, 
though. I count five copies till now!!!


--
   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
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525264/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525264p26525264.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Arrhenius Plot 2 with lattice

2009-11-26 Thread Markus Häge
Hello,

sorry for incomplete code...

with this I read the file and calculate my stuff. I have a plenty of
them 80-300K every 5 Kelvin. I start with 79K, 80K...300K

test-read.table(T300_both.txt,header=FALSE,sep=)
RH2-c(RH2,2.5e7*.32e-4/100e-6/5100*(test$V3[c(2)]-test$V3[c(1)]+test
$V3[c(4)]-test$V3[c(3)]))
n2-c(n2,-1/(RH2[c(46)]*1.60217e-19))
PA2-c(1.1331/100e-6*.32e-4*(test$V1[c(2)]+test$V1[c(4)]-test
$V1[c(1)]-test$V1[c(3)]))
PB2-c(1.1331/100e-6*.32e-4*(test$V1[c(6)]+test$V1[c(8)]-test
$V1[c(5)]-test$V1[c(7)]))
P2-c(P2,(PA2+PB2)/2)
bew2-c(bew2,-RH2[c(46)]/P2[c(46)])
QA2-c(QA2,(test$V1[c(2)]-test$V1[c(1)])/(test$V1[c(4)]-test$V1[c(3)]))
QB2-c(QB2,(test$V1[c(6)]-test$V1[c(5)])/(test$V1[c(8)]-test$V1[c(7)]))

#...

Temp-c(79,80,85,90,95,100,106,110,115,120,125,132,135,140,145,151,156,160,165,170,175,180,185,190,195,200,206,210,216,220,225,230,235,240,247,250,255,261,265,270,275,280,285,290,295,300)

#Here I transform my data to make this Arrhenius Plot:
Temp2-c(1000/Temp)
n2log-c(log10(n2))

#This function should be plottet as log10(n)~1000/T into the data:

kurve2-function(T)2^-.5*sqrt(1e17*2*6*I(T^1.5)*(2*pi*0.689*9.109e-31*1.38e-23/43.9e-68)^1.5)*exp(-.047*1.6e-19/(2*1.38e-23*T))

#Here is the plot-function, but I don't know the argument for
#panel.curve()

trellis.device(jpeg,file=Tabh1.jpg,color=FALSE)
n2plot-xyplot(n2log~Temp2,xlab=list(label=1000/T
(1/K),fontsize=20),ylab=list(label=log(n/cm^3),fontsize=20),scales=list(cex=1.5),panel=function(){panel.xyplot(Temp2,n2log);panel.curve(kurve2)})

print(n2plot)
dev.off()

thanks

Markus

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525266/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525266p26525266.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Barry Rowlingson
On Thu, Nov 26, 2009 at 7:14 AM, Vladimir Eremeev wl2...@gmail.com wrote:

 The underlying picture is a JPEG image, loaded with the rimage package and
 coerced to the matrix.
 Spheres denote control points, collected from this picture and must be
 situated over the certain points of the image.
 I display the image with rgl.points.
 In case of the standard video camera image (704x576) it has to display over
 40 points which is rather slow and memory consuming.
 How can I put an original JPEG on this plot?

 Another problem is that the picture is color initially, but was converted to
 the grayscale. I'd like to preserve colors.


 Try using surface3d with a flat surface (z=0) and a matrix of colours
in the col= argument. See help(surface3d) for an example.

 Also STOP POSTING!!! There seems to be about 8 copies of your message
in my inbox!!!

Barry

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525271/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525271p26525271.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] arg min ???

2009-11-26 Thread Peterko

Petr that is what i was looking for.
Thanks

p.s. ak si nahodou z Prahy mas u mna Pivo

Petr Pikal wrote:
 
 Hi
 
 r-help-boun...@r-project.org napsal dne 25.11.2009 16:50:49:
 
 
 This is nice, but i have to define vector of possible theta, this is not 
 what
 i want to do.
 I have vector of unknow parameters theta. I have som estimate of theta, 
 but
 i want to do better estimate of them, using some criterion function. 
 I mean it is clasical argmin f(x_1,x_2,...x_n)  to fit vector
 (x_1,x_2...,x_n)` 
 
 I am not sure what you mean by argmin, but maybe you could look at ?optim
 
 Regards
 Petr
 
 
 
 David Winsemius wrote:
  
  
  On Nov 25, 2009, at 9:15 AM, Peterko wrote:
  
 
  Is there function what aproximate vector of parameters some function 
  to
  minimum ?
 
  tet={tet1,tet2}  i have they starting value
 
  and i want to find the tet what minimalizing some function of tet ?
  
  ?which.min
  
  Perhaps:
  
which.min( fn(tet) )
  
 
  thanks
  -- 
  View this message in context:
  http://old.nabble.com/arg-min-tp26513358p26513358.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@r-project.org 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 Winsemius, MD
  Heritage Laboratories
  West Hartford, CT
  
  __
  R-help@r-project.org 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.
  
  
 
 -- 
 View this message in context: 
 http://old.nabble.com/arg-min-tp26513358p26515110.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org 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@r-project.org 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.
 
 

-- 
View this message in context: 
http://old.nabble.com/arg-min-tp26513358p26525273.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Vladimir Eremeev

Hi all. 
It's been a long time since I wrote to this list. Glad to see the R project
well and working. 

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525270/rgl-device.png rgl-device.png 

The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be
situated over the certain points of the image. 
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot? 

Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.
Any hints would be appreciated.
-- 
View this message in context: 
http://old.nabble.com/How-to-display-an-image-on-RGL-plot--tp26525270p26525270.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Concave hull

2009-11-26 Thread Corrado Topi

Dear David and other concave-hull-ists,

yes, I meant concave hulls indeed. I know about the algorithm mentioed 
(www.concavehull.com) but it is not open source, so you cannot integrate it 
in R, and it is apparently patented, so even if you find the description 
you cannot apply it to implement a solution (even if patenting algorithms 
is at least questionable and has a rather patchy validity).


Some questions / comments which applies to David's approach but in general 
even to convex hulls (question 2):


1) How do you extend it to n dimensions (in R)? 2) How do you do set 
calculus (horrible expression to mean: union, intersection, difference, 
and particularly membership, and so on ) on these hulls (in R)?


Finally, I am at the moment using a gis to do it, but I did not find any 
command for concave hulls in grass. There is a rather long a convoluted way 
of doing them, but nearly impossible to automatise (see 
http://grass.osgeo.org/wiki/Create_concave_hull). Looking for the 
capability of extending it to the n-dimensional case does not sound right, 
because gis is thought for working in 2d/3d.



Best,


On Nov 26 2009, David Winsemius wrote:



On Nov 25, 2009, at 7:51 PM, David Winsemius wrote:


Drats; Forgot the plot:

xx - runif(100, -1, 1)
yy - abs(xx)+rnorm(100,0,.2); plot(xx,yy, xlim=c( min(xx)-sd(xx),  
max(xx)+sd(xx)), ylim =c( min(yy)-sd(yy), max(yy)+sd(yy)))


dens2 - kde2d(xx, yy, lims=c(min(xx)-sd(xx), max(xx)+sd(xx),  
min(yy)-sd(yy), max(yy)+sd(yy) )  )

contour(dens2, add=TRUE)

#  You can pick a single contour if you like:


contour(dens2, level=0.05, col=red, add=TRUE)
contour(dens2, level=0.10, col=blue, add=TRUE)


And as a further note you can drop the bandwidth and lower the density  
level to get a tighter fit:


xx - runif(1, -1, 1)
yy - abs(xx)+rnorm(1   ,0,.2); plot(xx,yy, xlim=c( min(xx)- 
sd(xx), max(xx)+sd(xx)), ylim =c( min(yy)-sd(yy), max(yy)+sd(yy)),  
cex=.2)


dens2 - kde2d(xx, yy, lims=c(min(xx)-sd(xx), max(xx)+sd(xx), min(yy)- 
sd(yy), max(yy)+sd(yy) ) , h=c(bandwidth.nrd(xx)/4, bandwidth.nrd(xx)/ 
4) )

contour(dens2, add=TRUE)
#  You can pick a single contour if you like:

contour(dens2, level=0.05, col=red, add=TRUE)
contour(dens2, level=0.10, col=blue, add=TRUE)

contour(dens2, level=0.005, col=red, add=TRUE)


(More bat-like.)




--
Corrado Topi

Global Climate Change  Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk

__
R-help@r-project.org 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] Sorry for repeated posts.

2009-11-26 Thread Vladimir Eremeev

I was sending my messages through Nabble, while it has went down for
maintenance.
-- 
View this message in context: 
http://old.nabble.com/Sorry-for-repeated-posts.-tp26525299p26525299.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] order of panels in xyplots

2009-11-26 Thread Titus Malsburg
Peter, thanks for your response!  The problem is not how indexing
works, but rather the question what is being indexed here.  If I
understand the description correctly then it is wrong.  In the special
and common case where all possible levels do actually occur in the
data frame it coincidentally happens to work the way it is described
but not when the data frame contains only data points for some of the
levels.  Then it appears that the indexing vector has to be bound to
1:length(unique(f)) which is unequal 1:nlevels(f).  (f is a factor
here.)

  Titus

On Wed, Nov 25, 2009 at 10:32 PM, Peter Ehlers ehl...@ucalgary.ca wrote:

 Titus Malsburg wrote:

 The documentation of xyplot could be improved here.  It says:

  If 'index.cond' is a list, it has to be as long as the number of
 conditioning
   variables, and the 'i'-th component has to be a valid indexing vector
 for the
   integer vector '1:nlevels(g_i)' (which can, among other things, repeat
 some
   of the levels or drop some altogether).

 It should make explicit that nlevels is the number of levels actually
 used in the data and not length(levels(f)).

 It does say ... _valid_ indexing vector ... (my emphasis).
 If nlevels(g) = 5, but you're only plotting 3 panels, it seems
 to me that c(3,1,5) might be a valid indexing vector.

  -Peter Ehlers

 Cheers,

   Titus

 __
 R-help@r-project.org 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@r-project.org 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] difference of two rows

2009-11-26 Thread clion

Yes, thanks, that works perfectly!
great command

b.



jholtman wrote:
 
 Try this:
 
 x - read.table(textConnection(ID YEAR
 + 13 2007
 + 15 2003
 + 15 2006
 + 15 2008
 + 21 2006
 + 21 2007), header=TRUE)
 x$diff - ave(x$YEAR, x$ID, FUN=function(a) c(diff(a), NA))

 x
   ID YEAR diff
 1 13 2007   NA
 2 15 20033
 3 15 20062
 4 15 2008   NA
 5 21 20061
 6 21 2007   NA
 
 
 On Wed, Nov 25, 2009 at 10:55 AM, clion birt...@hotmail.com wrote:

 Dear R user,
 I'd like to calculate the difference of two rows, where ID is the same.
 eg.: I've got the following dataframe:
 ID YEAR
 13 2007
 15 2003
 15 2006
 15 2008
 21 2006
 21 2007

 and I'd like to get the difference, like this:
 ID YEAR diff
 13 2007  NA
 15 2003   3
 15 2006   2
 15 2008  NA
 21 2006   1
 21 2007  NA

 that should be fairly easy...I hope
 Thanks for any helpful comments
 B.



 --
 View this message in context:
 http://old.nabble.com/difference-of-two-rows-tp26515212p26515212.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org 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 that you are trying to solve?
 
 __
 R-help@r-project.org 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.
 
 

-- 
View this message in context: 
http://old.nabble.com/difference-of-two-rows-tp26515212p26525340.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Arrhenius Plot 2 with lattice

2009-11-26 Thread joris meys
Please provide minimal and self-contained code. Without being able to
read in the dataset, it's impossible to check the code.

Cheers
Joris

On Thu, Nov 26, 2009 at 9:13 AM, Markus Häge markus_ha...@gmx.de wrote:
 Hello,

 sorry for incomplete code...

 with this I read the file and calculate my stuff. I have a plenty of
 them 80-300K every 5 Kelvin. I start with 79K, 80K...300K

 test-read.table(T300_both.txt,header=FALSE,sep=)
 RH2-c(RH2,2.5e7*.32e-4/100e-6/5100*(test$V3[c(2)]-test$V3[c(1)]+test
 $V3[c(4)]-test$V3[c(3)]))
 n2-c(n2,-1/(RH2[c(46)]*1.60217e-19))
 PA2-c(1.1331/100e-6*.32e-4*(test$V1[c(2)]+test$V1[c(4)]-test
 $V1[c(1)]-test$V1[c(3)]))
 PB2-c(1.1331/100e-6*.32e-4*(test$V1[c(6)]+test$V1[c(8)]-test
 $V1[c(5)]-test$V1[c(7)]))
 P2-c(P2,(PA2+PB2)/2)
 bew2-c(bew2,-RH2[c(46)]/P2[c(46)])
 QA2-c(QA2,(test$V1[c(2)]-test$V1[c(1)])/(test$V1[c(4)]-test$V1[c(3)]))
 QB2-c(QB2,(test$V1[c(6)]-test$V1[c(5)])/(test$V1[c(8)]-test$V1[c(7)]))

 #...

 Temp-c(79,80,85,90,95,100,106,110,115,120,125,132,135,140,145,151,156,160,165,170,175,180,185,190,195,200,206,210,216,220,225,230,235,240,247,250,255,261,265,270,275,280,285,290,295,300)

 #Here I transform my data to make this Arrhenius Plot:
 Temp2-c(1000/Temp)
 n2log-c(log10(n2))

 #This function should be plottet as log10(n)~1000/T into the data:

 kurve2-function(T)2^-.5*sqrt(1e17*2*6*I(T^1.5)*(2*pi*0.689*9.109e-31*1.38e-23/43.9e-68)^1.5)*exp(-.047*1.6e-19/(2*1.38e-23*T))

 #Here is the plot-function, but I don't know the argument for
 #panel.curve()

 trellis.device(jpeg,file=Tabh1.jpg,color=FALSE)
 n2plot-xyplot(n2log~Temp2,xlab=list(label=1000/T
 (1/K),fontsize=20),ylab=list(label=log(n/cm^3),fontsize=20),scales=list(cex=1.5),panel=function(){panel.xyplot(Temp2,n2log);panel.curve(kurve2)})

 print(n2plot)
 dev.off()

 thanks

 Markus

 __
 R-help@r-project.org 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@r-project.org 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 help with princomp and pam clustering

2009-11-26 Thread joris meys
On Thu, Nov 26, 2009 at 1:04 AM, Tyler82 procaccianti.clau...@gmail.com wrote:

 Hi all!
 I am working with R package cluster and I have a little problem:
 let's say I have two datasets...first one (A) is divided into 4 clusters
 by means of Pam algorythm.
 Let's say I want to project the second database (B) onto the Comp.1 X
 Comp.2 graph, and see where its elements are placed.
 The two datasets are made of different dim (54x19 and 28x19). I tried to
 extract the $loadings of the A clustering but I can't seem to figure out how
 to use them with B :(

Prin - princomp(A)
predict(Prin,B)

in the assumption that the variable names in both dataframes are equal.

 Using princomp I menaged to extract the $scores and plot the graph. Wouldn't
 using princomp on the B dataset generate different PC?

Indeed, it would.

 Thank you all!
 Bye!!

 Claudio
 --
 View this message in context: 
 http://old.nabble.com/R-help-with-princomp-and-pam-clustering-tp26522485p26522485.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org 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@r-project.org 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] analyse tab delimited textfile microarray data(help)

2009-11-26 Thread kumar kk
Hello
I have microarray data in tab delimited text file.The main headers and some
fields are as:
following are the header:

FEATURES FeatureNum Row Col SubTypeMask ControlType ProbeName
SystematicName PositionX PositionY LogRatio LogRatioError
PValueLogRatio gProcessedSignal rProcessedSignal gProcessedSigError
rProcessedSigError gMedianSignal rMedianSignal gBGMedianSignal
rBGMedianSignal gBGPixSDev rBGPixSDev gIsSaturated rIsSaturated
gIsFeatNonUnifOL rIsFeatNonUnifOL gIsBGNonUnifOL rIsBGNonUnifOL
gIsFeatPopnOL rIsFeatPopnOL gIsBGPopnOL rIsBGPopnOL IsManualFlag
gBGSubSignal rBGSubSignal gIsPosAndSignif rIsPosAndSignif
gIsWellAboveBG rIsWellAboveBG SpotExtentX gBGMeanSignal rBGMeanSignal



following is the data corresponding to the above header :


DATA 1 1 1 66 1 DarkCorner DarkCorner 379.607 199.729 -5.98E-01
1.10E+00 5.86E-01 2.46E+00 6.21E-01 3.02E+00 1.51E+00 0 0 241 273
1.35E+02 1.48E+02 0 0 0 0 0 0 0 0 0 0 0 16.0892 -4.46689 1 0 0 0 65
135.479 148.517
DATA 2 1 2 66 1 DarkCorner DarkCorner 405 199.545 -4.71E-01 1.27E+00
7.11E-01 1.83E+00 6.20E-01 2.88E+00 1.55E+00 135 145.5 238 266
1.31E+02 1.48E+02 0 0 0 0 0 0 0 0 0 0 0 12.0031 2.05821 1 0 0 0 65
131.295 147.49
DATA 3 1 3 66 1 DarkCorner DarkCorner 430.5 199.5 -2.62E-01 1.55E+00
8.66E-01 1.13E+00 6.18E-01 2.66E+00 1.45E+00 128 142.5 237.5 270.5
1.30E+02 1.47E+02 0 0 0 0 0 0 0 0 0 0 0 7.41805 -0.318846 1 0 0 0
64.8204 130.996 148.231
DATA 4 1 4 0 0 GT_MTB_142632 chr1:2567359-2567418 455.648 199.519
1.89E-03 6.14E-02 9.75E-01 1.18E+03 1.18E+03 1.18E+02 1.18E+02 7776
15813 231.5 266 1.29E+02 1.48E+02 0 0 0 0 0 0 0 0 0 0 0 7741.9 15324.2
1 1 1 1 57.5363 129.226 148.004




Please tell me how can we analyse this tab delimited text file of microarray
data.
Please tell me the procedure of analysis.

thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] multi variate plot with string data

2009-11-26 Thread frenchcr

is there something wrong with the way i asked the question


frenchcr wrote:
 
 
 Ive got two columns in data_set that are strings
 
 the first column is called character and has levels:
 good, bad, ugly
 
 the second column is called abusive and has levels:
 aggressive, moderately aggressive, mildly aggressive
 
 
 I want to do a stacked boxplot that has this sort of structure: 
 
 %aggressive %aggressive
 %aggressive
 %moderately aggressive %moderately aggressive  %moderately
 aggressive
 %mildly aggressive %mildly aggressive %mildly
 aggressive
 %not agressive %not agressive  %not
 agressive
 
bad  good  
 ugly
 
 
 ...with legend at the size showing which colour each of the abusive
 levels takes.
 
 
 How is it done?
 

-- 
View this message in context: 
http://old.nabble.com/multi-variate-plot-with-string-data-tp26517211p26525342.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] JMP - R ?

2009-11-26 Thread Robert Kinley
A wild thought ... 

   ...  anyone out there know if it's possible to call R code from JMP ?

Bob Kinley - Eli Lilly  co, UK
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Error in do.call(expand.grid, dimnames(x)) :

2009-11-26 Thread deepak m r
Hi Friends,
I am getting this error when I am running my R scripts. Can u please
tell me how this error will happened. My script is given below.
Errot:  Error in do.call(expand.grid, dimnames(x)) :

Script:

#!/usr/bin/R
s-c(GG,GA,GV,GL,GI,GM,GF,GW,GP,GS,GT,GC,GY,GN,GQ,GD,GE,GK,GR,GH,AG,s[l],AV,AL,AI,AM,AF,AW,AP,AS,AT,AC,AY,AN,AQ,AD,AE,AK,AR,AH,VG,VA,VV,VL,VI,VM,VF,VW,VP,VS,VT,VC,VY,VN,VQ,VD,VE,VK,VR,VH,LG,LA,LV,LL,LI,LM,LF,LW,LP,LS,LT,LC,LY,LN,LQ,LD,LE,LK,LR,LH,IG,IA,IV,IL,II,IM,IF,IW,IP,IS,IT,IC,IY,IN,IQ,ID,IE,IK,IR,IH,MG,MA,MV,ML,MI,MM,MF,MW,MP,MS,MT,MC,MY,MN,MQ,MD,ME,MK,MR,MH,FG,FA,FV,FL,FI,FM,FF,FW,FP,FS,FT,FC,FY,FN,FQ,FD,FE,FK,FR,FH,WG,WA,WV,WL,WI,WM,WF,WW,WP,WS,WT,WC,WY,WN,WQ,WD,WE,WK,WR,WH,PG,PA,PV,PL,PI,PM,PF,PW,PP,PS,PT,PC,PY,PN,PQ,PD,PE,PK,PR,PH,SG,SA,SV,SL,SI,SM,SF,SW,SP,SS,ST,SC,SY,SN,SQ,SD,S!
 
E,SK,SR,SH,TG,TA,TV,TL,TI,TM,TF,TW,TP,TS,TT,TC,TY,TN,TQ,TD,TE,TK,TR,TH,CG,CA,CV,CL,CI,CM,CF,CW,CP,CS,CT,CC,CY,CN,CQ,CD,CE,CK,CR,CH,YG,YA,YV,YL,YI,YM,YF,YW,YP,YS,YT,YC,YY,YN,YQ,YD,YE,YK,YR,YH,NG,NA,NV,NL,NI,NM,NF,NW,NP,NS,NT,NC,NY,NN,NQ,ND,NE,NK,NR,NH,QG,QA,QV,QL,QI,QM,QF,QW,QP,QS,QT,QC,QY,QN,QQ,QD,QE,QK,QR,QH,DG,DA,DV,DL,DI,DM,DF,DW,DP,DS,DT,DC,DY,DN,DQ,DD,DE,DK,DR,DH,EG,EA,EV,EL,EI,EM,EF,EW,EP,ES,ET,EC,EY,EN,EQ,ED,EE,EK,ER,EH,KG,KA,KV,KL,KI,KM,KF,KW,KP,KS,KT,KC,KY,KN,KQ,KD,KE,KK,KR,KH,RG,RA,RV,RL,RI,RM,RF,RW,RP,RS,RT,RC,RY,RN,RQ,RD,RE,RK,RR,RH,HG,HA,HV,HL,HI,HM,HF,HW,HP,HS,HT,HC,HY,HN,!
 HQ,HD,HE,HK,HR,HH)
for(l in 1:length(s))
{
for(j in 1:50)
{

if(file.info(paste(/media/_1/BootStrap/All_alpha_proteins/,s[l],/alp,s[l],mean,j,.bootstrap,sep=))$size1)
{

a-read.table(paste(/media/_1/BootStrap/All_alpha_proteins/,s[l],/alp,s[l],mean,j,.bootstrap,sep=))
A-a[,1]
Amax-max(A)
Amin-min(A)
Salpha-summary(A)
df-data.frame(P=Salpha)
color-aquamarine1
flg-All Alpha
}

if(file.info(paste(/media/_1/BootStrap/All_beta_proteins/,s[l],/bet,s[l],mean,j,.bootstrap,sep=))$size1)
{

b-read.table(paste(/media/_1/BootStrap/All_beta_proteins/,s[l],/bet,s[l],mean,j,.bootstrap,sep=))
B-b[,1]
Bmax-max(B)
Bmin-min(B)
Sbeta-summary(B)
df-data.frame(df,Q=Sbeta)
color-c(color,brown1)
flg-c(flg,All Beta)
}

if(file.info(paste(/media/_1/BootStrap/Alpha_and_beta_proteins_aorb/,s[l],/aob,s[l],mean,j,.bootstrap,sep=))$size1)
{

c-read.table(paste(/media/_1/BootStrap/Alpha_and_beta_proteins_aorb/,s[l],/aob,s[l],mean,j,.bootstrap,sep=))
C-c[,1]
Cmax-max(C)
Cmin-min(C)
Saob-summary(C)
df-data.frame(df,R=Saob)
color-c(color,cadetblue1)
flg-c(flg,Alpha or Beta)
}

if(file.info(paste(/media/_1/BootStrap/Alpha_and_beta_proteins_a+b/,s[l],/apb,s[l],mean,j,.bootstrap,sep=))$size1)
{

d-read.table(paste(/media/_1/BootStrap/Alpha_and_beta_proteins_a+b/,s[l],/apb,s[l],mean,j,.bootstrap,sep=))
D-d[,1]
Dmax-max(D)
Dmin-min(D)
Sapb-summary(D)
df-data.frame(df,S=Sapb)
color-c(color,darkorchid1)
flg-c(flg,Alpha plus Beta)
}
Tmax-c(Amax,Bmax,Cmax,Dmax)
Tmin-c(Amin,Bmin,Cmin,Dmin)
pdf (paste(s[l],mean,j,_bootstrap.pdf,sep=))

boxplot(df,names=flg,ylim=c(min(Tmin),max(Tmax)),col=color,style = tukey)
title(paste(Residue Pair Distance Statistics,\n,s[l], 
Paired
Distance of ,j,sep=),ylab=Distance in Angstrom,xlab=Protein
Classes)
dev.off()
}
}

*

-- 
**
Deepak.M.R
Research Scholar
Biocomputing Group,
Department of Computer Science,
University of Bologna (Italy).
http://deepak.web.cs.unibo.it/.

__
R-help@r-project.org 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 

Re: [R] Concave hull

2009-11-26 Thread Duncan Murdoch

On 26/11/2009 4:02 AM, Corrado Topi wrote:

Dear David and other concave-hull-ists,

yes, I meant concave hulls indeed. I know about the algorithm mentioed 
(www.concavehull.com) but it is not open source, so you cannot integrate it 
in R, and it is apparently patented, so even if you find the description 
you cannot apply it to implement a solution (even if patenting algorithms 
is at least questionable and has a rather patchy validity).


Some questions / comments which applies to David's approach but in general 
even to convex hulls (question 2):


1) How do you extend it to n dimensions (in R)? 2) How do you do set 
calculus (horrible expression to mean: union, intersection, difference, 
and particularly membership, and so on ) on these hulls (in R)?


Finally, I am at the moment using a gis to do it, but I did not find any 
command for concave hulls in grass. There is a rather long a convoluted way 
of doing them, but nearly impossible to automatise (see 
http://grass.osgeo.org/wiki/Create_concave_hull). Looking for the 
capability of extending it to the n-dimensional case does not sound right, 
because gis is thought for working in 2d/3d.


I don't see a clear definition of what a concave hull should be, but the 
following version of the algorithm above looks automatisable, if slow on 
big sets:


Generate all pairwise distances, and generate the undirected graph 
formed of edges below a certain length threshold.


Take each connected component of that graph, and discard any internal 
points and edges.  (An internal edge is one whose midpoint is in the 
interior of a polygon formed by other edges in the graph.  I'd build it 
up by starting with an arbitrary pair of points and growing from there.)


Duncan Murdoch




Best,


On Nov 26 2009, David Winsemius wrote:


On Nov 25, 2009, at 7:51 PM, David Winsemius wrote:


Drats; Forgot the plot:

xx - runif(100, -1, 1)
yy - abs(xx)+rnorm(100,0,.2); plot(xx,yy, xlim=c( min(xx)-sd(xx),  
max(xx)+sd(xx)), ylim =c( min(yy)-sd(yy), max(yy)+sd(yy)))


dens2 - kde2d(xx, yy, lims=c(min(xx)-sd(xx), max(xx)+sd(xx),  
min(yy)-sd(yy), max(yy)+sd(yy) )  )

contour(dens2, add=TRUE)

#  You can pick a single contour if you like:


contour(dens2, level=0.05, col=red, add=TRUE)
contour(dens2, level=0.10, col=blue, add=TRUE)
And as a further note you can drop the bandwidth and lower the density  
level to get a tighter fit:


xx - runif(1, -1, 1)
yy - abs(xx)+rnorm(1   ,0,.2); plot(xx,yy, xlim=c( min(xx)- 
sd(xx), max(xx)+sd(xx)), ylim =c( min(yy)-sd(yy), max(yy)+sd(yy)),  
cex=.2)


dens2 - kde2d(xx, yy, lims=c(min(xx)-sd(xx), max(xx)+sd(xx), min(yy)- 
sd(yy), max(yy)+sd(yy) ) , h=c(bandwidth.nrd(xx)/4, bandwidth.nrd(xx)/ 
4) )

contour(dens2, add=TRUE)
#  You can pick a single contour if you like:

contour(dens2, level=0.05, col=red, add=TRUE)
contour(dens2, level=0.10, col=blue, add=TRUE)

contour(dens2, level=0.005, col=red, add=TRUE)


(More bat-like.)






__
R-help@r-project.org 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] homals (level numerical, scoremat and catscores...)

2009-11-26 Thread Krusty the Klown

Just run this code:

library(homals)
data(sleeping)
sleeping
res - homals(sleeping[,2:4], level = c(rep(numerical,2),nominal),
ndim=1)
plot(sleeping[,2],res$scoremat[,,1][,1],axes=F)
axis(1,sleeping[,2])
abline(h=res$scoremat[,,1][,1])
box()

It looks strange, innit? There is something which does not come out right
among catscores and scoremat... which are the right transformed values?
:working:
-- 
View this message in context: 
http://old.nabble.com/homals-%28level-numerical%2C-scoremat-and-catscores...%29-tp26526489p26526489.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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: RE: R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails

2009-11-26 Thread simona.racio...@libero.it
Thanks for your message!
Actually it works quite well for me too.

If I then take the trace of the final result below, I end up with a number 
made up of both a real and an imaginary part. This does not probably mean much 
if the trace of the matrix below givens me info about the degrees of freedom of 
a model...

Simona 

Messaggio originale
Da: rvarad...@jhmi.edu
Data: 25-nov-2009 18.55
A: simona.racio...@libero.it, p.dalga...@biostat.ku.dk
Cc: r-help@r-project.org
Ogg: RE: [R] R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and 
Choleski with pivoting of matrix fails

I do not understand what the problem is, as it works just fine for me:

A - matrix(c(0.5401984,-0.3998675,-1.3785897,-0.3998675,1.0561872,  
0.8158639,-1.3785897, 0.8158639, 1.6073119), 3, 3, byrow=TRUE)

eA - eigen(A)

chA -  eA$vec %*% diag(sqrt(eA$val+0i)) %*% t(eA$vec)

all.equal(A, Re(chA %*% t(chA)))

Y - diag(c(1,2,3))

solve(chA %*% Y)

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: rvarad...@jhmi.edu

Webpage:  http://www.jhsph.
edu/agingandhealth/People/Faculty_personal_pages/Varadhan.html

 




-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of simona.racio...@libero.it
Sent: Wednesday, November 25, 2009 9:59 AM
To: p.dalga...@biostat.ku.dk
Cc: r-help@r-project.org
Subject: [R] R: Re: R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and 
Choleski with pivoting of matrix fails

Dear Peter,
thank you very much for your answer.

My problem is that I need to calculate the following quantity:

solve(chol(A)%*%Y)

Y is a 3*3 diagonal matrix and A is a 3*3 matrix. Unfortunately one 
eigenvalue of A is negative. I can anyway take the square root of A but when 
I 
multiply it by Y, the imaginary part of the square root of A is dropped, and 
I 
do not get the right answer.

I tried to exploit the diagonal structure of Y by using 2*2 matrices for A 
and Y. In this way the problem mentioned above disappears (since all 
eigenvalues of A are positive) and when I perform the calculation above I 
get 
approximately the right answer. The approximation is quite good. However it 
is 
an approximation.

Any suggestion?
Thank you very much!
Simon




Messaggio originale
Da: p.dalga...@biostat.ku.dk
Data: 23-nov-2009 14.09
A: simona.racio...@libero.itsimona.racio...@libero.it
Cc: Charles C. Berrycbe...@tajo.ucsd.edu, r-help@r-project.org
Ogg: Re: R: Re: [R] chol( neg.def.matrix ) WAS: Re: Choleski and Choleski 
with pivoting of matrix fails

simona.racio...@libero.it wrote:
 It works! But Once I have the square root of this matrix, how do I 
convert 
it 
 to a real (not imaginary) matrix which has the same property? Is that 
 possible?

No. That is theoretically impossible.

If A = B'B, then x'Ax = ||Bx||^2 = 0

for any x, which implies in particular that all eigenvalues of A should
be nonnegative.

 
 Best,
 Simon
 
 Messaggio originale
 Da: p.dalga...@biostat.ku.dk
 Data: 21-nov-2009 18.56
 A: Charles C. Berrycbe...@tajo.ucsd.edu
 Cc: simona.racio...@libero.itsimona.racio...@libero.it, r-h...@r-
 project.org
 Ogg: Re: [R] chol( neg.def.matrix ) WAS: Re: Choleski and Choleski 
with 
 pivoting of matrix fails
 Charles C. Berry wrote:
 On Sat, 21 Nov 2009, simona.racio...@libero.it wrote:

 Hi Everyone,

 I need to take the square root of the following matrix:

[,1]   [,2][,3]
 [1,]  0.5401984 -0.3998675 -1.3785897
 [2,] -0.3998675  1.0561872  0.8158639
 [3,] -1.3785897  0.8158639  1.6073119

 I tried Choleski which fails. I then tried Choleski with pivoting, 
but
 unfortunately the square root I get is not valid. I also tried eigen
 decomposition but i did no get far.

 Any clue on how to do it?!

 If you want to take the square root of a negative definite matrix, 
you 
 could use

 sqrtm( neg.def.mat )

 from the expm package on rforge:

 http://r-forge.r-project.org/projects/expm/
 But that matrix is not negative definite! It has 2 positive and one 
 negative eigenvalue. It is non-positive definite.

 It is fairly easy in any case to get a matrix square root from the 
eigen 
 decomposition:

 v%*%diag(sqrt(d+0i))%*%t(v)
   [,1]  [,2]  [,3]
 [1,]  0.5164499+0.4152591i -0.1247682-0.0562317i -0.7257079+0.3051868i
 [2,] -0.1247682-0.0562317i  0.9618445+0.0076145i  0.3469916-0.0413264i
 [3,] -0.7257079+0.3051868i  0.3469916-0.0413264i  1.0513849+0.2242912i
 ch - v%*%diag(sqrt(d+0i))%*%t(v)
 t(ch)%*% ch
   [,1]  [,2]  [,3]
 [1,]  0.5401984+0i -0.3998675-0i -1.3785897-0i
 [2,] -0.3998675-0i  1.0561872+0i  

Re: [R] How to display an image on RGL plot?

2009-11-26 Thread Duncan Murdoch

On 26/11/2009 2:14 AM, Vladimir Eremeev wrote:

Hi all.
It's been a long time since I wrote to this list. Glad to see the R project
well and working.

I am working  with a 3D plot similar to this: 
http://old.nabble.com/file/p26525177/rgl-device.png rgl-device.png 


The underlying picture is a JPEG image, loaded with the rimage package and
coerced to the matrix. 
Spheres denote control points, collected from this picture and must be

situated over the certain points of the image.
I display the image with rgl.points. 
In case of the standard video camera image (704x576) it has to display over
40 points which is rather slow and memory consuming. 
How can I put an original JPEG on this plot?


Another problem is that the picture is color initially, but was converted to
the grayscale. I'd like to preserve colors.


I can't see that image; the link doesn't work.  But the best way to 
display an image in rgl is to use texture mapping.  There are examples 
in ?persp3d (where the texture is a world map, displayed on a globe) and 
demo(flag).  See ?rgl.surface for a description of how texture 
coordinates are specified.


Duncan Murdoch

__
R-help@r-project.org 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 display an image on RGL plot?

2009-11-26 Thread Martin Maechler
 Barry Rowlingson b.rowling...@lancaster.ac.uk
 on Thu, 26 Nov 2009 08:18:51 + writes:

 On Thu, Nov 26, 2009 at 7:14 AM, Vladimir Eremeev wl2...@gmail.com 
wrote:
 The underlying picture is a JPEG image, loaded with the rimage package 
and
 coerced to the matrix.
 Spheres denote control points, collected from this picture and must be
 situated over the certain points of the image.
 I display the image with rgl.points.
 In case of the standard video camera image (704x576) it has to display 
over
 40 points which is rather slow and memory consuming.
 How can I put an original JPEG on this plot?
 
 Another problem is that the picture is color initially, but was 
converted to
 the grayscale. I'd like to preserve colors.
 

 Try using surface3d with a flat surface (z=0) and a matrix of colours
 in the col= argument. See help(surface3d) for an example.

 Also STOP POSTING!!! There seems to be about 8 copies of your message
 in my inbox!!!

I hope it has ended now, with 12 copies.

We've seen this once in the past, and also there, it
was the Nabble interface (!)

Personally I'd really prefer people would use regular
subscriptions and regular e-mail for posting to the R mailing
lists.

Martin Maechler,  ETH Zurich,  
  provider of the major R mailing lists


 Barry

 __
 R-help@r-project.org 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@r-project.org 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] Testing for strength of fit using R

2009-11-26 Thread Steve Murray

Dear all,

I am trying to validate a model by comparing simulated output values against 
observed values. I have produced a simple X-y scatter plot with a 1:1 line, so 
that the closer the points fall to this line, the better the 'fit' between the 
modelled data and the observation data.

I am now attempting to quantify the strength of this fit by using a statistical 
test in R. I am no statistics guru, but from my limited understanding, I 
suspect that I need to use the Chi Squared test (I am more than happy to be 
corrected on this though!).

However, this results in the following:


 chisq.test(data$Simulation,data$Observation)

    Pearson's Chi-squared test

data:  data$Simulation and data$Observation 
X-squared = 567, df = 550, p-value = 0.2989

Warning message:
In chisq.test(data$Simulation, data$Observation) :
  Chi-squared approximation may be incorrect


The ?chisq.test document suggests that the objects should be of vector or 
matrix format, so I tried the following, but still receive a warning message 
(and different results):

 chisq.test(as.matrix(data[,4:5]))

    Pearson's Chi-squared test

data:  as.matrix(data[, 4:5]) 
X-squared = 130.8284, df = 26, p-value = 6.095e-16

Warning message:
In chisq.test(as.matrix(data[, 4:5])) :
  Chi-squared approximation may be incorrect



What am I doing wrong and how can I successfully measure how well the simulated 
values fit the observed values?


If it's of any help, here are how my data are structured - note that I am only 
using columns 4 and 5 (Observation and Simulation).

 str(data)
'data.frame':    27 obs. of  5 variables:
 $ Location    : Factor w/ 27 levels Australia,Brazil,..: 8 2 13 19 22 
14 16 23 6 7 ...
 $ Vegetation  : Factor w/ 21 levels Beech,Broadleaf evergreen 
laurel,..: 17 21 2 16 15 16 9 16 3 4 ...
 $ Vegetation.Class: Factor w/ 4 levels Boreal and Temperate Evergreen,..: 3 
3 4 1 1 1 4 1 4 1 ...
 $ Observation : num  24 8.9 14.7 26.7 42.4 31.7 30.8 7.5 14 22 ...
 $ Simulation  : num  33.9 7.8 9.74 7.6 11.8 10.7 12 28.1 1.7 1.7 ...


I hope someone is able to point me in the right direction.

Many thanks,

Steve



  
_
Have more than one Hotmail account? Link them together to easily access both
 http://clk.atdmt.com/UKM/go/186394591/direct/01/
__
R-help@r-project.org 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] Vista truncated Sys.getenv(PATH) when and only when running as administrator

2009-11-26 Thread Keith Ponting
This is rather strange and I suspect is a Windows issue rather than an R
issue, but it does not

seem to be mentioned on the lists so I am logging it in case it gives
anyone else problems.

 

Running Vista Business Version 6.0.6002 Service Pack 2 Build 6002, with
the latest R 2.10.0 patched.

 

A normal 'R' gui process:

 

 p - Sys.getenv(PATH)

 nchar(p)

PATH 

1199 

 sessionInfo()

R version 2.10.0 Patched (2009-11-23 r50548) 

i386-pc-mingw32 

 

locale:

[1] LC_COLLATE=English_United Kingdom.1252 

[2] LC_CTYPE=English_United Kingdom.1252   

[3] LC_MONETARY=English_United Kingdom.1252

[4] LC_NUMERIC=C   

[5] LC_TIME=English_United Kingdom.1252

 

attached base packages:

[1] stats graphics  grDevices utils datasets  methods   base


 

Running R gui as administrator, however, the same path variable is
truncated:

 

 p - Sys.getenv(PATH)

 nchar(p)

PATH 

1024 

 sessionInfo()

R version 2.10.0 Patched (2009-11-23 r50548) 

i386-pc-mingw32 

 

locale:

[1] LC_COLLATE=English_United Kingdom.1252 

[2] LC_CTYPE=English_United Kingdom.1252   

[3] LC_MONETARY=English_United Kingdom.1252

[4] LC_NUMERIC=C   

[5] LC_TIME=English_United Kingdom.1252

 

attached base packages:

[1] stats graphics  grDevices utils datasets  methods   base


 

 

This may be related to
http://tolstoy.newcastle.edu.au/R/e6/devel/09/01/0259.html 

 

Keith Ponting

Aurix Ltd, Malvern WR14 3SZ  UK

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Kerning issues with CairoPDF

2009-11-26 Thread Karl Ove Hufthammer
Karl Ove Hufthammer wrote:

 I'm using CairoPDF to generate PDF (because of its font embedding and
 support for transparent colours). However, at least on my (Windows)
 system, the text it outputs seems to have completely wrong kerning.
 Here's an example:
 
 CairoPDF(test.pdf)
   plot(rnorm(100),xlab=Ovreset)
 dev.off()
 
 The v is (slightly) too far away from the O, it's much too close to the
 r, partially overlapping it, and the e is too far away from the s.

For the record, there are no problems with R 2.9.2 on my Mandriva Linux 2010 
system. But it’s a different font which gets embedded (Liberation Sans on 
Linux vs. Arial on Windows).

-- 
Karl Ove Hufthammer
E-mail: k...@huftis.org
Jabber: huf...@jabber.no

__
R-help@r-project.org 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] order of panels in xyplots

2009-11-26 Thread Peter Ehlers

You're right, Titus. I misunderstood. It looks like index.cond
has to be in 1:(number of panels being plotted for factor f).
While this can arguably be covered by the phrase valid indexing
vector, I agree that this could be made more explicit.

 -Peter Ehlers

Titus Malsburg wrote:

Peter, thanks for your response!  The problem is not how indexing
works, but rather the question what is being indexed here.  If I
understand the description correctly then it is wrong.  In the special
and common case where all possible levels do actually occur in the
data frame it coincidentally happens to work the way it is described
but not when the data frame contains only data points for some of the
levels.  Then it appears that the indexing vector has to be bound to
1:length(unique(f)) which is unequal 1:nlevels(f).  (f is a factor
here.)

  Titus

On Wed, Nov 25, 2009 at 10:32 PM, Peter Ehlers ehl...@ucalgary.ca wrote:

Titus Malsburg wrote:

The documentation of xyplot could be improved here.  It says:

 If 'index.cond' is a list, it has to be as long as the number of
conditioning
  variables, and the 'i'-th component has to be a valid indexing vector
for the
  integer vector '1:nlevels(g_i)' (which can, among other things, repeat
some
  of the levels or drop some altogether).

It should make explicit that nlevels is the number of levels actually
used in the data and not length(levels(f)).


It does say ... _valid_ indexing vector ... (my emphasis).
If nlevels(g) = 5, but you're only plotting 3 panels, it seems
to me that c(3,1,5) might be a valid indexing vector.

 -Peter Ehlers


Cheers,

  Titus

__
R-help@r-project.org 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@r-project.org 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] ow to have R automatically print traceback upon errors

2009-11-26 Thread Hao Cen
Hi Jim,

Thanks for your suggestion. It is working now. The earlier message  recover
called non-interactively;
 frames dumped, use debugger() to view happened within a R-IDE but doesn't
occur in a R console.

Jeff

-Original Message-
From: jim holtman [mailto:jholt...@gmail.com] 
Sent: Monday, November 23, 2009 11:00 PM
To: Hao Cen
Cc: r-help@r-project.org
Subject: Re: [R] ow to have R automatically print traceback upon errors

I use this:

options(error=utils::recover)

and anytime an error occurs in the interactive mode, it will print out
the traceback and then allow you to explore the variables at each
level of the stack; just like putting 'browser()' in the code at the
error point.

Here is what I get in running under Windows:

 x - function() xyz()  # non-existent function


 x()  # caa the function
Error in x() : could not find function xyz  == error message

Enter a frame number, or 0 to exit

1: x() == traceback

Selection: 0



On Mon, Nov 23, 2009 at 7:52 PM, Hao Cen h...@andrew.cmu.edu wrote:
 Hi,

 I wonder how to have R automatically print stack trace produced by
 traceback upon errors during interactive uses. I tried the suggestions on

http://old.nabble.com/Automatically-execute-traceback-when-execution-of-scri
pt-causes-error--td22368483.html#a22368775

 and used options(error = recover)
 options(showErrorCalls = T)

 It just produces an extra message like recover called non-interactively;
 frames dumped, use debugger() to view

 Thanks

 Jeff

 __
 R-help@r-project.org 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 that you are trying to solve?

__
R-help@r-project.org 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] makefile for sweave

2009-11-26 Thread Wolfgang Raffelsberger

Dear all,

I can't get texi2dvi working right. Basically I'd like to convert a .lex 
to .pdf without having to fiddle with the issue Sweave.sty not being in 
my current directory (as this was sugested in other posts on this list).


When I'm in the R-Gui I can get the help via
?texi2dvi
(So I conclude its installed.)

However, when I try to use it to concert a .tex to .pdf I get trouble ...

For example :
A)
The file test02.r contains :
Sweave(Sweave_test01.rnw)
library(tools)
texi2dvi(Sweave_test01.tex, pdf =T)

Now, when I run on the linux command line :
R --vanilla -q  test02.r

I get :
 Sweave(Sweave_test01.rnw)
Writing to file Sweave_test01.tex
Processing code chunks ...
1 : term hide (label=chunk_ini)
2 : term verbatim eps pdf (label=Fig01)
3 : term tex (label=packageVersionInfo)
Loading required package: xtable

You can now run LaTeX on 'Sweave_test01.tex'
 library(tools)
 texi2dvi(Sweave_test01.tex, pdf =T)
Error in texi2dvi(Sweave_test01.tex, pdf = T) :
 Running 'texi2dvi' on 'Sweave_test01.tex' failed.
Messages:
sh: texi2dvi: command not found
Execution halted


B)
In a previous message on this list I found the following command line(s) 
suggested, but I my case it won't work


star5_R_test_ R CMD texi2dvi --help
/usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found

similarly, when execute (as sugested) I get the same error message

star5_R_test_ R CMD texi2dvi -p Sweave_test01.tex
/usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found


I don't understand how can a command can be present (= installed) and 
still not being found as the error messages suggest ?


For completeness :
 sessionInfo()
R version 2.10.0 (2009-10-26)
x86_64-unknown-linux-gnu

locale:
[1] C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


other attached packages:
[1] xtable_1.5-6 mouse4302probe_2.5.0 AnnotationDbi_1.8.1
[4] mouse4302cdf_2.5.0   MASS_7.3-3   fdrtool_1.2.5  
[7] limma_3.2.1  affyPLM_1.22.0   preprocessCore_1.8.0
[10] gcrma_2.18.0 affy_1.24.2  Biobase_2.6.0  


loaded via a namespace (and not attached):
[1] Biostrings_2.14.3 DBI_0.2-4 IRanges_1.4.4 RSQLite_0.7-3   
[5] affyio_1.14.0 splines_2.10.0tools_2.10.0




Thank's in advance,
Wolfgang


Charles C. Berry a écrit :

On Tue, 8 Sep 2009, Welma Pereira wrote:

Hello, I have the following makefile. The problem is that the 
bibliography
doesn t work. Any help would be appreciated! I really don t don t 
what to

do..:-(



# The sources of the report (tex, Rnw and other files (e.g. bib, idx))
TEX_CMPS = Report problem
RNW_CMPS = prop1 prop2 ExeExps
OTHER =  Report.bib

# The name of the report to produce
all: Report.pdf

code: $(RNW_CMPS:=.R)

clean:
   rm -f  *.log *.dvi *~

# On what does the report depends?
Report.pdf: $(TEX_CMPS:=.tex) $(RNW_CMPS:=.tex) ${OTHER} makefile
   TEXINPUTS=${TPUTS} pdflatex $
   TEXINPUTS=${TPUTS} pdflatex $


IIRC

R CMD texi2dvi -p target.tex

takes care of finding sweave.sty and running latex thru all the 
iterations needed to build cross-references and a usable pdf.


Try

R CMD texi2dvi --help

at the shell prompt.

HTH,

Chuck



   rm *.log
#mv *.aux  $(dir $)

# How to build the tex files from the Rnw (Sweave) files
%.tex: %.Rnw
   echo library(utils); options(width=60);  Sweave('$') | ${R_PRG}
--no-save --vanilla
   mv $(notdir $*.tex)  $(dir $)


# How to build the R code files from the Rnw (Sweave) files
%.R: %.Rnw
   echo library(utils); Stangle('$') | ${R_PRG} --no-save --vanilla

%.bib:
   TEXINPUTS=${TPUTS} pdflatex $
   bibtex $

%.aux:
   TEXINPUTS=${TPUTS} pdflatex $
   bibtex $

%.idx:
   TEXINPUTS=${TPUTS} pdflatex $
   makeindex $

cheers!

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.



Charles C. Berry(858) 534-2098
Dept of Family/Preventive 
Medicine

E mailto:cbe...@tajo.ucsd.eduUC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 
92093-0901


__


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wolfgang Raffelsberger, PhD
Laboratoire de BioInformatique et Génomique Intégratives
IGBMC,  
1 rue Laurent Fries,  67404 Illkirch  Strasbourg,  France

Tel (+33) 388 65 3300 Fax (+33) 388 65 3276
wolfgang.raffelsberger (at) igbmc.fr

__
R-help@r-project.org 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] makefile for sweave

2009-11-26 Thread Sundar Dorai-Raj
Is texi2dvi in your PATH? What happens if you open a CMD window and
type texi2dvi at the prompt?

--sundar

On Thu, Nov 26, 2009 at 6:14 AM, Wolfgang Raffelsberger wr...@igbmc.fr wrote:
 Dear all,

 I can't get texi2dvi working right. Basically I'd like to convert a .lex to
 .pdf without having to fiddle with the issue Sweave.sty not being in my
 current directory (as this was sugested in other posts on this list).

 When I'm in the R-Gui I can get the help via
 ?texi2dvi
 (So I conclude its installed.)

 However, when I try to use it to concert a .tex to .pdf I get trouble ...

 For example :
 A)
 The file test02.r contains :
 Sweave(Sweave_test01.rnw)
 library(tools)
 texi2dvi(Sweave_test01.tex, pdf =T)

 Now, when I run on the linux command line :
 R --vanilla -q  test02.r

 I get :
 Sweave(Sweave_test01.rnw)
 Writing to file Sweave_test01.tex
 Processing code chunks ...
 1 : term hide (label=chunk_ini)
 2 : term verbatim eps pdf (label=Fig01)
 3 : term tex (label=packageVersionInfo)
 Loading required package: xtable

 You can now run LaTeX on 'Sweave_test01.tex'
 library(tools)
 texi2dvi(Sweave_test01.tex, pdf =T)
 Error in texi2dvi(Sweave_test01.tex, pdf = T) :
  Running 'texi2dvi' on 'Sweave_test01.tex' failed.
 Messages:
 sh: texi2dvi: command not found
 Execution halted


 B)
 In a previous message on this list I found the following command line(s)
 suggested, but I my case it won't work

 star5_R_test_ R CMD texi2dvi --help
 /usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found

 similarly, when execute (as sugested) I get the same error message

 star5_R_test_ R CMD texi2dvi -p Sweave_test01.tex
 /usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found


 I don't understand how can a command can be present (= installed) and still
 not being found as the error messages suggest ?

 For completeness :
 sessionInfo()
 R version 2.10.0 (2009-10-26)
 x86_64-unknown-linux-gnu

 locale:
 [1] C

 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base
 other attached packages:
 [1] xtable_1.5-6         mouse4302probe_2.5.0 AnnotationDbi_1.8.1
 [4] mouse4302cdf_2.5.0   MASS_7.3-3           fdrtool_1.2.5      [7]
 limma_3.2.1          affyPLM_1.22.0       preprocessCore_1.8.0
 [10] gcrma_2.18.0         affy_1.24.2          Biobase_2.6.0
 loaded via a namespace (and not attached):
 [1] Biostrings_2.14.3 DBI_0.2-4         IRanges_1.4.4     RSQLite_0.7-3
 [5] affyio_1.14.0     splines_2.10.0    tools_2.10.0



 Thank's in advance,
 Wolfgang


 Charles C. Berry a écrit :

 On Tue, 8 Sep 2009, Welma Pereira wrote:

 Hello, I have the following makefile. The problem is that the
 bibliography
 doesn t work. Any help would be appreciated! I really don t don t what to
 do..:-(



 # The sources of the report (tex, Rnw and other files (e.g. bib, idx))
 TEX_CMPS = Report problem
 RNW_CMPS = prop1 prop2 ExeExps
 OTHER =  Report.bib

 # The name of the report to produce
 all: Report.pdf

 code: $(RNW_CMPS:=.R)

 clean:
   rm -f  *.log *.dvi *~

 # On what does the report depends?
 Report.pdf: $(TEX_CMPS:=.tex) $(RNW_CMPS:=.tex) ${OTHER} makefile
   TEXINPUTS=${TPUTS} pdflatex $
   TEXINPUTS=${TPUTS} pdflatex $

 IIRC

    R CMD texi2dvi -p target.tex

 takes care of finding sweave.sty and running latex thru all the iterations
 needed to build cross-references and a usable pdf.

 Try

    R CMD texi2dvi --help

 at the shell prompt.

 HTH,

 Chuck


   rm *.log
 #    mv *.aux  $(dir $)

 # How to build the tex files from the Rnw (Sweave) files
 %.tex: %.Rnw
   echo library(utils); options(width=60);  Sweave('$') | ${R_PRG}
 --no-save --vanilla
   mv $(notdir $*.tex)  $(dir $)


 # How to build the R code files from the Rnw (Sweave) files
 %.R: %.Rnw
   echo library(utils); Stangle('$') | ${R_PRG} --no-save --vanilla

 %.bib:
   TEXINPUTS=${TPUTS} pdflatex $
   bibtex $

 %.aux:
   TEXINPUTS=${TPUTS} pdflatex $
   bibtex $

 %.idx:
   TEXINPUTS=${TPUTS} pdflatex $
   makeindex $

 cheers!

    [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


 Charles C. Berry                            (858) 534-2098
                                            Dept of Family/Preventive
 Medicine
 E mailto:cbe...@tajo.ucsd.edu                UC San Diego
 http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

 __

 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 Wolfgang Raffelsberger, PhD
 Laboratoire de BioInformatique et Génomique Intégratives
 IGBMC,  1 rue Laurent Fries,  67404 Illkirch  Strasbourg,  France
 Tel (+33) 388 65 3300         Fax (+33) 388 65 3276
 wolfgang.raffelsberger (at) igbmc.fr

 

Re: [R] questions on the ff package

2009-11-26 Thread Hao Cen
Hi Jens,

Thanks for your prompt and informative answers. ff is a fabulous package and
your suggestions helped me solve my problems at hands.

As I need to incrementally increase each of several large matrices (about
1000 rows *1 columns, 1000 matrices) by a row every day. I wonder how
efficiently it is to do the following command on a frequent basis.

nrow(matFF) - nrow(matFF)+1 

as far as I know for mmap, a fixed size of file is preallocated. I don't
know the ff implementation and how it handle file size changes. Does the
command in the line above preallocate, say 10% more space of the current
size so that no large file copying is needed each time the nrow is changed?



Another problem I am facing is that I have over 2000 large matrices that
need the help of ff. Suppose I have a list of 2000 ff objects. My computing
environment is 64bit linux, 64Gb mem. I remember there is some limitations
on the maximum of files that can be opened in linux. If I need to access
each matrix, would you think I can open each matrix and leave them open or I
need to close it after it is opened and used?

Thanks a lot

Jeff

-Original Message-
From: Jens Oehlschlägel [mailto:oehl_l...@gmx.de] 
Sent: Wednesday, November 25, 2009 8:04 AM
To: h...@andrew.cmu.edu
Cc: r-h...@lists.r-project.org
Subject: [R] questions on the ff package

Jeff,

 I need to save a matrix as a memory-mapped file and load it back later. 
 To save the matrix, I use
 mat = matrix(1:20, 4, 5)
 matFF = ff(mat, dim=dim(mat), filename=~/a.mat
 , overwrite=TRUE, dimnames = dimnames(mat))

# This stores the data in an ff file, 
# but not the metadata in R's ff object. 
# To do the latter you need to do 
save(matFF, file=~/matFF.RData)

# Assuming that your ff file remains in the same location, 
# in a new R session you simply 
load(file=~/matFF.RData)
# and the ff file is available automagically

 However, I don't always know the dimension when loading the matrix back.
 If I miss the dim attributes, ff will return it as vector. 
 Is there a way to load the matrix without specifying the dimension?

# You can create an ff object using your existing ff file by
matFF - ff(filename=~/a.mat, vmode=double, dim=c(4,5))

# You can do the same at unknown file size with 
matFF - ff(filename=~/a.mat, vmode=double)
# which gives you the length of the ff object
length(matFF)
# if you know the number of columns you can calculate the number of rows and
give your ff object the interpretation of a matrix
dim(matFF) - c(length(matFF)/5, 5)

 the matrix may grow in terms of the number of rows. 
 Is there an efficient way to do this?

# there are two ways to grow a matrix by rows

# 1) you create the matrix in major row order
matFF - ff(1:20, dim=c(4,5), dimorder=c(2:1))
# then you require a higher number of rows
nrow(matFF) - 6
# as you can see there are new empty rows in the file
matFF

# 2) Instead of a matrix you create a ffdf data.frame
#which you can also give more rows using nrow-
#An example of this is in read.table.ffdf
#which reads a csv file in chunks and extends the 
#number of rows in the ffdf

Jens Oehlschlägel

-- 
Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.!
http://portal.gmx.net/de/go/dsl02

__
R-help@r-project.org 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] Moving quantile()?

2009-11-26 Thread Rob Steele
Is there a faster way to get moving quantiles from a time series than to
run quantile() at each step in the series?

Thanks,
Rob

__
R-help@r-project.org 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] Best way to preallocate numeric NA array?

2009-11-26 Thread Rob Steele
These are the ways that occur to me.

## This produces a logical vector, which will get converted to a numeric
## vector the first time a number is assigned to it.  That seems
## wasteful.
x - rep(NA, n)

## This does the conversion ahead of time but it's still creating a
## logical vector first, which seems wasteful.
x - as.numeric(rep(NA, n))

## This avoids type conversion but still involves two assignments for
## each element in the vector.
x - numeric(n)
x[] - NA

## This seems reasonable.
x - rep(as.numeric(NA), n)

Comments?

Thanks,
Rob

__
R-help@r-project.org 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] analyse tab delimited textfile microarray data(help)

2009-11-26 Thread Martin Morgan
Kumar -- ask on the Bioconductor mailing list

   http://bioconductor.org/docs/mailList.html

see basic workflows at

  http://bioconductor.org/docs/workflows/oligoarrays/

You cannot analyze the data without understanding its source or
questions you are asking, so determine where this data is coming from
and what you are expected to do with it before posting.

Martin

kumar kk wrote:
 Hello
 I have microarray data in tab delimited text file.The main headers and some
 fields are as:
 following are the header:
 
 FEATURES FeatureNum Row Col SubTypeMask ControlType ProbeName
 SystematicName PositionX PositionY LogRatio LogRatioError
 PValueLogRatio gProcessedSignal rProcessedSignal gProcessedSigError
 rProcessedSigError gMedianSignal rMedianSignal gBGMedianSignal
 rBGMedianSignal gBGPixSDev rBGPixSDev gIsSaturated rIsSaturated
 gIsFeatNonUnifOL rIsFeatNonUnifOL gIsBGNonUnifOL rIsBGNonUnifOL
 gIsFeatPopnOL rIsFeatPopnOL gIsBGPopnOL rIsBGPopnOL IsManualFlag
 gBGSubSignal rBGSubSignal gIsPosAndSignif rIsPosAndSignif
 gIsWellAboveBG rIsWellAboveBG SpotExtentX gBGMeanSignal rBGMeanSignal
 
 
 
 following is the data corresponding to the above header :
 
 
 DATA 1 1 1 66 1 DarkCorner DarkCorner 379.607 199.729 -5.98E-01
 1.10E+00 5.86E-01 2.46E+00 6.21E-01 3.02E+00 1.51E+00 0 0 241 273
 1.35E+02 1.48E+02 0 0 0 0 0 0 0 0 0 0 0 16.0892 -4.46689 1 0 0 0 65
 135.479 148.517
 DATA 2 1 2 66 1 DarkCorner DarkCorner 405 199.545 -4.71E-01 1.27E+00
 7.11E-01 1.83E+00 6.20E-01 2.88E+00 1.55E+00 135 145.5 238 266
 1.31E+02 1.48E+02 0 0 0 0 0 0 0 0 0 0 0 12.0031 2.05821 1 0 0 0 65
 131.295 147.49
 DATA 3 1 3 66 1 DarkCorner DarkCorner 430.5 199.5 -2.62E-01 1.55E+00
 8.66E-01 1.13E+00 6.18E-01 2.66E+00 1.45E+00 128 142.5 237.5 270.5
 1.30E+02 1.47E+02 0 0 0 0 0 0 0 0 0 0 0 7.41805 -0.318846 1 0 0 0
 64.8204 130.996 148.231
 DATA 4 1 4 0 0 GT_MTB_142632 chr1:2567359-2567418 455.648 199.519
 1.89E-03 6.14E-02 9.75E-01 1.18E+03 1.18E+03 1.18E+02 1.18E+02 7776
 15813 231.5 266 1.29E+02 1.48E+02 0 0 0 0 0 0 0 0 0 0 0 7741.9 15324.2
 1 1 1 1 57.5363 129.226 148.004
 
 
 
 
 Please tell me how can we analyse this tab delimited text file of microarray
 data.
 Please tell me the procedure of analysis.
 
 thanks
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org 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.


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-help@r-project.org 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] Best way to preallocate numeric NA array?

2009-11-26 Thread Douglas Bates
On Thu, Nov 26, 2009 at 10:03 AM, Rob Steele
freenx.10.robste...@xoxy.net wrote:
 These are the ways that occur to me.

 ## This produces a logical vector, which will get converted to a numeric
 ## vector the first time a number is assigned to it.  That seems
 ## wasteful.
 x - rep(NA, n)

 ## This does the conversion ahead of time but it's still creating a
 ## logical vector first, which seems wasteful.
 x - as.numeric(rep(NA, n))

 ## This avoids type conversion but still involves two assignments for
 ## each element in the vector.
 x - numeric(n)
 x[] - NA

 ## This seems reasonable.
 x - rep(as.numeric(NA), n)

 Comments?

My intuition would be to go with the third method (allocate a numeric
vector then assign NA to its contents) but I haven't tested the
different.  In fact, it would be difficult to see differences in, for
example, execution time unless n was very large.

This brings up a different question which is, why do you want to
consider this?  Are you striving for readability, for speed, for low
memory footprint, for efficiency in some other way?  When we were
programming in S on machines with 1 mips processors and a couple of
megabytes of memory, such considerations were important.  I'm not sure
they are quite as important now.

__
R-help@r-project.org 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] Missing and number of days

2009-11-26 Thread Val
Hi all,



Assume  that I have a  data set (“xcv”) with several  variables  and some of
the variables have a missing observation  represented by -9 as shown below.
 I want to exclude these observations from the analysis ( as a NA).  Is
there a command that I can do it for the entire data set rather than one by
one for each variable ( tmp - xcv[xcv$v1 != -9, ])



  V1 v2 v3 v4

1123  14  -9

12-9  21   3

 -9   30  41  25

 15   07 -9  10



 and I want the results as follows



  V1v2 v3  v4

11   2314 NA

   12   NA21  3

   NA   3041 25

15 07   NA10





The second question is I want to calculate the number of days between two
dates

Start   end number of days

2002062620020805 40

2003010120030421 110



How do I do it in R?


Thanks in advance

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Best way to preallocate numeric NA array?

2009-11-26 Thread Henrique Dallazuanna
You can try this also:

rep(NA_integer_, 10)

On Thu, Nov 26, 2009 at 2:03 PM, Rob Steele
freenx.10.robste...@xoxy.net wrote:
 These are the ways that occur to me.

 ## This produces a logical vector, which will get converted to a numeric
 ## vector the first time a number is assigned to it.  That seems
 ## wasteful.
 x - rep(NA, n)

 ## This does the conversion ahead of time but it's still creating a
 ## logical vector first, which seems wasteful.
 x - as.numeric(rep(NA, n))

 ## This avoids type conversion but still involves two assignments for
 ## each element in the vector.
 x - numeric(n)
 x[] - NA

 ## This seems reasonable.
 x - rep(as.numeric(NA), n)

 Comments?

 Thanks,
 Rob

 __
 R-help@r-project.org 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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

__
R-help@r-project.org 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] Testing for strength of fit using R

2009-11-26 Thread David Winsemius


On Nov 26, 2009, at 9:48 AM, Steve Murray wrote:



Dear all,

I am trying to validate a model by comparing simulated output values  
against observed values. I have produced a simple X-y scatter plot  
with a 1:1 line, so that the closer the points fall to this line,  
the better the 'fit' between the modelled data and the observation  
data.


I am now attempting to quantify the strength of this fit by using a  
statistical test in R. I am no statistics guru, but from my limited  
understanding, I suspect that I need to use the Chi Squared test (I  
am more than happy to be corrected on this though!).


However, this results in the following:



chisq.test(data$Simulation,data$Observation)


Pearson's Chi-squared test

data:  data$Simulation and data$Observation
X-squared = 567, df = 550, p-value = 0.2989

Warning message:
In chisq.test(data$Simulation, data$Observation) :
  Chi-squared approximation may be incorrect


The ?chisq.test document suggests that the objects should be of  
vector or matrix format, so I tried the following, but still receive  
a warning message (and different results):



chisq.test(as.matrix(data[,4:5]))


Pearson's Chi-squared test

data:  as.matrix(data[, 4:5])
X-squared = 130.8284, df = 26, p-value = 6.095e-16


When you look at your data you see only 27 cases, so it would be  
implausible that your first invocation with a degree of freedom = 550  
would be giving you something meaningful. The second one might have  
been more meaningful goodness of fit. I cannot explain why code # 1  
did not give the same results since I would have thought that the  
positional matching of R would have resulted in the same results for  
both calls. What happens if you try:


chisq.test(data$Simulation, y=data$Observation)  # ?

All of that being said, chisq.test is primarily intended for  
contingency tables. Testing association between two paired continuous  
variables is usually approached with regression and correlation tests.  
E.g.:


?cor
?lm

Also may want to look at the Q-Q plot.

?qqplot

--
David Winsemius





Warning message:
In chisq.test(as.matrix(data[, 4:5])) :
  Chi-squared approximation may be incorrect



What am I doing wrong and how can I successfully measure how well  
the simulated values fit the observed values?



If it's of any help, here are how my data are structured - note that  
I am only using columns 4 and 5 (Observation and Simulation).



str(data)

'data.frame':27 obs. of  5 variables:
 $ Location: Factor w/ 27 levels Australia,Brazil,..: 8  
2 13 19 22 14 16 23 6 7 ...
 $ Vegetation  : Factor w/ 21 levels Beech,Broadleaf  
evergreen laurel,..: 17 21 2 16 15 16 9 16 3 4 ...
 $ Vegetation.Class: Factor w/ 4 levels Boreal and Temperate  
Evergreen,..: 3 3 4 1 1 1 4 1 4 1 ...
 $ Observation : num  24 8.9 14.7 26.7 42.4 31.7 30.8 7.5 14  
22 ...
 $ Simulation  : num  33.9 7.8 9.74 7.6 11.8 10.7 12 28.1 1.7  
1.7 ...



I hope someone is able to point me in the right direction.

Many thanks,



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] Best way to preallocate numeric NA array?

2009-11-26 Thread Henrique Dallazuanna
Or best:

rep(NA_real_, 10)

On Thu, Nov 26, 2009 at 2:31 PM, Henrique Dallazuanna www...@gmail.com wrote:
 You can try this also:

 rep(NA_integer_, 10)

 On Thu, Nov 26, 2009 at 2:03 PM, Rob Steele
 freenx.10.robste...@xoxy.net wrote:
 These are the ways that occur to me.

 ## This produces a logical vector, which will get converted to a numeric
 ## vector the first time a number is assigned to it.  That seems
 ## wasteful.
 x - rep(NA, n)

 ## This does the conversion ahead of time but it's still creating a
 ## logical vector first, which seems wasteful.
 x - as.numeric(rep(NA, n))

 ## This avoids type conversion but still involves two assignments for
 ## each element in the vector.
 x - numeric(n)
 x[] - NA

 ## This seems reasonable.
 x - rep(as.numeric(NA), n)

 Comments?

 Thanks,
 Rob

 __
 R-help@r-project.org 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.




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

__
R-help@r-project.org 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] mcp.area vs. kernel.area Output... ?

2009-11-26 Thread T.D.Rudolph

I am trying to estimate home range size using 2 different methods in the
adehabitat package, but I am slightly confounded by the results.

## Attached is an R object file containing animal relocations with a field
for id, and x  y coordinates ## (in metres)
load(temp)
require(adehabitat)

## This produces the 95% Minimum Convex Polygon area for animal 2002007
mcp.area(xy=temp[,2:3], id=temp$id, percent=95, unin=m, unout=km2,
plotit=FALSE)[1] 

## This produces an estimation of area under the 95% Fixed Kernel Density
kernel.area(temp[,2:3], temp$id, h=href, levels=95, unin=m,
unout=km2)[1]

Now my question: Why are the two responses not more similar?  

Since the kernel estimation is more conservative, why is the area obtained
by this method more than two times bigger than what is obtained using the
Minimum Convex Polygon method?

Tyler

http://old.nabble.com/file/p26531917/temp temp 
-- 
View this message in context: 
http://old.nabble.com/mcp.area-vs.-kernel.area-Output...---tp26531917p26531917.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Missing and number of days

2009-11-26 Thread R Help
For your first question, I believe that

dat[dat==-9]=NA

should do the trick

For your second, are you dates in the Date() format?  If not, try ?Date

Once you get them in Date format, then you can simply subtract them
 d1 = as.Date('20090604',format=%Y%m%d)
d2 = as.Date('20080604',format=%Y%m%d)
d1-d2
Time difference of 365 days

On Thu, Nov 26, 2009 at 12:30 PM, Val valkr...@gmail.com wrote:
 Hi all,



 Assume  that I have a  data set (“xcv”) with several  variables  and some of
 the variables have a missing observation  represented by -9 as shown below.
  I want to exclude these observations from the analysis ( as a NA).  Is
 there a command that I can do it for the entire data set rather than one by
 one for each variable ( tmp - xcv[xcv$v1 != -9, ])



      V1 v2 v3 v4

 11    23  14  -9

 12    -9  21   3

     -9   30  41  25

     15   07 -9  10



  and I want the results as follows



      V1    v2     v3      v4

 11       23    14     NA

       12   NA    21      3

       NA   30    41     25

        15     07   NA    10





 The second question is I want to calculate the number of days between two
 dates

    Start           end                 number of days

 20020626    20020805             40

 20030101    20030421             110



 How do I do it in R?


 Thanks in advance

        [[alternative HTML version deleted]]


 __
 R-help@r-project.org 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@r-project.org 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] different fits for geese and geeglm in geepack?

2009-11-26 Thread Achaz von Hardenberg
Dear all,

I am trying to fit a GEE model on eagle productivity (number of  
hatched offspring per nest) using the geeglm function in the library  
geepack and I found an odd result.
My understanding is that the function geese and geeglm should give the  
same fits, as actually geeglm uses geese to fit the model, providing a  
glm style output.
However, if I fit the same model with geeglm and geese I get slightly  
different estimates of the parameters. Most striking  is the  
difference between the estimates of the correlation parameter where  
the differences are huge:
(geese: alpha= -0.0727, se= 0.0608; geeglm:  -0.219, se=  0.091).

Anybody knows why this is like that and which of the two I should  
rather trust? (I attach the outputs of the two models at the end of  
this mail)

thanks a lot for your hints!

Achaz von Hardenberg

PS:
One more question actually: anybody has got some code to calculate the  
QICu values to compare GEE models with and without specific fixed  
factors using geepack?

##
GEESE OUTPUT:

Call:
geese(formula = PROD ~ as.factor(clas3) + Twinter + Tprecova,
id = Nterr, waves = anno, data = aquile.dat2, family = poisson,
corstr = ar1)

Mean Model:
Mean Link: log
Variance to Mean Relation: poisson

Coefficients:
  estimate san.se  waldp
(Intercept)-1.7850 0.3661 23.77 1.08e-06
as.factor(clas3)2   0.7165 0.2475  8.38 3.79e-03
as.factor(clas3)3   0.5052 0.3368  2.25 1.34e-01
Twinter-0.1066 0.0464  5.28 2.16e-02
Tprecova   -0.0549 0.0368  2.22 1.36e-01

Scale Model:
Scale Link:identity

Estimated Scale Parameters:
estimate san.se waldp
(Intercept)0.764  0.123 38.6 5.17e-10

Correlation Model:
Correlation Structure: ar1
Correlation Link:  identity

Estimated Correlation Parameters:
  estimate san.se wald p
alpha  -0.0727 0.0608 1.43 0.232

Returned Error Value:0
Number of clusters:   21   Maximum cluster size: 20

###
GEEGLM OUTPUT:

Call:
geeglm(formula = PROD ~ as.factor(clas3) + Twinter + Tprecova,
family = poisson, data = aquile.dat2, id = Nterr, waves = anno,
corstr = ar1)

Coefficients:
  Estimate Std.err  Wald Pr(|W|)
(Intercept)-1.7992  0.3751 23.01  1.6e-06 ***
as.factor(clas3)2   0.7412  0.2623  7.99   0.0047 **
as.factor(clas3)3   0.5253  0.3335  2.48   0.1152
Twinter-0.1083  0.0473  5.24   0.0220 *
Tprecova   -0.0483  0.0354  1.86   0.1721
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Estimated Scale Parameters:
Estimate Std.err
(Intercept)0.773   0.117

Correlation: Structure = ar1  Link = identity

Estimated Correlation Parameters:
  Estimate Std.err
alpha   -0.219   0.091
Number of clusters:   21   Maximum cluster size: 20


Dr. Achaz von Hardenberg

Centro Studi Fauna Alpina - Alpine Wildlife Research Centre
Servizio Sanitario e della Ricerca Scientifica
Parco Nazionale Gran Paradiso, Degioz, 11, 11010-Valsavarenche (Ao),  
Italy

Present address:
National Centre for Statistical Ecology
School of Mathematics, Statistics and Actuarial Science,
University of Kent,  Canterbury, UK

E-mail: achaz.hardenb...@pngp.it
 fa...@pngp.it
Skype: achazhardenberg
Mobile: +44.(0)783.266.5995
Dr. Achaz von Hardenberg

Centro Studi Fauna Alpina - Alpine Wildlife Research Centre
Servizio Sanitario e della Ricerca Scientifica
Parco Nazionale Gran Paradiso, Degioz, 11, 11010-Valsavarenche (Ao),  
Italy

Present address:
National Centre for Statistical Ecology
School of Mathematics, Statistics and Actuarial Science,
University of Kent,  Canterbury, UK

E-mail: achaz.hardenb...@pngp.it
 fa...@pngp.it
Skype: achazhardenberg
Mobile: +44.(0)783.266.5995






[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Best way to preallocate numeric NA array?

2009-11-26 Thread Rob Steele
Douglas Bates wrote:
 On Thu, Nov 26, 2009 at 10:03 AM, Rob Steele
 freenx.10.robste...@xoxy.net wrote:
 These are the ways that occur to me.

 ## This produces a logical vector, which will get converted to a numeric
 ## vector the first time a number is assigned to it.  That seems
 ## wasteful.
 x - rep(NA, n)

 ## This does the conversion ahead of time but it's still creating a
 ## logical vector first, which seems wasteful.
 x - as.numeric(rep(NA, n))

 ## This avoids type conversion but still involves two assignments for
 ## each element in the vector.
 x - numeric(n)
 x[] - NA

 ## This seems reasonable.
 x - rep(as.numeric(NA), n)

 Comments?
 
 My intuition would be to go with the third method (allocate a numeric
 vector then assign NA to its contents) but I haven't tested the
 different.  In fact, it would be difficult to see differences in, for
 example, execution time unless n was very large.
 
 This brings up a different question which is, why do you want to
 consider this?  Are you striving for readability, for speed, for low
 memory footprint, for efficiency in some other way?  When we were
 programming in S on machines with 1 mips processors and a couple of
 megabytes of memory, such considerations were important.  I'm not sure
 they are quite as important now.
 

Thanks--good questions.  For any code, I'd order the requirements like this:

1) Correct
2) Readable
3) Space efficient
4) Time efficient

Compromises are sometimes necessary.  R is such an odd language that it
really helps readability to settle on easily recognizable idioms.
That's true in any language where there's more than one way to do things
but I find it especially true in R.  I agree that the efficiency of this
operation only matters with very large vectors or very many repetitions.

__
R-help@r-project.org 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] Does nargin and nargout work with R functions?

2009-11-26 Thread Jason Rupert
I am porting some MATLAB functions over to R and hopefully into a package, so I 
am curious if nargin and nargout work with R functions.

Here is kind of an example of where I need to head in order to port 
control-1.0.11 from Octave over to R.  The Octave control-1.0.11 package 
has the capability to produce bode plots of transfer functions.  I hope to post 
this package once the port over to R is complete.

Thanks again for all the feedback and insights. 

bode-function(sys, w, outputs, inputs, plot_style)
{

# ...

if (nargin  1 || nargin  5)
{
print(This works)
}

if (nargout  1)
{
   print(This also works) 
}

return(list(mag_r, phase_r, w_r))

}

__
R-help@r-project.org 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] Best way to preallocate numeric NA array?

2009-11-26 Thread Rob Steele
Douglas Bates wrote:
 On Thu, Nov 26, 2009 at 10:03 AM, Rob Steele
 freenx.10.robste...@xoxy.net wrote:
 These are the ways that occur to me.

 ## This produces a logical vector, which will get converted to a numeric
 ## vector the first time a number is assigned to it.  That seems
 ## wasteful.
 x - rep(NA, n)

 ## This does the conversion ahead of time but it's still creating a
 ## logical vector first, which seems wasteful.
 x - as.numeric(rep(NA, n))

 ## This avoids type conversion but still involves two assignments for
 ## each element in the vector.
 x - numeric(n)
 x[] - NA

 ## This seems reasonable.
 x - rep(as.numeric(NA), n)

 Comments?
 
 My intuition would be to go with the third method (allocate a numeric
 vector then assign NA to its contents) but I haven't tested the
 different.  In fact, it would be difficult to see differences in, for
 example, execution time unless n was very large.
 
 This brings up a different question which is, why do you want to
 consider this?  Are you striving for readability, for speed, for low
 memory footprint, for efficiency in some other way?  When we were
 programming in S on machines with 1 mips processors and a couple of
 megabytes of memory, such considerations were important.  I'm not sure
 they are quite as important now.
 

Thanks--good questions.  For any code, I'd order the requirements like this:

1) Correct
2) Readable
3) Space efficient
4) Time efficient

Compromises are sometimes necessary.  R is such an odd language that it
really helps readability to settle on easily recognizable idioms.
That's true in any language where there's more than one way to do things
but I find it especially true in R.  I agree that the efficiency of this
operation only matters with very large vectors or very many repetitions.

__
R-help@r-project.org 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] Testing for strength of fit using R

2009-11-26 Thread Peter Ehlers


Steve Murray wrote:

Dear all,

I am trying to validate a model by comparing simulated output values against 
observed values. I have produced a simple X-y scatter plot with a 1:1 line, so 
that the closer the points fall to this line, the better the 'fit' between the 
modelled data and the observation data.

I am now attempting to quantify the strength of this fit by using a statistical 
test in R. I am no statistics guru, but from my limited understanding, I 
suspect that I need to use the Chi Squared test (I am more than happy to be 
corrected on this though!).

However, this results in the following:



chisq.test(data$Simulation,data$Observation)


Pearson's Chi-squared test

data:  data$Simulation and data$Observation 
X-squared = 567, df = 550, p-value = 0.2989


Warning message:
In chisq.test(data$Simulation, data$Observation) :
  Chi-squared approximation may be incorrect


The ?chisq.test document suggests that the objects should be of vector or 
matrix format, so I tried the following, but still receive a warning message 
(and different results):


chisq.test(as.matrix(data[,4:5]))


Pearson's Chi-squared test

data:  as.matrix(data[, 4:5]) 
X-squared = 130.8284, df = 26, p-value = 6.095e-16


Warning message:
In chisq.test(as.matrix(data[, 4:5])) :
  Chi-squared approximation may be incorrect



What am I doing wrong and how can I successfully measure how well the simulated 
values fit the observed values?


If it's of any help, here are how my data are structured - note that I am only 
using columns 4 and 5 (Observation and Simulation).


str(data)

'data.frame':27 obs. of  5 variables:
 $ Location: Factor w/ 27 levels Australia,Brazil,..: 8 2 13 19 22 
14 16 23 6 7 ...
 $ Vegetation  : Factor w/ 21 levels Beech,Broadleaf evergreen 
laurel,..: 17 21 2 16 15 16 9 16 3 4 ...
 $ Vegetation.Class: Factor w/ 4 levels Boreal and Temperate Evergreen,..: 3 
3 4 1 1 1 4 1 4 1 ...
 $ Observation : num  24 8.9 14.7 26.7 42.4 31.7 30.8 7.5 14 22 ...
 $ Simulation  : num  33.9 7.8 9.74 7.6 11.8 10.7 12 28.1 1.7 1.7 ...


The chisquare test is not the right thing here. You may have
been fooled by the goodness-of-fit phrase associated with
the test.

I would do a cor.test(). But if the above is the real data,
then there probably isn't much to test; you have very little
agreement for the first 10 pairs.

 -Peter Ehlers



I hope someone is able to point me in the right direction.

Many thanks,

Steve



 		 	   		  
_

Have more than one Hotmail account? Link them together to easily access both
 http://clk.atdmt.com/UKM/go/186394591/direct/01/
__
R-help@r-project.org 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@r-project.org 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] Save workspace with ff objects

2009-11-26 Thread Yue Sheng
Hi All,

My script generates a mixture of normal and ff objects. I need to run the
script for different parameter settings. Very often I would like to save the
workspace for each parameter setting, so that I can get back to it later on.
Is there an easy way to do this, instead of needing to save individual ff
objects separately? I've tried the naive way of just saving the workspace,
only to find that ff objects are empty.

Thanks for help.

Yue Sheng

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Does nargin and nargout work with R functions?

2009-11-26 Thread baptiste auguie
Hi,

I think you can use match.call() to retrieve the number of arguments
passed to a function (see below), but I don't think nargout makes
sense in R like it does in Matlab.

foo - function(...){

  print(match.call())
  nargin - length(as.list(match.call())) -1
  print(nargin)
}

foo(a=1, b=2)
foo()
foo(1:3, a=2, c=3)

HTH,

baptiste

2009/11/26 Jason Rupert jasonkrup...@yahoo.com:
 I am porting some MATLAB functions over to R and hopefully into a package, so 
 I am curious if nargin and nargout work with R functions.

 Here is kind of an example of where I need to head in order to port 
 control-1.0.11 from Octave over to R.  The Octave control-1.0.11 package 
 has the capability to produce bode plots of transfer functions.  I hope to 
 post this package once the port over to R is complete.

 Thanks again for all the feedback and insights.

 bode-function(sys, w, outputs, inputs, plot_style)
 {

 # ...

 if (nargin  1 || nargin  5)
 {
        print(This works)
 }

 if (nargout  1)
 {
       print(This also works)
 }

 return(list(mag_r, phase_r, w_r))

 }

 __
 R-help@r-project.org 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@r-project.org 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 shall one present LRT test statistic in a scientific journal ?

2009-11-26 Thread JVezilier

Hello !!

I'm recently having a debate with my PhD supervisor regarding how to write
the result of a likelihood ratio test in an article I'm about to submit.

I analysed my data using lme mixed modelling.

To get some p-values for my fixed effect I used model simplification and the
typical output R gives looks like this:

model2 = update ( model1,~.-factor A) 
anova (model1, model2)

   Model df   AIC BIC logLik Test
L.Ratio p-value
model 1 1 26  -78.73898   15.29707 65.36949
model 2 2 20  -73.70539   -1.36997 56.85270   1 vs 217.03359 
0.0092 
 
I thought about presenting it very simply copying/pasting R table and
writing it like: factor A had a significant effect on the response variable
(Likelihood ratio test, L-ratio = 17.033, p = 0.0092)

But my boss argued that it's too unusual (at least in our field of
evolutionary biology) and that I should present instead the LR statistic
together with the corresponding Chi^2 statistic since the likelihood ratio
is almost distributed like a Chi2 (df1-df2), and then write down the p-value
corresponding to this value of Chi.

I looked up in the current litterature but cannot really find a proper
answer to that dilmena.

So, dear evolutionary biologists R users, how would you present it ?

Thank you very much,
Julien.
-- 
View this message in context: 
http://old.nabble.com/How-shall-one-present-LRT-test-statistic-in-a-scientific-journal---tp26532480p26532480.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Grouped Boxplot

2009-11-26 Thread Gary
Thanks Petr!

On Thu, Nov 26, 2009 at 12:31 AM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 r-help-boun...@r-project.org napsal dne 24.11.2009 18:44:43:

  Back in March Soren Vogel asked exactly the same thing:
 
  Here is the solution that was offered then. (He offered a dataset as
  requested in the Posting Guide.)  ... with only a minor adjustment:
 
  g - rep.int(c(A, B, C, D), 125)
  t - rnorm(5000)
  a - sample(t, 500, replace=TRUE)
  b - sample(t, 500, replace=TRUE)
  dta - data.frame(val = sample(t,1000), g = gl(4, 250, labels=c(A,
  B, C, D)) , G2 = gl(2,1, labels=c(XX, YY)))
  boxplot( val ~ g + G2, data=dta, at = 0.8*c(1,2,3,4,6,7,8,9),
  boxwex=0.8)
 
  This should have shown up with this:
 
  RSiteSearch(grouped boxplot)

 or ggplot2 variant

 p - ggplot(dta, aes(factor(G2), val))
 p + geom_boxplot(aes(fill = factor(g)))

 Regards
 Petr


 
  --
  David
 
  On Nov 24, 2009, at 10:35 AM, Gary wrote:
 
   Thanks Uwe and Petr for your suggestion. Please see Fig. 3 on the
   attached
   file. Thanks!
  
   On Tue, Nov 24, 2009 at 6:44 AM, Petr PIKAL petr.pi...@precheza.cz
   wrote:
  
   Hi
  
   try ggplot2. It has some functionality to make groups of boxplots.
  
   Regards
   Petr
  
  
   Your attachment did not pass the list's filters. Anyway, see ?boxplot.
  
   Uwe Ligges
  
  
  
  
   r-help-boun...@r-project.org napsal dne 24.11.2009 03:33:49:
  
   Hi R Users,
  
   I'm interested in plotting a grouped boxplot (please see attached
   file
   for
   sample). Can anyone suggest a function{package} which can help me
   achieve
   this.
  
   Thanks,
   Gary
   __
   R-help@r-project.org 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.
  
  
   GroupedBoxplot.pdf__
   R-help@r-project.org 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 Winsemius, MD
  Heritage Laboratories
  West Hartford, CT
 
  __
  R-help@r-project.org 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@r-project.org 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 shall one present LRT test statistic in a scientific journal ?

2009-11-26 Thread David Winsemius


On Nov 26, 2009, at 12:14 PM, JVezilier wrote:



Hello !!

I'm recently having a debate with my PhD supervisor regarding how to  
write
the result of a likelihood ratio test in an article I'm about to  
submit.


I analysed my data using lme mixed modelling.

To get some p-values for my fixed effect I used model simplification  
and the

typical output R gives looks like this:

model2 = update ( model1,~.-factor A)
anova (model1, model2)

  Model df   AIC BIC logLik Test
L.Ratio p-value
model 1 1 26  -78.73898   15.29707 65.36949
model 2 2 20  -73.70539   -1.36997 56.85270   1 vs 2 
17.03359

0.0092

I thought about presenting it very simply copying/pasting R table and
writing it like: factor A had a significant effect on the response  
variable

(Likelihood ratio test, L-ratio = 17.033, p = 0.0092)

But my boss argued that it's too unusual (at least in our field of
evolutionary biology) and that I should present instead the LR  
statistic
together with the corresponding Chi^2 statistic since the likelihood  
ratio
is almost distributed like a Chi2 (df1-df2), and then write down the  
p-value

corresponding to this value of Chi.

I looked up in the current litterature but cannot really find a proper
answer to that dilmena.

So, dear evolutionary biologists R users, how would you present it ?


I am not an evolutionary biologist, but presumably your supervisor is  
one. Why are you picking a fight not only with him but with your  
prospective audience when there is no meaningful difference? Here is  
the p-value you would get with his method:


 1-pchisq( 2*(65.36949 -  56.85270), df=6)
[1] 0.009160622

--
David Winsemius, just a guy who formerly argued about such matters.





Thank you very much,
Julien.
--
View this message in context: 
http://old.nabble.com/How-shall-one-present-LRT-test-statistic-in-a-scientific-journal---tp26532480p26532480.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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: Beanplots calculating wrong average

2009-11-26 Thread Michael Hopgood
Hi Tom,

Thank you for the friendly and informative answer.  It does explain a lot of
things, actually.  As with any good answer, it inevitably leads to other
questions.  In the first place, I need the arithmetic mean.  It's what we
base our calculations on...

My code is currently this:

Metall-c(Cu,Cu,Cu,Cu,Cu,Cu,Cu,Cu,Cu,Cr,Cr,Cr,Cr,
Cr,Cr,Cr,Cr,Cr,As,As,As,As,As,As,As,As,As,Pb,P
b,Pb,Pb,Pb,Pb,Pb,Pb,Pb,Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn
,Zn)
Halt-c(85,13,13,340,18,13,88,24,12,216,33,21,454,20,18,88,30,21,1254,22,4.2
,1081,35,6,1772,192,7.6,43,20,12,3107,21,12,30,24,19,1109,57,46,269,68,50,58
5,131,52)
beanplot(Halt~Metall, log = y, yaxt = n, ylab=Halt
(mg/kg),cex.lab=1.2)
axis(2,c(1,10,100,1000,1))
polygon(c(0.2966510,0.2966510,1.4832033,1.4832033,3.6160162,3.6160162,4.4921
444,4.4921444,5.6968371,5.6968371),c(2.763021e-01,10,10,80,80,40,40,250,250,
2.763021e-01),col=#66FF0090, border=#66FF0090)
text(5.58,10,KM, cex=1.2, font=2)
polygon(c(0.2966510,0.29665101,1.4832033,1.4832033),c(10,25,25,10),col=#FFF
F0090,border=#0090)

polygon(c(1.4832033,1.4832033,2.5027348,2.5027348,3.6160162,3.6160162,4.4921
444,4.4921444,5.6968371,5.6968371,4.4921444,4.4921444,3.6160162,3.6160162,1.
4832033),c(80,150,150,200,200,400,400,500,500,250,250,40,40,80,80),col=#FFF
F0090,border=#0090)
text(5.54,350,MKM, cex=1.2, font=2)
polygon(c(0.2966510,0.2966510,5.6968371,5.6968371,4.4921444,4.4921444,3.6160
162,3.6160162,2.5027348,2.5027348,1.4832033,1.4832033),c(25,30085.997183,300
85.997183,500,500,400,400,200,200,150,150,25),col=#FF90,border=#FF000
090)
text(5.54,2500,MKM, cex=1.2, font=2)


The polygons convey information on whether each sample is higher than the
soil guideline value.  If I take away, the log scale, the vast difference in
values obscures the polygons...  Ideally I'd like the average beanline to be
the arithmetic mean or to be gone altogether. Can't seem to make beanplot do
this...

Sincerely,
Michael Hopgood 





-Ursprungligt meddelande-
Från: Tom Wainwright [mailto:thomas.wainwri...@noaa.gov] 
Skickat: den 24 november 2009 18:43
Till: Michael Hopgood
Kopia: r-help@r-project.org
Ämne: Re: [R] Help: Beanplots calculating wrong average

Hi Michael,

Looking at the help for beanplot(), note that the 'log' option defaults to 
'auto' which means the function will automatically log-transform data like 
yours.  This also implies that the mean it shows is the geometric mean, not
the 
arithmetic mean.  As you note, the transformation doesn't affect the median.

If you don't want this behavior, I think setting log= will do the trick.

Hope this helps.

Tom Wainwright

On 11/24/2009 03:52 AM, Michael Hopgood wrote:
 Hi there,

 I have a set of data that looks like this:

 As1988-c(1254.0, 22.0, 4.2, 1081.0, 35.0, 6.0, 1772.0,  192.0,  7.6)

 The mean of this (as calculated by R) is: 485.9778

 The median of this (as calculated by R) is:  35



 If I then make a beanplot(As1988), I find that the beanline (average) is
now
 77.68561 while the beanline (median) is 35.39739 (using the locator
function
 to check the graph and log axis).



 While I can understand the small discrepancy of the median(mouse hovering
 over the line), I am at a loss to explain the huge difference between the
 means. Is this a flaw in the package or is there something I am missing?



 My gut feeling is that the log scales are affecting the calculations
 somehow.



 Sincerely,

 Michael Hopgood




   [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


-- 
Tom Wainwright
NOAA Northwest Fisheries Science Center
Newport, Oregon
~~~
The contents of this message are mine personally and do not necessarily
reflect any position of the Government or the National Oceanic and
Atmospheric Administration.
~~~

__
R-help@r-project.org 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] Export kde object as shapefile

2009-11-26 Thread T.D.Rudolph

I am trying to estimate home range size using the plug-in method with kernel
density estimation in the kernel smoothing (ks) package.  Unless there is
another way I am not familiar with, in order to calculate spatial area under
the space I need to convert my kde () object into a spatial object somehow
in order to calculate its spatial area.  Could someone demonstrate how this
might be done?
-- 
View this message in context: 
http://old.nabble.com/Export-kde-object-as-shapefile-tp26532782p26532782.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 shall one present LRT test statistic in a scientific journal ?

2009-11-26 Thread Peter Dalgaard
David Winsemius wrote:
 
 On Nov 26, 2009, at 12:14 PM, JVezilier wrote:
 

 Hello !!

 I'm recently having a debate with my PhD supervisor regarding how to
 write
 the result of a likelihood ratio test in an article I'm about to submit.

 I analysed my data using lme mixed modelling.

 To get some p-values for my fixed effect I used model simplification
 and the
 typical output R gives looks like this:

 model2 = update ( model1,~.-factor A)
 anova (model1, model2)

   Model df   AIC BIC logLik Test
 L.Ratio p-value
 model 1 1 26  -78.73898   15.29707 65.36949
 model 2 2 20  -73.70539   -1.36997 56.85270   1 vs 217.03359
 0.0092

 I thought about presenting it very simply copying/pasting R table and
 writing it like: factor A had a significant effect on the response
 variable
 (Likelihood ratio test, L-ratio = 17.033, p = 0.0092)

 But my boss argued that it's too unusual (at least in our field of
 evolutionary biology) and that I should present instead the LR statistic
 together with the corresponding Chi^2 statistic since the likelihood
 ratio
 is almost distributed like a Chi2 (df1-df2), and then write down the
 p-value
 corresponding to this value of Chi.

 I looked up in the current litterature but cannot really find a proper
 answer to that dilmena.

 So, dear evolutionary biologists R users, how would you present it ?
 
 I am not an evolutionary biologist, but presumably your supervisor is
 one. Why are you picking a fight not only with him but with your
 prospective audience when there is no meaningful difference? Here is the
 p-value you would get with his method:
 
 1-pchisq( 2*(65.36949 -  56.85270), df=6)
 [1] 0.009160622
 

As I understood the question, it *is* purely formalistic. I.e., what to
write, not what to do.

I'd say L-ratio is plain wrong, since this is not a ratio, but the log
of a ratio. -2lnQ or -2logQ is what my old teachers would write, but
pragmatically, I'd expect the best chances with editors and reviewers to
be LRT: chi-square=17.03, df=6, p=0.092, possibly with LRT spelled
out. (Some journals like to have the df because it allows reviewers to
catch glaring mistakes like categorical variables treated as numeric.)

-- 
   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
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
R-help@r-project.org 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] makefile for sweave

2009-11-26 Thread Duncan Murdoch

On 26/11/2009 9:14 AM, Wolfgang Raffelsberger wrote:

Dear all,

I can't get texi2dvi working right. Basically I'd like to convert a .lex 
to .pdf without having to fiddle with the issue Sweave.sty not being in 
my current directory (as this was sugested in other posts on this list).


When I'm in the R-Gui I can get the help via
?texi2dvi
(So I conclude its installed.)
  


Bad conclusion.  That tells you that the R function texi2dvi() is 
installed.  That function tries to run the system level command 
texi2dvi; that's the part that is failing.  As Sundar said, this may 
just be because you don't have your PATH set to include the directory 
it's in.


Duncan Murdoch

However, when I try to use it to concert a .tex to .pdf I get trouble ...

For example :
A)
The file test02.r contains :
Sweave(Sweave_test01.rnw)
library(tools)
texi2dvi(Sweave_test01.tex, pdf =T)

Now, when I run on the linux command line :
R --vanilla -q  test02.r

I get :
  Sweave(Sweave_test01.rnw)
Writing to file Sweave_test01.tex
Processing code chunks ...
 1 : term hide (label=chunk_ini)
 2 : term verbatim eps pdf (label=Fig01)
 3 : term tex (label=packageVersionInfo)
Loading required package: xtable

You can now run LaTeX on 'Sweave_test01.tex'
  library(tools)
  texi2dvi(Sweave_test01.tex, pdf =T)
Error in texi2dvi(Sweave_test01.tex, pdf = T) :
  Running 'texi2dvi' on 'Sweave_test01.tex' failed.
Messages:
sh: texi2dvi: command not found
Execution halted


B)
In a previous message on this list I found the following command line(s) 
suggested, but I my case it won't work


star5_R_test_ R CMD texi2dvi --help
/usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found

similarly, when execute (as sugested) I get the same error message

star5_R_test_ R CMD texi2dvi -p Sweave_test01.tex
/usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found


I don't understand how can a command can be present (= installed) and 
still not being found as the error messages suggest ?


For completeness :
  sessionInfo()
R version 2.10.0 (2009-10-26)
x86_64-unknown-linux-gnu

locale:
[1] C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


other attached packages:
 [1] xtable_1.5-6 mouse4302probe_2.5.0 AnnotationDbi_1.8.1
 [4] mouse4302cdf_2.5.0   MASS_7.3-3   fdrtool_1.2.5  
 [7] limma_3.2.1  affyPLM_1.22.0   preprocessCore_1.8.0
[10] gcrma_2.18.0 affy_1.24.2  Biobase_2.6.0  


loaded via a namespace (and not attached):
[1] Biostrings_2.14.3 DBI_0.2-4 IRanges_1.4.4 RSQLite_0.7-3   
[5] affyio_1.14.0 splines_2.10.0tools_2.10.0




Thank's in advance,
Wolfgang


Charles C. Berry a écrit :
 On Tue, 8 Sep 2009, Welma Pereira wrote:

 Hello, I have the following makefile. The problem is that the 
 bibliography
 doesn t work. Any help would be appreciated! I really don t don t 
 what to

 do..:-(



 # The sources of the report (tex, Rnw and other files (e.g. bib, idx))
 TEX_CMPS = Report problem
 RNW_CMPS = prop1 prop2 ExeExps
 OTHER =  Report.bib

 # The name of the report to produce
 all: Report.pdf

 code: $(RNW_CMPS:=.R)

 clean:
rm -f  *.log *.dvi *~

 # On what does the report depends?
 Report.pdf: $(TEX_CMPS:=.tex) $(RNW_CMPS:=.tex) ${OTHER} makefile
TEXINPUTS=${TPUTS} pdflatex $
TEXINPUTS=${TPUTS} pdflatex $

 IIRC

 R CMD texi2dvi -p target.tex

 takes care of finding sweave.sty and running latex thru all the 
 iterations needed to build cross-references and a usable pdf.


 Try

 R CMD texi2dvi --help

 at the shell prompt.

 HTH,

 Chuck


rm *.log
 #mv *.aux  $(dir $)

 # How to build the tex files from the Rnw (Sweave) files
 %.tex: %.Rnw
echo library(utils); options(width=60);  Sweave('$') | ${R_PRG}
 --no-save --vanilla
mv $(notdir $*.tex)  $(dir $)


 # How to build the R code files from the Rnw (Sweave) files
 %.R: %.Rnw
echo library(utils); Stangle('$') | ${R_PRG} --no-save --vanilla

 %.bib:
TEXINPUTS=${TPUTS} pdflatex $
bibtex $

 %.aux:
TEXINPUTS=${TPUTS} pdflatex $
bibtex $

 %.idx:
TEXINPUTS=${TPUTS} pdflatex $
makeindex $

 cheers!

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


 Charles C. Berry(858) 534-2098
 Dept of Family/Preventive 
 Medicine

 E mailto:cbe...@tajo.ucsd.eduUC San Diego
 http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 
 92093-0901


 __
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Wolfgang Raffelsberger, PhD
Laboratoire de BioInformatique et Génomique Intégratives
IGBMC,  
1 

Re: [R] How shall one present LRT test statistic in a scientific journal ?

2009-11-26 Thread David Winsemius


On Nov 26, 2009, at 12:46 PM, Peter Dalgaard wrote:


David Winsemius wrote:


On Nov 26, 2009, at 12:14 PM, JVezilier wrote:



Hello !!

I'm recently having a debate with my PhD supervisor regarding how to
write
the result of a likelihood ratio test in an article I'm about to  
submit.


I analysed my data using lme mixed modelling.

To get some p-values for my fixed effect I used model simplification
and the
typical output R gives looks like this:

model2 = update ( model1,~.-factor A)
anova (model1, model2)

 Model df   AIC BIC logLik Test
L.Ratio p-value
model 1 1 26  -78.73898   15.29707 65.36949
model 2 2 20  -73.70539   -1.36997 56.85270   1 vs 2 
17.03359

0.0092

I thought about presenting it very simply copying/pasting R table  
and

writing it like: factor A had a significant effect on the response
variable
(Likelihood ratio test, L-ratio = 17.033, p = 0.0092)

But my boss argued that it's too unusual (at least in our field of
evolutionary biology) and that I should present instead the LR  
statistic

together with the corresponding Chi^2 statistic since the likelihood
ratio
is almost distributed like a Chi2 (df1-df2), and then write down the
p-value
corresponding to this value of Chi.

I looked up in the current litterature but cannot really find a  
proper

answer to that dilmena.

So, dear evolutionary biologists R users, how would you present it ?


I am not an evolutionary biologist, but presumably your supervisor is
one. Why are you picking a fight not only with him but with your
prospective audience when there is no meaningful difference? Here  
is the

p-value you would get with his method:


1-pchisq( 2*(65.36949 -  56.85270), df=6)

[1] 0.009160622



As I understood the question, it *is* purely formalistic. I.e., what  
to

write, not what to do.

I'd say L-ratio is plain wrong, since this is not a ratio, but the  
log
of a ratio. -2lnQ or -2logQ is what my old teachers would write,  
but
pragmatically, I'd expect the best chances with editors and  
reviewers to

be LRT: chi-square=17.03, df=6, p=0.092, possibly with LRT spelled
out. (Some journals like to have the df because it allows reviewers to
catch glaring mistakes like categorical variables treated as numeric.)


I wonder about the phrase used model simplification. Wouldn't that  
raise a question about the proper degrees of freedom to use? If terms  
were dropped from the model based simply on the basis of non- 
significance shouldn't there be some appropriate penalization of  
subsequent tests of significance?


--
David.



--
  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
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45)  
35327907




David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Hi R Users,

I'm trying to plot a stacked barplot. Here is data:

Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1

I'm using following R code:

library(lattice)
dta-read.table(data.txt, header=TRUE, row.names=Sample)
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,
auto.key=list(space=right,
title=names(dimnames(dta))[2])
)

Above code is working fine, but I need help with:

1) Legend boxes have default colors, whereas I'm looking them to match with
barplot colors (col=2:4).
2) Can I increase scale for y axis, like currently it plotting -2,0,2,4,...
I would like it as -2,-1,0,1,...

Any help would be greatly appreciated,

Thanks,
Peng

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Export kde object as shapefile

2009-11-26 Thread David Winsemius


On Nov 26, 2009, at 12:40 PM, T.D.Rudolph wrote:



I am trying to estimate home range size using the plug-in method  
with kernel
density estimation in the kernel smoothing (ks) package.  Unless  
there is
another way I am not familiar with, in order to calculate spatial  
area under
the space I need to convert my kde () object into a spatial object  
somehow
in order to calculate its spatial area.  Could someone demonstrate  
how this

might be done?


Can you explain what you mean by spatial area under the space or  
what it is for which you think there is a well defined area in a  
ks:::kde object? (Some example data would, as always, be welcome.)




--
View this message in context: 
http://old.nabble.com/Export-kde-object-as-shapefile-tp26532782p26532782.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] Export kde object as shapefile

2009-11-26 Thread T.D.Rudolph

Can you explain what you mean by spatial area under the space or  
what it is for which you think there is a well defined area in a  
ks:::kde object? 

My knowledge is not extensive in this area but I am aware that kernel
methods can be used to estimate home range size.  The function kernel.area
in the adehabitat package, for example, produces a spatial area I interpret
as being equivalent to estimated home range size using one of two possible
smoothing parameters.  I would like to use the plug-in method because I am
convinced it will serve me best, but the ks package doesn't have a simple
option like kde.area that produces what I'm looking for. 

 Some example data would, as always, be welcome.

Attached is an example subset of my data.  I've only gotten so far as to
produce the kde object and explore potential solutions.

tmp.Hpi-Hpi(x=temp[,2:3])
tmp.kde-kde(x=temp[,2:3], H=tmp.Hpi)

Tyler

http://old.nabble.com/file/p26533942/temp temp 


David Winsemius wrote:
 
 
 On Nov 26, 2009, at 12:40 PM, T.D.Rudolph wrote:
 

 I am trying to estimate home range size using the plug-in method  
 with kernel
 density estimation in the kernel smoothing (ks) package.  Unless  
 there is
 another way I am not familiar with, in order to calculate spatial  
 area under
 the space I need to convert my kde () object into a spatial object  
 somehow
 in order to calculate its spatial area.  Could someone demonstrate  
 how this
 might be done?
 
 Can you explain what you mean by spatial area under the space or  
 what it is for which you think there is a well defined area in a  
 ks:::kde object? (Some example data would, as always, be welcome.)
 
 
 -- 
 View this message in context:
 http://old.nabble.com/Export-kde-object-as-shapefile-tp26532782p26532782.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org 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 Winsemius, MD
 Heritage Laboratories
 West Hartford, CT
 
 __
 R-help@r-project.org 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.
 
 

-- 
View this message in context: 
http://old.nabble.com/Export-kde-object-as-shapefile-tp26532782p26533942.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Insert elements into a vector in a defined positions

2009-11-26 Thread Manuel Ramon

That's good . Your solution works for me.
Than you Rolf.



Rolf Turner-3 wrote:
 
 
 On 26/11/2009, at 10:46 AM, Manuel Ramon wrote:
 

 Dear R users,
 I have a vector of length n and I want to insert some elements (in  
 my case
 the NA string) into a defined positions. For example, my vector is  
 z1 and I
 want to add NA's in positions 4, 6 y 7 so after that, my new  
 vector, z2,
 should have a length of 10+3.

   z1 - 1:10
   id - c(4,6,7)

   # And z2 should be:
   z2 - c(1,2,3,NA,4,5,NA,NA,6,7,8,9,10)

 Anyone knows how can I do that?
 
 At first I thought append() might work ... but the after
 argument to append seems to have to be of length 1.
 
 How about:
 
   z2 - numeric(length(z1)+length(id))
   z2[id] - NA
   z2[!is.na(z2)] - z1
 
 A bit kludgy, but it appears to work.
 
   cheers,
 
   Rolf Turner
 
 ##
 Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
 
 __
 R-help@r-project.org 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.
 
 


-
Manuel Ramón Fernández
Group of Reproductive Biology (GBR)
University of Castilla-La Mancha (Spain)
mra...@jccm.es
-- 
View this message in context: 
http://old.nabble.com/Insert-elements-into-a-vector-in-a-defined-positions-tp26520841p26532643.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Feature request for as.Date() function

2009-11-26 Thread nabble . 30 . miller_2555
On Thu, Nov 26, 2009 at 12:08 AM, jim holtman - jholt...@gmail.com
+nabble+miller_2555+9dc9649aca.jholtman#gmail@spamgourmet.com
wrote:
 An easy way is just to write your own function that will accept NA,
 convert it to NA and then call as.Date.


I have written such a function, which has provided the temporary
workaround mentioned. ( I am not that lazy yet :-) )

 R is a functional language, so write some functions.  Don't try to
 overload existing functions with new options that may break a lot of
 existing code.  If you have special requirements, then adapt your code
 to them.  You would probably have to wait around for a long time
 before an new option got in, so it is easier to create your own.

I do not mind waiting for the additional functionality (and it is no
longer an immediate need given the workaround). I was attempting to
contribute to the continued enhancement of an open source project.
Since the as.Date() function already defines standard unambiguous
formats, and since NA (and NaN, Inf, etc) are not ambiguous
within the transform to their numeric counterparts, it stands to
reason that this is logical behaviour of this function.

I also doubt this enhancement would break moderate-to-well-designed code since:
 (1) Existing code would enact a stop() condition based on the
current implementation, forcing error-handling, if any.
 (2) Converting NA (and NaN, inf, etc) is not ambiguous.
Coders feeding such strings should expect their numeric counterparts.
In all likelihood, coders would convert these strings manually in
error-handling code anyway.

I have my solution, but wanted to better the project for use by other
community members. The R Core Development Team is welcome to accept or
ignore the suggestion. I do appreciate the time to discuss this topic,
but will consider the matter closed for my part.

Thanks.

__
R-help@r-project.org 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] rattle(): unable to load shared library

2009-11-26 Thread Graham Williams
Sometimes I've seen this under MS/Windows and the solution has been to
reinstall the gtk libraries independent of R and to make sure this is the
one installed:
http://downloads.sourceforge.net/gladewin32/gtk-2.12.9-win32-2.exe. It looks
like glade was not in the gtk libraries you installed?  Hope that helps.

Regards,
Graham


2009/11/26 Matthieu Stigler matthieu.stig...@gmail.com

 Hi

 I'm trying to install the rattle GUI on winwos 2000, with last version R
 2.10.

 I had a first problem using the rattle package, as it was asking pkg
 XMl, which is no more in the CRAN repo. I instead simply install in
 R/libraries the XML pkg from:
 http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.10/

 Maybe I mised something here... So now I was able to run the
 library(rattle)
 then, using:
 rattle()

 I have following error message, it wants to install GTK+, what I do,
 restart R but then it does not work and I have following error
 message:

 
 Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared library
 'C:/Programme/R/R-2.10.0/library/RGtk2/libs/RGtk2.dll':
  LoadLibrary failure:  Die angegebene Prozedur wurde nicht gefunden.


 Failed to load RGtk2 dynamic library, attempting to install it.
 Learn more about GTK+ at http://www.gtk.org
 If the package still does not load, please ensure that GTK+ is
 installed and that it is on your PATH environment variable
 IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
 Error in .Call(name, ..., PACKAGE = PACKAGE) :
  C symbol name S_glade_xml_new not in DLL for package RGtk2
 Rattle timestamp (for the error above): 2009-11-25 17:47:50
 
 Checked for the install of GTK+, it's on the disk, and even on the
 PATH... don't know what I should do... any idea?

 Thanks!!

 Matthieu Stigler


[[alternative HTML version deleted]]

__
R-help@r-project.org 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 --- different properties of lines corresponding to type=c(l, a) respectively

2009-11-26 Thread Kjetil Halvorsen
I think the subject says it all. I want to make a simple lattice plot,
using xyplot with the
argument type=c(l,a).
The problem then is that in the resulting plot it is
difficult/impossible to see which plot corresponds to the average
and which to the individual profiles. I triedthings like extra
arguments  lwd=c(1,3)   or   col=c(blue,red)
hoping this would be interpreteded parallely to the type=  argument,
but no.  Like:

xyplot(response ~ time|group, repa0, groups=~Participant, type=c(b,
a), lwd=c(1, 3),
   ylim=c(0, 10))

and many other variants ...

Then I vent for writing my own panel functions:
mypanel - function(x, y, ..., type){
panel.average(x, y, ...,  horizontal=FALSE)
panel.xyplot(x, y, ..., type=type)
  }
xyplot(response ~ time|group, repa0, groups=~Participant, type=l,
ylim=c(0, 10),
   panel=panel.superpose, panel.groups=mypanel)

(which doesn't work)
???
Kjetil Halvorsen
To recreate the data:

repa0 -
structure(list(group = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L), .Label = c(1, 2), class = factor),
Participant = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L), time = c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L), response = c(2L,
10L, 8L, 4L, 0L, 4L, 10L, 2L, 3L, 4L, 1L, 2L, 3L, 3L, 5L,
2L, 10L, 3L, 0L, 3L, 10L, 1L, 7L, 3L, 2L, 10L, 8L, 5L, 8L,
0L, 10L, 2L, 0L, 2L, 10L, 10L, 3L, 2L, 10L, 4L, 6L, 0L, 5L,
0L, 6L, 2L, 0L, 2L, 10L, 5L, 3L, 2L, 6L, 4L, 5L, 0L, 5L,
0L, 5L, 0L, 0L, 0L, 10L, 0L, 0L, 2L, 5L, 0L, 5L, 0L, 3L,
8L, 6L, 1L, 3L, 0L, 5L, 4L, 10L, 0L, 3L, 3L, 6L, 5L, 2L,
0L, 2L, 0L, 4L, 0L, 5L, 4L, 5L, 1L, 0L, 2L, 0L, 5L, 3L, 1L,
8L, 2L, 4L, 0L, 0L, 0L, 10L, 4L, 3L, 0L, 0L, 10L, 3L, 3L,
6L, 1L, 4L, 0L, 0L, 0L, 10L, 3L, 3L, 2L, 2L, 10L, 2L, 3L,
5L, 0L, 1L, 0L, 0L, 0L, 10L, 2L, 3L, 2L, 0L, 6L)), .Names = c(group,
Participant, time, response), row.names = c(1.1, 2.1,
3.1, 4.1, 5.1, 6.1, 7.1, 8.1, 9.1, 10.1, 11.1,
12.1, 13.1, 14.1, 1.2, 2.2, 3.2, 4.2, 5.2, 6.2,
7.2, 8.2, 9.2, 10.2, 11.2, 12.2, 13.2, 14.2,
1.3, 2.3, 3.3, 4.3, 5.3, 6.3, 7.3, 8.3, 9.3,
10.3, 11.3, 12.3, 13.3, 14.3, 1.4, 2.4, 3.4,
4.4, 5.4, 6.4, 7.4, 8.4, 9.4, 10.4, 11.4, 12.4,
13.4, 14.4, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5,
8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 1.11,
2.11, 3.11, 4.11, 5.11, 6.11, 7.11, 8.11, 9.11,
10.11, 11.11, 12.11, 13.11, 14.11, 1.21, 2.21,
3.21, 4.21, 5.21, 6.21, 7.21, 8.21, 9.21, 10.21,
11.21, 12.21, 13.21, 14.21, 1.31, 2.31, 3.31, 4.31,
5.31, 6.31, 7.31, 8.31, 9.31, 10.31, 11.31, 12.31,
13.31, 14.31, 1.41, 2.41, 3.41, 4.41, 5.41, 6.41,
7.41, 8.41, 9.41, 10.41, 11.41, 12.41, 13.41, 14.41,
1.51, 2.51, 3.51, 4.51, 5.51, 6.51, 7.51, 8.51,
9.51, 10.51, 11.51, 12.51, 13.51, 14.51), class = data.frame)

__
R-help@r-project.org 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] Has anyone had success with RGTK2/rattle and windows 7 64-bit?

2009-11-26 Thread Graham Williams
I don't have a Windows 7 to test this on yet - works on Vista and XP. Did
you install the GTK libraries (separately to R)?

Regards,
Graham


2009/11/21 Tetrick, Scott scott.tetr...@intel.com

 I have been unable to get rattle to run in my new Windows7-64 bit
 configuration.  For wither Rgtk2 or rattle, I get an error:

 Entry point not found

 The procedure entry point g_assetion_message_expr could not be located in
 the dynamic link library libglib-2.0-0.dll.

 Any help is really appreciated.

 __
 R-help@r-project.org 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@r-project.org 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] different fits for geese and geeglm in geepack?

2009-11-26 Thread Søren Højsgaard
It looks strange. If you send me data for a small reproducible example then 
I'll look into the issue. 
Regards
Søren


Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne 
af Achaz von Hardenberg [achaz.hardenb...@gmail.com]
Sendt: 26. november 2009 17:17
Til: r-help@r-project.org
Emne: [R] different fits for geese and geeglm in geepack?

Dear all,

I am trying to fit a GEE model on eagle productivity (number of
hatched offspring per nest) using the geeglm function in the library
geepack and I found an odd result.
My understanding is that the function geese and geeglm should give the
same fits, as actually geeglm uses geese to fit the model, providing a
glm style output.
However, if I fit the same model with geeglm and geese I get slightly
different estimates of the parameters. Most striking  is the
difference between the estimates of the correlation parameter where
the differences are huge:
(geese: alpha= -0.0727, se= 0.0608; geeglm:  -0.219, se=  0.091).

Anybody knows why this is like that and which of the two I should
rather trust? (I attach the outputs of the two models at the end of
this mail)

thanks a lot for your hints!

Achaz von Hardenberg

PS:
One more question actually: anybody has got some code to calculate the
QICu values to compare GEE models with and without specific fixed
factors using geepack?

##
GEESE OUTPUT:

Call:
geese(formula = PROD ~ as.factor(clas3) + Twinter + Tprecova,
id = Nterr, waves = anno, data = aquile.dat2, family = poisson,
corstr = ar1)

Mean Model:
Mean Link: log
Variance to Mean Relation: poisson

Coefficients:
  estimate san.se  waldp
(Intercept)-1.7850 0.3661 23.77 1.08e-06
as.factor(clas3)2   0.7165 0.2475  8.38 3.79e-03
as.factor(clas3)3   0.5052 0.3368  2.25 1.34e-01
Twinter-0.1066 0.0464  5.28 2.16e-02
Tprecova   -0.0549 0.0368  2.22 1.36e-01

Scale Model:
Scale Link:identity

Estimated Scale Parameters:
estimate san.se waldp
(Intercept)0.764  0.123 38.6 5.17e-10

Correlation Model:
Correlation Structure: ar1
Correlation Link:  identity

Estimated Correlation Parameters:
  estimate san.se wald p
alpha  -0.0727 0.0608 1.43 0.232

Returned Error Value:0
Number of clusters:   21   Maximum cluster size: 20

###
GEEGLM OUTPUT:

Call:
geeglm(formula = PROD ~ as.factor(clas3) + Twinter + Tprecova,
family = poisson, data = aquile.dat2, id = Nterr, waves = anno,
corstr = ar1)

Coefficients:
  Estimate Std.err  Wald Pr(|W|)
(Intercept)-1.7992  0.3751 23.01  1.6e-06 ***
as.factor(clas3)2   0.7412  0.2623  7.99   0.0047 **
as.factor(clas3)3   0.5253  0.3335  2.48   0.1152
Twinter-0.1083  0.0473  5.24   0.0220 *
Tprecova   -0.0483  0.0354  1.86   0.1721
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Estimated Scale Parameters:
Estimate Std.err
(Intercept)0.773   0.117

Correlation: Structure = ar1  Link = identity

Estimated Correlation Parameters:
  Estimate Std.err
alpha   -0.219   0.091
Number of clusters:   21   Maximum cluster size: 20


Dr. Achaz von Hardenberg

Centro Studi Fauna Alpina - Alpine Wildlife Research Centre
Servizio Sanitario e della Ricerca Scientifica
Parco Nazionale Gran Paradiso, Degioz, 11, 11010-Valsavarenche (Ao),
Italy

Present address:
National Centre for Statistical Ecology
School of Mathematics, Statistics and Actuarial Science,
University of Kent,  Canterbury, UK

E-mail: achaz.hardenb...@pngp.it
 fa...@pngp.it
Skype: achazhardenberg
Mobile: +44.(0)783.266.5995
Dr. Achaz von Hardenberg

Centro Studi Fauna Alpina - Alpine Wildlife Research Centre
Servizio Sanitario e della Ricerca Scientifica
Parco Nazionale Gran Paradiso, Degioz, 11, 11010-Valsavarenche (Ao),
Italy

Present address:
National Centre for Statistical Ecology
School of Mathematics, Statistics and Actuarial Science,
University of Kent,  Canterbury, UK

E-mail: achaz.hardenb...@pngp.it
 fa...@pngp.it
Skype: achazhardenberg
Mobile: +44.(0)783.266.5995






[[alternative HTML version deleted]]
__
R-help@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers



Peng Cai wrote:

Hi R Users,

I'm trying to plot a stacked barplot. Here is data:

Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1

I'm using following R code:

library(lattice)
dta-read.table(data.txt, header=TRUE, row.names=Sample)
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,
auto.key=list(space=right,
title=names(dimnames(dta))[2])
)

Above code is working fine, but I need help with:

1) Legend boxes have default colors, whereas I'm looking them to match with
barplot colors (col=2:4).

replace the line

 col = 2:4,

with

 par.settings = simpleTheme(col = 2:4),


2) Can I increase scale for y axis, like currently it plotting -2,0,2,4,...
I would like it as -2,-1,0,1,...

add the line

 scales = list(y = list(at = -2:8)),

or whatever tick locations you prefer.

 -Peter Ehlers



Any help would be greatly appreciated,

Thanks,
Peng

[[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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] Moving quantile()?

2009-11-26 Thread Charles C. Berry

On Thu, 26 Nov 2009, Rob Steele wrote:


Is there a faster way to get moving quantiles from a time series than to
run quantile() at each step in the series?



Yes.

Run

help.request()

Since you have already done the first 4 items below (right?) you will 
answer 'y', but when you get to the fifth one (which you evidently have 
not done), you will have to answer 'n'.




Checklist:
Have you read the posting guide? (y/n) y
Have you checked the FAQ? (y/n) y
Have you checked An Introduction to R? (y/n) y
Have you checked the NEWS of the latest development release? (y/n) y
Have you looked on RSiteSearch? (y/n) n



This will start a browser with the RSiteSearch URL loaded.

Now comes the tricky part --- you have to type something into the 'Query' 
box and then click on 'Search'. Perhaps


moving quantiles

will work??

It did for me, and the function I found by that strategy seems to be 
faster than


apply(embed(x[1:1],100),1,quantile,.75)

by about 3 orders of magnitude.

HTH,

Chuck



Thanks,
Rob

__
R-help@r-project.org 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.



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@r-project.org 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 code to combine random forest and glm

2009-11-26 Thread Sharma, Dhruv
Hi,
 is it possible to have r code which runs random forests and takes the top 7 
variables based on variable importance and builds a model of trying 
interactions terms for each variable.  Then builds 7 models and keeps the one 
with the lowest aic.

this would be like a new form of step wise regression using random forests with 
interaction terms.

any code help would be much appreciated.
thanks

Dhruv



[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Concave hull

2009-11-26 Thread Ted Harding
Raising a rather general question here.

This is a tantalising discussion, but the notion of concave hull
strikes me as extremely ill-defined!

I'd like to see statement of what it is (generically) supposed to be.
The examples discussed so far seem to rely on a person's inner
feelings of what it is supposed to be.

Consider the following simple example (where I have drawn a concave
hull by hand, using sentimental criteria).

set.seed(54321)
X - c(-1+rnorm(10),1+rnorm(10))
Y - rnorm(20)
plot(X,Y,pch=+,col=blue,xlim=c(-4,4),ylim=c(-3,3))
for(i in (1:20)) text(X[i]+0.150,Y[i],i,cex=0.25)
## Find their convex hull:
ix0 - chull(X,Y) ; n - length(CH.ix0)
ix1 - c(ix0,ix0[1]) # close it
lines(X[ix1],Y[ix1],col=green)
## Draw a concave hull:
concix - c(19,18,8,16,11,1,3,2,4,7,15,5,10,9,14,13,20,12,17,19)
lines(X[concix],Y[concix],col=red)


I have deliberately left the single point 6 dangling, since
I am agonising over the choice between:

[A] Leaving it as it is, as in interior point, on the grounds
that the resulting concave hull boundary is fairly smooth;

[B] Inserting it between c( ... ,2,4,7,6,15, ... ), which is
the least uncomfortable of the two obvious possibilities;

[C] Inserting it between c( ... ,2,4,6,7,15, ... ), which is
the more uncomfortsable of the two onvious possibilities.

Can someone provide counselling for me? I am hearing too many
voices about this!

Should I have tried to be less inclusive?

Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 26-Nov-09   Time: 20:52:03
-- XFMail --

__
R-help@r-project.org 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] {ggplot2} Adding Mean to (grouped) Boxplot.

2009-11-26 Thread Peng Cai
Hi R Users,

I am using following R code to plot a grouped boxplot. I'm hoping if I can
add MEAN to these boxplots. Data is copied below and attached as text file.

install.packages(ggplot2)
library(ggplot2)
dta-read.table(Sample.txt,header=T)
attach(dta)
p - ggplot(dta, aes(factor(month), nail))
p + geom_boxplot(aes(fill = factor(trt)))

Data:
month nail trt
6 7.2 1
12 9.3 1
0 5.8 1
1 6 1
2 6.5 1
3 7 1
6 9.1 1
12 7.9 1
0 3.3 1
1 4.9 1
2 1.4 2
3 2.7 2
6 3.7 2
12 9.4 2
0 3.1 2
1 2.7 2
2 5.4 2
3 8.3 2
6 12.3 2
12 17.7 2

Any help would be greatly appreciated,

Thanks,
Peng
month nail trt
6 7.2 1
12 9.3 1
0 5.8 1
1 6 1
2 6.5 1
3 7 1
6 9.1 1
12 7.9 1
0 3.3 1
1 4.9 1
2 1.4 2
3 2.7 2
6 3.7 2
12 9.4 2
0 3.1 2
1 2.7 2
2 5.4 2
3 8.3 2
6 12.3 2
12 17.7 2
__
R-help@r-project.org 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 shall one present LRT test statistic in a scientific journal ?

2009-11-26 Thread Frank E Harrell Jr

David Winsemius wrote:


On Nov 26, 2009, at 12:46 PM, Peter Dalgaard wrote:


David Winsemius wrote:


On Nov 26, 2009, at 12:14 PM, JVezilier wrote:



Hello !!

I'm recently having a debate with my PhD supervisor regarding how to
write
the result of a likelihood ratio test in an article I'm about to 
submit.


I analysed my data using lme mixed modelling.

To get some p-values for my fixed effect I used model simplification
and the
typical output R gives looks like this:

model2 = update ( model1,~.-factor A)
anova (model1, model2)

 Model df   AIC BIC logLik Test
L.Ratio p-value
model 1 1 26  -78.73898   15.29707 65.36949
model 2 2 20  -73.70539   -1.36997 56.85270   1 vs 2
17.03359

0.0092

I thought about presenting it very simply copying/pasting R table and
writing it like: factor A had a significant effect on the response
variable
(Likelihood ratio test, L-ratio = 17.033, p = 0.0092)

But my boss argued that it's too unusual (at least in our field of
evolutionary biology) and that I should present instead the LR 
statistic

together with the corresponding Chi^2 statistic since the likelihood
ratio
is almost distributed like a Chi2 (df1-df2), and then write down the
p-value
corresponding to this value of Chi.

I looked up in the current litterature but cannot really find a proper
answer to that dilmena.

So, dear evolutionary biologists R users, how would you present it ?


I am not an evolutionary biologist, but presumably your supervisor is
one. Why are you picking a fight not only with him but with your
prospective audience when there is no meaningful difference? Here is the
p-value you would get with his method:


1-pchisq( 2*(65.36949 -  56.85270), df=6)

[1] 0.009160622



As I understood the question, it *is* purely formalistic. I.e., what to
write, not what to do.

I'd say L-ratio is plain wrong, since this is not a ratio, but the log
of a ratio. -2lnQ or -2logQ is what my old teachers would write, but
pragmatically, I'd expect the best chances with editors and reviewers to
be LRT: chi-square=17.03, df=6, p=0.092, possibly with LRT spelled
out. (Some journals like to have the df because it allows reviewers to
catch glaring mistakes like categorical variables treated as numeric.)


I wonder about the phrase used model simplification. Wouldn't that 
raise a question about the proper degrees of freedom to use? If terms 
were dropped from the model based simply on the basis of 
non-significance shouldn't there be some appropriate penalization of 
subsequent tests of significance?


Absolutely.  At the least, the unbiased estimate of sigma^2 from the 
fullest model fit should be inserted into sigma^2 for the model used. 
More severe corrections are probably warranted though.


Frank





--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@r-project.org 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] Concave hull

2009-11-26 Thread baptiste auguie
2009/11/26 Ted Harding ted.hard...@manchester.ac.uk:
 Raising a rather general question here.

 This is a tantalising discussion, but the notion of concave hull
 strikes me as extremely ill-defined!

 I'd like to see statement of what it is (generically) supposed to be.

I'm curious too, but I can imagine the following definition,

Consider a sphere (n-dimensional maybe) that we let come in contact
with the scatter of points from outside. The set of points that the
sphere can attain may define unambiguously (I think) a concave hull,
for a specified sphere radius. The convex hull is obtained in the
limit of infinite radius (plane).

It's probably not exactly this, but I guess that's the rough idea.

Just a thought,

baptiste

__
R-help@r-project.org 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] Barplot with confidence intervals

2009-11-26 Thread Jonhnny Weslley
I have a file in the following format:

Scenario1 Scenario1CIL Scenario1CIU Scenario2 Scenario2CIL Scenario2CIU
60 57 62 45 48 50
110 101 111 51 50 52
120 117 122 64 62 66
192 190 194 79 75 79

where:
First  column  = Scenario1 mean value
Second  column  = Scenario1 Low Confidence Interval
Third  column  = Scenario1 Upper Confidence Interval
Fourth  column  = Scenario2 mean value
Fifth  column  = Scenario2 Low Confidence Interval
Sixth  column  = Scenario2 Upper Confidence Interval

Then, I tried this:

library(gplots)
data - read.table(data.file, header=T, sep= )
legend - c(line1,line2,line3,line4)

ci.l - as.matrix(c(c(data$Scenario1CIL), c(data$Scenario2CIL)))
ci.u - as.matrix(c(c(data$Scenario1CIU), c(data$Scenario2CIU)))

barplot2(as.matrix(c(c(data$Scenario1), c(data$Scenario2))), beside=TRUE,
legend=legend, ylim=c(0, 200), main=Experiment X, ylab=Total
size,
font.main=4, cex.axis=1.2, cex.lab=1.5, cex.names=1.5,
plot.ci=TRUE, ci.l=ci.l, ci.u=ci.u, plot.grid=TRUE)

But this code doesn't group the values in Scenario1 and Scenario2, as
expected.
All plotted bars are joined side by side.

Considering the letter 'H' a bar, the expected result was: '  '
but the result of the above code was: '' (no space between the
Scenario1's values and Scenario2'values)  and no legends (Scenario1 and
Scenario2).

How I must to do?

Thanks in advance!

-- 
Jonhnny Weslley Sousa Silva
MSc. Candidate in Computer Science
Distributed Systems Laboratory
Federal University of Campina Grande
--
OurFS http://www.lsd.ufcg.edu.br/ourfs
--
http://www.jonhnnyweslley.net

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] {ggplot2} Adding Mean to (grouped) Boxplot.

2009-11-26 Thread Peng Cai
Hi Dennis, Thanks for your reply. Answers are below:

On Thu, Nov 26, 2009 at 4:14 PM, Dennis Murphy djmu...@gmail.com wrote:

 Two questions:
   (1)  Do you want monthly means (averaged over groups), group means
 (averaged over
   months), overall average, other???


I need mean (of nail) for each treatment (trt) at each value of Month (so
its a two-way mean).

  (2) Why do you have month 0 and month 12? That would suggest a 13 month
year (at minimum).

Actually Month column denotes:
Visit at 0th Month, Visit after 1st Month,...,Visit after 12th Month -- so
you can safely treat them as factor with 6 levels.


 Please let me know if you have any further question,
 Thanks,
 Peng

 DM

 On Thu, Nov 26, 2009 at 1:00 PM, Peng Cai pengcaimaill...@gmail.comwrote:

 Hi R Users,

 I am using following R code to plot a grouped boxplot. I'm hoping if I
 can
 add MEAN to these boxplots. Data is copied below and attached as text
 file.

 install.packages(ggplot2)
 library(ggplot2)
 dta-read.table(Sample.txt,header=T)
 attach(dta)
 p - ggplot(dta, aes(factor(month), nail))
 p + geom_boxplot(aes(fill = factor(trt)))

 Data:
 month nail trt
 6 7.2 1
 12 9.3 1
 0 5.8 1
 1 6 1
 2 6.5 1
 3 7 1
 6 9.1 1
 12 7.9 1
 0 3.3 1
 1 4.9 1
 2 1.4 2
 3 2.7 2
 6 3.7 2
 12 9.4 2
 0 3.1 2
 1 2.7 2
 2 5.4 2
 3 8.3 2
 6 12.3 2
 12 17.7 2

 Any help would be greatly appreciated,

 Thanks,
 Peng

 __
 R-help@r-project.org 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@r-project.org 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] Concave hull

2009-11-26 Thread Ted Harding
On 26-Nov-09 21:11:02, baptiste auguie wrote:
 2009/11/26 Ted Harding ted.hard...@manchester.ac.uk:
 Raising a rather general question here.

 This is a tantalising discussion, but the notion of concave hull
 strikes me as extremely ill-defined!

 I'd like to see statement of what it is (generically) supposed to be.
 
 I'm curious too, but I can imagine the following definition,
 
 Consider a sphere (n-dimensional maybe) that we let come in contact
 with the scatter of points from outside. The set of points that the
 sphere can attain may define unambiguously (I think) a concave hull,
 for a specified sphere radius. The convex hull is obtained in the
 limit of infinite radius (plane).
 
 It's probably not exactly this, but I guess that's the rough idea.
 
 Just a thought,
 baptiste

Yes, it's the sort of idea I have had too! I imagined the true convex
hull as made of a stretchable material (like a soap bubble). With that
in place, now gently raise the air pressure outside the bubble. This
pushes the envelope inwards.

When the envelope, moving inwards, meets a point, it sticks to it and
does not move further at that point.

The parameter under your control is the pressure. You can stop when
you feel like it.

Once you have stopped, the set of points in contact with the envelope
can then be joined by lines (or, in higher dimensions, faces/simplexes).

This even has the merit that the surface has a definite equation
(with boundary conditions), so could be programmed!

However, the main thing left hanging in the air by this idea is that
you may want to arrange things so that the envelope gets pushed further
in from some directions than from others -- i.e. on the soap-bubble
analogy, you want to apply different levels of extra pressure to
different parts of the envelope.

For instance, in the example I included in my previous post, you might
want the envelope between points 19  3 to be under greater pressure
than the envelope between points 13  17.

So it is still an undefined solution. As is yours -- since you might
want to use different radii of spheres from different directions.

Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 26-Nov-09   Time: 21:45:47
-- XFMail --

__
R-help@r-project.org 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] Concave hull

2009-11-26 Thread Barry Rowlingson
On Thu, Nov 26, 2009 at 9:45 PM, Ted Harding
ted.hard...@manchester.ac.uk wrote:

 So it is still an undefined solution. As is yours -- since you might
 want to use different radii of spheres from different directions.

 I think the formal and rigorous definition is a nice polygon that goes round
my points.

Barry

__
R-help@r-project.org 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 suppress errors generated by readHTMLTable?

2009-11-26 Thread Peng Yu
library(XML)

download.file('http://polya.umdnj.edu/polya_db2/gene.php?llid=109079unigene=submit=Submit','index.html')
tables=readHTMLTable(index.html,error=function(...){})
tables


readHTMLTable gives me the following errors. Could somebody let me
know how to suppress them?


Opening and ending tag mismatch: center and table
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
Opening and ending tag mismatch: td and tr
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
htmlParseEntityRef: expecting ';'
Unexpected end tag : form
Opening and ending tag mismatch: body and center
Opening and ending tag mismatch: body and center

__
R-help@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Thanks Peter and Dennis for your help!

On Thu, Nov 26, 2009 at 3:50 PM, Dennis Murphy djmu...@gmail.com wrote:

 Hi:

 In addition to Peter's suggestions, I would suggest that you get rid of the
 row names as the
 first column of your data frame, as it confuses barchart (and the
 interpretation of the plot).
 I used x for your data frame, and this is the bar chart I ended up with:

  x
   Sample Col1 Col2 Col3
 1   Row1   -24   -1
 2   Row23   -24

 3   Row335   -2
 4   Row441   -1

 The bar chart using your code, and the data set in this form (Sample is
 column1), is given below:

 dta - x# change names to conform to
 your code

 barchart(data.matrix(dta),
   horizontal=FALSE,
   stack=TRUE,
   par.settings = simpleTheme(col = 2:4),
   auto.key=list(space=right, title=names(dimnames(dta))[2]),
   scales = list(y = list(at = -2:8))   )

 Notice that barchart tries to incorporate the row names as legitimate
 categories; I can't make
 heads or tails out of this...

 As it turns out, dta is a data frame with dim(dta) = c(4, 4). You want rows
 1:4 to be row labels,
 not data, so...

  x - x[, 2:4]
 x
   Col1 Col2 Col3
 1   -24   -1
 23   -24
 335   -2
 441   -1
 rownames(x) - paste('Row', 1:4, sep = '')
 x

  Col1 Col2 Col3
 Row1   -24   -1
 Row23   -24
 Row335   -2
 Row441   -1

 x now has dimension c(4, 3). Let's try barchart again...

 barchart(data.matrix(x), horizontal = FALSE, stack = TRUE,
 par.settings = simpleTheme(col = 2:4),
 auto.key = list(space = 'right', title = names(colnames(x))),
 scales = list(y = list(at = -2:8))   )

 Not your conventional stacked bar chart, but at least it seems more
 interepretable.

 HTH,
 Dennis




 On Thu, Nov 26, 2009 at 10:53 AM, Peng Cai pengcaimaill...@gmail.comwrote:

 Hi R Users,

 I'm trying to plot a stacked barplot. Here is data:

 Sample Col1 Col2 Col3
 Row1 -2 4 -1
 Row2 3 -2 4
 Row3 3 5 -2
 Row4 4 1 -1

 I'm using following R code:

 library(lattice)
 dta-read.table(data.txt, header=TRUE, row.names=Sample)
 barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
 col=2:4,
auto.key=list(space=right,
 title=names(dimnames(dta))[2])
 )

 Above code is working fine, but I need help with:

 1) Legend boxes have default colors, whereas I'm looking them to match
 with
 barplot colors (col=2:4).
 2) Can I increase scale for y axis, like currently it plotting
 -2,0,2,4,...
 I would like it as -2,-1,0,1,...

 Any help would be greatly appreciated,

 Thanks,
 Peng

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Hi Peter,

I'm not sure but it seems scales command works only with integer values.

If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But I
need it to extend it to negative numbers and reduce the scale width (like
-0.04, -0.02, 0, 0.02,...).

Can I change these too? Thanks!

Peng

On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca wrote:



 Peng Cai wrote:

 Hi R Users,

 I'm trying to plot a stacked barplot. Here is data:

 Sample Col1 Col2 Col3
 Row1 -2 4 -1
 Row2 3 -2 4
 Row3 3 5 -2
 Row4 4 1 -1

 I'm using following R code:

 library(lattice)
 dta-read.table(data.txt, header=TRUE, row.names=Sample)
 barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
 col=2:4,
auto.key=list(space=right,
 title=names(dimnames(dta))[2])
 )

 Above code is working fine, but I need help with:

 1) Legend boxes have default colors, whereas I'm looking them to match
 with
 barplot colors (col=2:4).

 replace the line

  col = 2:4,

 with

  par.settings = simpleTheme(col = 2:4),


  2) Can I increase scale for y axis, like currently it plotting
 -2,0,2,4,...
 I would like it as -2,-1,0,1,...

 add the line

  scales = list(y = list(at = -2:8)),

 or whatever tick locations you prefer.

  -Peter Ehlers


 Any help would be greatly appreciated,

 Thanks,
 Peng

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers

Peng Cai wrote:

Hi Peter,

I'm not sure but it seems scales command works only with integer values.

If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But I
need it to extend it to negative numbers and reduce the scale width (like
-0.04, -0.02, 0, 0.02,...).

Can I change these too? Thanks!


Use, e.g.

 myYscale - seq(-0.04, 0.08, 0.02)
 barchart(...,
   ...,
   scales = list(y = list(at = myYscale)),
   ...
 )

 -Peter Ehlers



Peng

On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca wrote:



Peng Cai wrote:


Hi R Users,

I'm trying to plot a stacked barplot. Here is data:

Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1

I'm using following R code:

library(lattice)
dta-read.table(data.txt, header=TRUE, row.names=Sample)
barchart(data.matrix(dta),
   horizontal=FALSE,
   stack=TRUE,
col=2:4,
   auto.key=list(space=right,
title=names(dimnames(dta))[2])
)

Above code is working fine, but I need help with:

1) Legend boxes have default colors, whereas I'm looking them to match
with
barplot colors (col=2:4).


replace the line

 col = 2:4,

with

 par.settings = simpleTheme(col = 2:4),


 2) Can I increase scale for y axis, like currently it plotting

-2,0,2,4,...
I would like it as -2,-1,0,1,...


add the line

 scales = list(y = list(at = -2:8)),

or whatever tick locations you prefer.

 -Peter Ehlers



Any help would be greatly appreciated,

Thanks,
Peng

   [[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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] Concave hull

2009-11-26 Thread Kjetil Halvorsen
There is a package on CRAN implementing such an idea:
alphahull, phull is other package,

kjetil

On Thu, Nov 26, 2009 at 6:11 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
 2009/11/26 Ted Harding ted.hard...@manchester.ac.uk:
 Raising a rather general question here.

 This is a tantalising discussion, but the notion of concave hull
 strikes me as extremely ill-defined!

 I'd like to see statement of what it is (generically) supposed to be.

 I'm curious too, but I can imagine the following definition,

 Consider a sphere (n-dimensional maybe) that we let come in contact
 with the scatter of points from outside. The set of points that the
 sphere can attain may define unambiguously (I think) a concave hull,
 for a specified sphere radius. The convex hull is obtained in the
 limit of infinite radius (plane).

 It's probably not exactly this, but I guess that's the rough idea.

 Just a thought,

 baptiste

 __
 R-help@r-project.org 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@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Thanks a lot Peter! One more help, is there a similar function abline() for
barchart().

I'm trying to add a (light gray colored) horizontal lines, one for each
y-value.

Peng

On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers ehl...@ucalgary.ca wrote:

 Peng Cai wrote:

 Hi Peter,

 I'm not sure but it seems scales command works only with integer values.

 If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
 0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But I
 need it to extend it to negative numbers and reduce the scale width (like
 -0.04, -0.02, 0, 0.02,...).

 Can I change these too? Thanks!


 Use, e.g.

  myYscale - seq(-0.04, 0.08, 0.02)
  barchart(...,
   ...,
   scales = list(y = list(at = myYscale)),
   ...
  )

  -Peter Ehlers



 Peng

 On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca wrote:


 Peng Cai wrote:

  Hi R Users,

 I'm trying to plot a stacked barplot. Here is data:

 Sample Col1 Col2 Col3
 Row1 -2 4 -1
 Row2 3 -2 4
 Row3 3 5 -2
 Row4 4 1 -1

 I'm using following R code:

 library(lattice)
 dta-read.table(data.txt, header=TRUE, row.names=Sample)
 barchart(data.matrix(dta),
   horizontal=FALSE,
   stack=TRUE,
 col=2:4,
   auto.key=list(space=right,
 title=names(dimnames(dta))[2])
 )

 Above code is working fine, but I need help with:

 1) Legend boxes have default colors, whereas I'm looking them to match
 with
 barplot colors (col=2:4).

  replace the line

  col = 2:4,

 with

  par.settings = simpleTheme(col = 2:4),


  2) Can I increase scale for y axis, like currently it plotting

 -2,0,2,4,...
 I would like it as -2,-1,0,1,...

  add the line

  scales = list(y = list(at = -2:8)),

 or whatever tick locations you prefer.

  -Peter Ehlers


  Any help would be greatly appreciated,

 Thanks,
 Peng

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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@r-project.org 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 suppress errors generated by readHTMLTable?

2009-11-26 Thread Duncan Temple Lang

Just this morning, I made suppressing these parser messages
the default behavior for htmlParse() and that will apply
to readHTMLTable() also.

Until I release that (along with another potentially
non-backward compatible change regarding character encoding),
you can use

 readHTMLTable(htmlParse(index.html, error = function(...){}))

i.e. parse the document yourself and hand it to readHTMLTable().

 D.

Peng Yu wrote:
 library(XML)
 
 download.file('http://polya.umdnj.edu/polya_db2/gene.php?llid=109079unigene=submit=Submit','index.html')
 tables=readHTMLTable(index.html,error=function(...){})
 tables
 
 
 readHTMLTable gives me the following errors. Could somebody let me
 know how to suppress them?
 
 
 Opening and ending tag mismatch: center and table
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 Opening and ending tag mismatch: td and tr
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 htmlParseEntityRef: expecting ';'
 Unexpected end tag : form
 Opening and ending tag mismatch: body and center
 Opening and ending tag mismatch: body and center
 
 __
 R-help@r-project.org 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@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread David Winsemius


On Nov 26, 2009, at 6:12 PM, Peng Cai wrote:

Thanks a lot Peter! One more help, is there a similar function  
abline() for

barchart().


?panel.abline



I'm trying to add a (light gray colored) horizontal lines, one for  
each

y-value.

Peng

On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers ehl...@ucalgary.ca  
wrote:



Peng Cai wrote:


Hi Peter,

I'm not sure but it seems scales command works only with integer  
values.


If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10  
only. But I
need it to extend it to negative numbers and reduce the scale  
width (like

-0.04, -0.02, 0, 0.02,...).

Can I change these too? Thanks!



Use, e.g.

myYscale - seq(-0.04, 0.08, 0.02)
barchart(...,
 ...,
 scales = list(y = list(at = myYscale)),
 ...
)

-Peter Ehlers




Peng

On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca  
wrote:




Peng Cai wrote:

Hi R Users,


I'm trying to plot a stacked barplot. Here is data:

Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1

I'm using following R code:

library(lattice)
dta-read.table(data.txt, header=TRUE, row.names=Sample)
barchart(data.matrix(dta),
 horizontal=FALSE,
 stack=TRUE,
col=2:4,
 auto.key=list(space=right,
title=names(dimnames(dta))[2])
)

Above code is working fine, but I need help with:

1) Legend boxes have default colors, whereas I'm looking them to  
match

with
barplot colors (col=2:4).

replace the line


col = 2:4,

with

par.settings = simpleTheme(col = 2:4),


2) Can I increase scale for y axis, like currently it plotting


-2,0,2,4,...
I would like it as -2,-1,0,1,...

add the line


scales = list(y = list(at = -2:8)),

or whatever tick locations you prefer.

-Peter Ehlers


Any help would be greatly appreciated,


Thanks,
Peng

 [[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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 on Html format R 2.10

2009-11-26 Thread Ruben Cabrera
Hello:

I´m trying to change the plain text help to html help but I don´t know
if this is possible with R 2.10.0 (Windows XP). The installation
process always set to plain text.

I found this:
http://old.nabble.com/change-in-default-behavior-of--functionname-in-R-2.10--td26115436.html

Thanks in advance,
Ruben Cabrera

__
R-help@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peng Cai
Thanks David, I tried panel.abline(h=somevalue) -- both inside and outside
of barchart() function but its not working. Any suggestions?

Peng

On Thu, Nov 26, 2009 at 6:42 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Nov 26, 2009, at 6:12 PM, Peng Cai wrote:

  Thanks a lot Peter! One more help, is there a similar function abline()
 for
 barchart().


 ?panel.abline



 I'm trying to add a (light gray colored) horizontal lines, one for each
 y-value.

 Peng

 On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers ehl...@ucalgary.ca wrote:

  Peng Cai wrote:

  Hi Peter,

 I'm not sure but it seems scales command works only with integer
 values.

 If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
 0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But
 I
 need it to extend it to negative numbers and reduce the scale width
 (like
 -0.04, -0.02, 0, 0.02,...).

 Can I change these too? Thanks!


 Use, e.g.

 myYscale - seq(-0.04, 0.08, 0.02)
 barchart(...,
  ...,
  scales = list(y = list(at = myYscale)),
  ...
 )

 -Peter Ehlers



  Peng

 On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca
 wrote:


  Peng Cai wrote:

 Hi R Users,


 I'm trying to plot a stacked barplot. Here is data:

 Sample Col1 Col2 Col3
 Row1 -2 4 -1
 Row2 3 -2 4
 Row3 3 5 -2
 Row4 4 1 -1

 I'm using following R code:

 library(lattice)
 dta-read.table(data.txt, header=TRUE, row.names=Sample)
 barchart(data.matrix(dta),
 horizontal=FALSE,
 stack=TRUE,
 col=2:4,
 auto.key=list(space=right,
 title=names(dimnames(dta))[2])
 )

 Above code is working fine, but I need help with:

 1) Legend boxes have default colors, whereas I'm looking them to match
 with
 barplot colors (col=2:4).

 replace the line


 col = 2:4,

 with

 par.settings = simpleTheme(col = 2:4),


 2) Can I increase scale for y axis, like currently it plotting

  -2,0,2,4,...
 I would like it as -2,-1,0,1,...

 add the line


 scales = list(y = list(at = -2:8)),

 or whatever tick locations you prefer.

 -Peter Ehlers


 Any help would be greatly appreciated,


 Thanks,
 Peng

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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@r-project.org 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 Winsemius, MD
 Heritage Laboratories
 West Hartford, CT



[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Export kde object as shapefile

2009-11-26 Thread David Winsemius


On Nov 26, 2009, at 2:25 PM, T.D.Rudolph wrote:



Can you explain what you mean by spatial area under the space or
what it is for which you think there is a well defined area in a
ks:::kde object?

My knowledge is not extensive in this area but I am aware that kernel
methods can be used to estimate home range size.  The function  
kernel.area
in the adehabitat package, for example, produces a spatial area I  
interpret
as being equivalent to estimated home range size using one of two  
possible
smoothing parameters.  I would like to use the plug-in method  
because I am
convinced it will serve me best, but the ks package doesn't have a  
simple

option like kde.area that produces what I'm looking for.

 Some example data would, as always, be welcome.

Attached is an example subset of my data.  I've only gotten so far  
as to

produce the kde object and explore potential solutions.

tmp.Hpi-Hpi(x=temp[,2:3])
tmp.kde-kde(x=temp[,2:3], H=tmp.Hpi)


The situation that I see (after looking at the documentation for  
adehabit) is that for some as yet unarticulated reason, you have  
decided that the methods used in prior publications in your domain are  
not the best and you are going to invent new ones, but you are as yet  
unable to provided a detailed specification or offer an implementation  
of the methods. Furthermore, you are unable even to manipulate the  
objects you have thus far created in service toward this effort.


I am being somewhat harsh in my assessment because it seems that you  
really need is a statistical collaborator with whom you can bang ideas  
together and arrive, first at a more detailed rationale and plan, and  
then a forward effort using your data and his programming expertise to  
demonstrate the superiority of your method. That would seem to be most  
reasonably a joint effort with joint authorship as an outcome.


--
David.




Tyler

http://old.nabble.com/file/p26533942/temp temp


David Winsemius wrote:



On Nov 26, 2009, at 12:40 PM, T.D.Rudolph wrote:



I am trying to estimate home range size using the plug-in method
with kernel
density estimation in the kernel smoothing (ks) package.  Unless
there is
another way I am not familiar with, in order to calculate spatial
area under
the space I need to convert my kde () object into a spatial object
somehow
in order to calculate its spatial area.  Could someone demonstrate
how this
might be done?


Can you explain what you mean by spatial area under the space or
what it is for which you think there is a well defined area in a
ks:::kde object? (Some example data would, as always, be welcome.)



--
View this message in context:
http://old.nabble.com/Export-kde-object-as-shapefile-tp26532782p26532782.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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.




--
View this message in context: 
http://old.nabble.com/Export-kde-object-as-shapefile-tp26532782p26533942.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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 on Html format R 2.10

2009-11-26 Thread Ruben Cabrera
Hello Again:

Let me answer myself because I already solved my problem:
I found the file ...R\R-2.10.0\Rprofile.site and used
options(help_type=html).

Thanks.
Ruben Cabrera


On Thu, Nov 26, 2009 at 7:41 PM, Ruben Cabrera ruben...@gmail.com wrote:
 Hello:

 I´m trying to change the plain text help to html help but I don´t know
 if this is possible with R 2.10.0 (Windows XP). The installation
 process always set to plain text.

 I found this
 http://old.nabble.com/change-in-default-behavior-of--functionname-in-R-2.10--td26115436.html

 Thanks in advance,

 Ruben Cabrera


__
R-help@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread Peter Ehlers

Peng Cai wrote:

Thanks David, I tried panel.abline(h=somevalue) -- both inside and outside
of barchart() function but its not working. Any suggestions?

Peng

Here's some code related to the data you posted earlier.

barchart(data.matrix(dta), horizontal = FALSE, stack = TRUE,
 par.settings = simpleTheme(col = 2:4),
 panel=function(x,y,...){
   panel.abline(h=c(-2,0,3,4), col.line=gray)
   panel.barchart(x,y,...)
 },
 scales = list(y = list(at = -2:8)),
 auto.key = list(space = 'right', rectangles=TRUE,
 points=FALSE)
)

If you want the gray lines in front of the bars, switch the
order of the panel functions. With lattice, it's all about
what goes into each panel (you have only one panel here).
If you want more than one thing in a panel, you have to set
up a function to do those things.

I had to add the rectangles= and points= arguments to
auto.key to get the same key as you had earlier.

 -Peter Ehlers



On Thu, Nov 26, 2009 at 6:42 PM, David Winsemius dwinsem...@comcast.netwrote:


On Nov 26, 2009, at 6:12 PM, Peng Cai wrote:

 Thanks a lot Peter! One more help, is there a similar function abline()

for
barchart().


?panel.abline




I'm trying to add a (light gray colored) horizontal lines, one for each
y-value.

Peng

On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers ehl...@ucalgary.ca wrote:

 Peng Cai wrote:

 Hi Peter,

I'm not sure but it seems scales command works only with integer
values.

If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only. But
I
need it to extend it to negative numbers and reduce the scale width
(like
-0.04, -0.02, 0, 0.02,...).

Can I change these too? Thanks!



Use, e.g.

myYscale - seq(-0.04, 0.08, 0.02)
barchart(...,
 ...,
 scales = list(y = list(at = myYscale)),
 ...
)

-Peter Ehlers



 Peng

On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca
wrote:


 Peng Cai wrote:

Hi R Users,


I'm trying to plot a stacked barplot. Here is data:

Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1

I'm using following R code:

library(lattice)
dta-read.table(data.txt, header=TRUE, row.names=Sample)
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,
auto.key=list(space=right,
title=names(dimnames(dta))[2])
)

Above code is working fine, but I need help with:

1) Legend boxes have default colors, whereas I'm looking them to match
with
barplot colors (col=2:4).

replace the line


col = 2:4,

with

par.settings = simpleTheme(col = 2:4),


2) Can I increase scale for y axis, like currently it plotting

 -2,0,2,4,...

I would like it as -2,-1,0,1,...

add the line


scales = list(y = list(at = -2:8)),

or whatever tick locations you prefer.

-Peter Ehlers


Any help would be greatly appreciated,


Thanks,
Peng

[[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT






__
R-help@r-project.org 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] barchart() {Lattice} help.

2009-11-26 Thread David Winsemius
Cannot reproduce. Seems to work as documented. Maybe your code  
(whatever it might be)  is not correct?


--
David.
On Nov 26, 2009, at 6:53 PM, Peng Cai wrote:

Thanks David, I tried panel.abline(h=somevalue) -- both inside and  
outside of barchart() function but its not working. Any suggestions?


Peng

On Thu, Nov 26, 2009 at 6:42 PM, David Winsemius dwinsem...@comcast.net 
 wrote:


On Nov 26, 2009, at 6:12 PM, Peng Cai wrote:

Thanks a lot Peter! One more help, is there a similar function  
abline() for

barchart().

?panel.abline



I'm trying to add a (light gray colored) horizontal lines, one for  
each

y-value.

Peng

On Thu, Nov 26, 2009 at 5:59 PM, Peter Ehlers ehl...@ucalgary.ca  
wrote:


Peng Cai wrote:

Hi Peter,

I'm not sure but it seems scales command works only with integer  
values.


If the y-axis values are very small (such as -0.03, -0.02, -0.01, 0,
0.01,..., 0.08). My current plot has values 0, 0.05, and 0.10 only.  
But I
need it to extend it to negative numbers and reduce the scale width  
(like

-0.04, -0.02, 0, 0.02,...).

Can I change these too? Thanks!


Use, e.g.

myYscale - seq(-0.04, 0.08, 0.02)
barchart(...,
 ...,
 scales = list(y = list(at = myYscale)),
 ...
)

-Peter Ehlers



Peng

On Thu, Nov 26, 2009 at 3:18 PM, Peter Ehlers ehl...@ucalgary.ca  
wrote:



Peng Cai wrote:

Hi R Users,

I'm trying to plot a stacked barplot. Here is data:

Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1

I'm using following R code:

library(lattice)
dta-read.table(data.txt, header=TRUE, row.names=Sample)
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,
auto.key=list(space=right,
title=names(dimnames(dta))[2])
)

Above code is working fine, but I need help with:

1) Legend boxes have default colors, whereas I'm looking them to match
with
barplot colors (col=2:4).

replace the line

col = 2:4,

with

par.settings = simpleTheme(col = 2:4),


2) Can I increase scale for y axis, like currently it plotting

-2,0,2,4,...
I would like it as -2,-1,0,1,...

add the line

scales = list(y = list(at = -2:8)),

or whatever tick locations you prefer.

-Peter Ehlers


Any help would be greatly appreciated,

Thanks,
Peng

[[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT




David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] Moving quantile()?

2009-11-26 Thread Rob Steele
Charles C. Berry wrote:
 On Thu, 26 Nov 2009, Rob Steele wrote:
 
 Is there a faster way to get moving quantiles from a time series than to
 run quantile() at each step in the series?
 
 
 Yes.
 
 Run
 
 help.request()
 
 Since you have already done the first 4 items below (right?) you will
 answer 'y', but when you get to the fifth one (which you evidently have
 not done), you will have to answer 'n'.
 
 
 
 Checklist:
 Have you read the posting guide? (y/n) y
 Have you checked the FAQ? (y/n) y
 Have you checked An Introduction to R? (y/n) y
 Have you checked the NEWS of the latest development release? (y/n) y
 Have you looked on RSiteSearch? (y/n) n
 
 
 
 This will start a browser with the RSiteSearch URL loaded.
 
 Now comes the tricky part --- you have to type something into the
 'Query' box and then click on 'Search'. Perhaps
 
 moving quantiles
 
 will work??
 
 It did for me, and the function I found by that strategy seems to be
 faster than
 
 apply(embed(x[1:1],100),1,quantile,.75)
 
 by about 3 orders of magnitude.
 
 HTH,
 
 Chuck


runquantile() in library caTools.

Beautiful.  Thanks!  Btw, love your music.

__
R-help@r-project.org 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] multi variate plot with string data

2009-11-26 Thread frenchcr


Thanks!!


this works perfectly

dat = data.frame(Aggressive = data_set$var1 , Behaviour=data_set$var2)
plot(table(dat))


...its better than a stacked boxplot as it gives also different width of
columns on the diagram...an extra layer of information.









frenchcr wrote:
 
 
 Ive got two columns in data_set that are strings
 
 the first column is called character and has levels:
 good, bad, ugly
 
 the second column is called abusive and has levels:
 aggressive, moderately aggressive, mildly aggressive
 
 
 I want to do a stacked boxplot that has this sort of structure: 
 
 %aggressive %aggressive
 %aggressive
 %moderately aggressive %moderately aggressive  %moderately
 aggressive
 %mildly aggressive %mildly aggressive %mildly
 aggressive
 %not agressive %not agressive  %not
 agressive
 
bad  good  
 ugly
 
 
 ...with legend at the size showing which colour each of the abusive
 levels takes.
 
 
 How is it done?
 

-- 
View this message in context: 
http://old.nabble.com/multi-variate-plot-with-string-data-tp26517211p26534782.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Moving quantile()?

2009-11-26 Thread Rob Steele
Charles C. Berry wrote:
 On Thu, 26 Nov 2009, Rob Steele wrote:
 
 Is there a faster way to get moving quantiles from a time series than to
 run quantile() at each step in the series?
 
 
 Yes.
 
 Run
 
 help.request()
 
 Since you have already done the first 4 items below (right?) you will
 answer 'y', but when you get to the fifth one (which you evidently have
 not done), you will have to answer 'n'.
 
 
 
 Checklist:
 Have you read the posting guide? (y/n) y
 Have you checked the FAQ? (y/n) y
 Have you checked An Introduction to R? (y/n) y
 Have you checked the NEWS of the latest development release? (y/n) y
 Have you looked on RSiteSearch? (y/n) n
 
 
 
 This will start a browser with the RSiteSearch URL loaded.
 
 Now comes the tricky part --- you have to type something into the
 'Query' box and then click on 'Search'. Perhaps
 
 moving quantiles
 
 will work??
 
 It did for me, and the function I found by that strategy seems to be
 faster than
 
 apply(embed(x[1:1],100),1,quantile,.75)
 
 by about 3 orders of magnitude.
 
 HTH,
 
 Chuck


runquantile() in library caTools.

Beautiful.  Thanks!  Btw, love your music.

__
R-help@r-project.org 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.


  1   2   >