Re: [R] Multiple lag.plots per page

2006-06-12 Thread Gad Abraham
No No wrote:
> Does this help?
>  > pdf(file="lag.pdf")
>  > lag.plot(a)
>  > lag.plot(b)
>  > dev.off()
> After that you can open each page of the "lag.pdf" file with GIMP for 
> further manipulation. It gives each plot on a different page, but no 
> plot is replaced.

That would be a last resort, but obviously it's not very practical if 
you have more than a handful of plots.

Thanks,
Gad

> 
> 2006/6/13, Gad Abraham <[EMAIL PROTECTED] 
> >:
> 
> Hi,
> 
> I'm trying to plot several lag.plots on a page, however the second plot
> replaces the first one (although it only takes up the upper half as it
> should):
> 
> par(mfrow=c(2,1))
> a<-sin(1:100)
> b<-cos(1:100)
> lag.plot(a)
> lag.plot(b)
> 
> What's the trick to this?
> 
> I'm using R 2.2.1 (2005-12-20 r36812) on Ubuntu Linux.
> 


-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] plotting gaussian data

2006-06-12 Thread H. Paul Benton
Ok I guess it's time to ask. 
So I want to plot my data. It's my data from a frequency table, "temp". My
formula is just a Gaussian eq. I have done the nls function to get my
parameters and now I want to do the whole plot (...) and then lines(..)
This is what I have done. 

> temp
bin   x
1  -4.0   0
2  -3.9   0
3  -3.8   0
4  -3.7   0
5  -3.6   0
6  -3.5   0  and so on
> fo
x ~ (A/(sig * sqrt(2 * pi))) * exp(-1 * ((bin - mu)^2/(2 * sig^2)))
> fo.v
x ~ (335.48/(0.174 * sqrt(2 * pi))) * exp(-1 * ((bin - (-0.0786))^2/(2 * 
0.174^2)))
> coef
$A
[1] 335.4812

$mu
[1] -0.07863746

$sig
[1] 0.1746473

plot(fo, temp, coef)
Error in eval(expr, envir, enclos) : object "sig" not found
> plot(fo, coef, temp)
Error in eval(expr, envir, enclos) : object "x" not found
> plot(fo, temp, list=coef)
>

If someone could point me in the right direction I would be very grateful. 

Cheers,

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Updating R on an old Linux installation (was: Where is package gridBase?)

2006-06-12 Thread Prof Brian Ripley
There are older versions of gridBase suitable for 2.2.1 at CRAN, e.g.
src/contrib/Archive/gridBase_0.4-2.tar.gz.  Why not just install that?

On Tue, 13 Jun 2006, Jonathan Dushoff wrote:

>
> I am running R 2.2.1 on a University-supported linux installation based
> on Redhat EL3.  I am sorry that it did not occur to me to mention this
> before; I updated R very recently, with the most recent version
> available for EL3 at http://cran.cnr.berkeley.edu/bin/linux/redhat/el3/.
>
> Looking at the gridBase documentation, I find that 2.2.1 is not in fact
> the most recent version.  I have now spent hours trying to install 2.3.
> No available binary rpms seem to work.  If I try the source code,
> configure crashes with a complaint that I do not have X, which is false
> (see below).

That is not what it says, and very likely it is the X11 headers that are 
not installed.

>
> Do I need a new version of Linux?
>
> Any help is appreciated.
>
> Jonathan
>
> --
>> ./configure
>
> (lots of positive stuff)
>
> checking for X... no
> configure: error: --with-x=yes (default) and X11 headers/libs are not
> available
>
>
> -- Forwarded message --
> Date: Mon, 12 Jun 2006 21:27:02 -0400 (EDT)
> From: Jonathan Dushoff <[EMAIL PROTECTED]>
> To: R-help@stat.math.ethz.ch
> Subject: Where is package gridBase?
>
> Trying to follow the instructions on the page
> http://tolstoy.newcastle.edu.au/R/help/05/12/17153.html (to make a
> figure with an inset), I typed
>
>> install.packages("gridBase", repos="http://cran.r-project.org";)
>
> and was rejected.
>
>   no package 'gridBase' at the repositories in: download.packages(pkgs,
>   destdir = tmpd, available = available,
>
> I went to the FAQ at
> http://cran.r-project.org/doc/FAQ/R-FAQ.html#Add_002don-packages-from-CRAN,
> and was informed that gridBase was an add-on package available from
> CRAN.
>
> I also tried installing other packages using exactly the same command.
>
>> install.packages("TeachingDemos", repos="http://cran.r-project.org";)
>
> These packages were apparently found:
>   trying URL
>   'http://cran.r-project.org/src/contrib/TeachingDemos_1.2.tar.gz'
>   Content type 'application/x-tar' length 66472 bytes
>   opened URL
>
>   (and so on)
>
> I would appreciate any insight that anyone might have.
>
> Jonathan
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Updating R on an old Linux installation (was: Where is package gridBase?)

2006-06-12 Thread Gad Abraham
Jonathan Dushoff wrote:
> I am running R 2.2.1 on a University-supported linux installation based
> on Redhat EL3.  I am sorry that it did not occur to me to mention this
> before; I updated R very recently, with the most recent version
> available for EL3 at http://cran.cnr.berkeley.edu/bin/linux/redhat/el3/.
> 
> Looking at the gridBase documentation, I find that 2.2.1 is not in fact
> the most recent version.  I have now spent hours trying to install 2.3.
> No available binary rpms seem to work.  If I try the source code,
> configure crashes with a complaint that I do not have X, which is false
> (see below).
> 
> Do I need a new version of Linux?
> 
> Any help is appreciated.
> 
> Jonathan
> 
> --
>> ./configure
> 
> (lots of positive stuff)
> 
> checking for X... no
> configure: error: --with-x=yes (default) and X11 headers/libs are not
> available

You might have X but probably not the X development libraries/headers, 
which are in a separate package(s).

If RH EL3 still uses XFree86 and not X.org, then I think the main 
package is called XFree86-devel, and you'll probably need a few others, 
going by 
http://rpmfind.net//linux/RPM/redhat/8.0/i386/XFree86-devel-4.2.0-72.i386.html.

Cheers,
Gad

-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Updating R on an old Linux installation (was: Where is package gridBase?)

2006-06-12 Thread Jonathan Dushoff

I am running R 2.2.1 on a University-supported linux installation based
on Redhat EL3.  I am sorry that it did not occur to me to mention this
before; I updated R very recently, with the most recent version
available for EL3 at http://cran.cnr.berkeley.edu/bin/linux/redhat/el3/.

Looking at the gridBase documentation, I find that 2.2.1 is not in fact
the most recent version.  I have now spent hours trying to install 2.3.
No available binary rpms seem to work.  If I try the source code,
configure crashes with a complaint that I do not have X, which is false
(see below).

Do I need a new version of Linux?

Any help is appreciated.

Jonathan

--
> ./configure

(lots of positive stuff)

checking for X... no
configure: error: --with-x=yes (default) and X11 headers/libs are not
available


-- Forwarded message --
Date: Mon, 12 Jun 2006 21:27:02 -0400 (EDT)
From: Jonathan Dushoff <[EMAIL PROTECTED]>
To: R-help@stat.math.ethz.ch
Subject: Where is package gridBase?

Trying to follow the instructions on the page
http://tolstoy.newcastle.edu.au/R/help/05/12/17153.html (to make a
figure with an inset), I typed

> install.packages("gridBase", repos="http://cran.r-project.org";)

and was rejected.

no package 'gridBase' at the repositories in: download.packages(pkgs,
destdir = tmpd, available = available,

I went to the FAQ at
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Add_002don-packages-from-CRAN,
and was informed that gridBase was an add-on package available from
CRAN.

I also tried installing other packages using exactly the same command.

> install.packages("TeachingDemos", repos="http://cran.r-project.org";)

These packages were apparently found:
trying URL
'http://cran.r-project.org/src/contrib/TeachingDemos_1.2.tar.gz'
Content type 'application/x-tar' length 66472 bytes
opened URL

(and so on)

I would appreciate any insight that anyone might have.

Jonathan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Multiple lag.plots per page

2006-06-12 Thread No No
Does this help?
> pdf(file="lag.pdf")
> lag.plot(a)
> lag.plot(b)
> dev.off()
After that you can open each page of the "lag.pdf" file with GIMP for
further manipulation. It gives each plot on a different page, but no plot is
replaced.

2006/6/13, Gad Abraham <[EMAIL PROTECTED]>:
>
> Hi,
>
> I'm trying to plot several lag.plots on a page, however the second plot
> replaces the first one (although it only takes up the upper half as it
> should):
>
> par(mfrow=c(2,1))
> a<-sin(1:100)
> b<-cos(1:100)
> lag.plot(a)
> lag.plot(b)
>
> What's the trick to this?
>
> I'm using R 2.2.1 (2005-12-20 r36812) on Ubuntu Linux.
>
> Thanks,
> Gad
>
>
> --
> Gad Abraham
> Department of Mathematics and Statistics
> University of Melbourne
> Victoria 3010, Australia
> email: [EMAIL PROTECTED]
> web: http://www.ms.unimelb.edu.au/~gabraham
> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Multiple lag.plots per page

2006-06-12 Thread No No
Does this help?
> pdf(file="lag.pdf")
> lag.plot(a)
> lag.plot(b)
> dev.off()
After that you can open each page of the "lag.pdf" file with GIMP for
further manipulation. It gives each plot on a different page, but no plot is
replaced.

Hope it helps


2006/6/13, Gad Abraham <[EMAIL PROTECTED]>:
>
> Hi,
>
> I'm trying to plot several lag.plots on a page, however the second plot
> replaces the first one (although it only takes up the upper half as it
> should):
>
> par(mfrow=c(2,1))
> a<-sin(1:100)
> b<-cos(1:100)
> lag.plot(a)
> lag.plot(b)
>
> What's the trick to this?
>
> I'm using R 2.2.1 (2005-12-20 r36812) on Ubuntu Linux.
>
> Thanks,
> Gad
>
>
> --
> Gad Abraham
> Department of Mathematics and Statistics
> University of Melbourne
> Victoria 3010, Australia
> email: [EMAIL PROTECTED]
> web: http://www.ms.unimelb.edu.au/~gabraham
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Multiple lag.plots per page

2006-06-12 Thread Gad Abraham
Hi,

I'm trying to plot several lag.plots on a page, however the second plot 
replaces the first one (although it only takes up the upper half as it 
should):

par(mfrow=c(2,1))
a<-sin(1:100)
b<-cos(1:100)
lag.plot(a)
lag.plot(b)

What's the trick to this?

I'm using R 2.2.1 (2005-12-20 r36812) on Ubuntu Linux.

Thanks,
Gad


-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] help on remote sensing

2006-06-12 Thread Yong Li

Dear all,

Is any body know the R packages for processing remote sensing images 
(not the Rimages) like ERDAS Imagine does? Cheers

Yong

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Where is package gridBase?

2006-06-12 Thread Jonathan Dushoff
Trying to follow the instructions on the page
http://tolstoy.newcastle.edu.au/R/help/05/12/17153.html (to make a
figure with an inset), I typed

> install.packages("gridBase", repos="http://cran.r-project.org";)

and was rejected.

no package 'gridBase' at the repositories in: download.packages(pkgs,
destdir = tmpd, available = available,

I went to the FAQ at
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Add_002don-packages-from-CRAN,
and was informed that gridBase was an add-on package available from
CRAN.

I also tried installing other packages using exactly the same command.

> install.packages("TeachingDemos", repos="http://cran.r-project.org";)

These packages were apparently found:
trying URL
'http://cran.r-project.org/src/contrib/TeachingDemos_1.2.tar.gz'
Content type 'application/x-tar' length 66472 bytes
opened URL

(and so on)

I would appreciate any insight that anyone might have.

Jonathan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plot two graphs with different length of data

2006-06-12 Thread Eric Hu
Thanks Jim. This seems to work for my case already.

Eric

On 6/13/06, Jim Lemon <[EMAIL PROTECTED]> wrote:
> Eric Hu wrote:
> > Hi I am trying to plot two data set in the same picture window without
> > overlapping with each other. I am using the format plot(x1,y1,x2,y2)
> > but get the following error message:
> >
> >
> >>plot(as.numeric(r0[,4]),as.numeric(r0[,7]),as.numeric(r0[,4]),as.numeric(r0[,7][ind[,1]]))
> >
> > Error in plot.window(xlim, ylim, log, asp, ...) :
> > invalid 'ylim' value
> >
> > Can anyone tell me what went wrong? Thanks.
>
> plot is probably interpreting one of your data vectors as the ylim
> argument. If you want to plot multiple data series of different lengths,
> it is probably simplest to use points() (or lines()) after plotting the
> first one. For an example of this, see:
>
> http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_addat.html
>
> Jim
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plot two graphs with different length of data

2006-06-12 Thread Jim Lemon
Eric Hu wrote:
> Hi I am trying to plot two data set in the same picture window without
> overlapping with each other. I am using the format plot(x1,y1,x2,y2)
> but get the following error message:
> 
> 
>>plot(as.numeric(r0[,4]),as.numeric(r0[,7]),as.numeric(r0[,4]),as.numeric(r0[,7][ind[,1]]))
> 
> Error in plot.window(xlim, ylim, log, asp, ...) :
> invalid 'ylim' value
> 
> Can anyone tell me what went wrong? Thanks.

plot is probably interpreting one of your data vectors as the ylim 
argument. If you want to plot multiple data series of different lengths, 
it is probably simplest to use points() (or lines()) after plotting the 
first one. For an example of this, see:

http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_addat.html

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] plot two graphs with different length of data

2006-06-12 Thread Eric Hu
Hi I am trying to plot two data set in the same picture window without
overlapping with each other. I am using the format plot(x1,y1,x2,y2)
but get the following error message:

>plot(as.numeric(r0[,4]),as.numeric(r0[,7]),as.numeric(r0[,4]),as.numeric(r0[,7][ind[,1]]))
Error in plot.window(xlim, ylim, log, asp, ...) :
invalid 'ylim' value

Can anyone tell me what went wrong? Thanks.

Eric

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] binomial dat set

2006-06-12 Thread Leidy Rocio Leon Davila
Dear list members,
I need a dat set with follow features:
-Binomial response in longitudinal form
-overdispersion

thanks 
Leidy Rocío

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Group averages

2006-06-12 Thread David Kling
Thanks!  Both responders understood what I was after despite my poor 
explanation and came up with very helpful responses.  If anyone else has 
an idea, please share!

David Kling

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Local Ripley's K and L

2006-06-12 Thread DrakeGis
Hi List,
  Does any of you know about an implementation of the Local Ripley's K and
L functions for R? The function has been described in "Second-Order
Neigborhood Analysis of Mapped Point Patterns (Getis & Franklin, 1987,
Ecology 68:3)

  Thanks.
  D.



-
Stay ahead of the information curve.
Receive GIS news and jobs on your desktop daily.
Subscribe today to the GIS CafeNews newsletter.
[ http://www10.giscafe.com/nl/newsletter_subscribe.php ]
It's informative and essential.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Anybody ever notice...

2006-06-12 Thread apjaworski
I am guessing you are starting Rcmdr using

> library(Rcmdr).

If this is the case, repeating the library command does nothing, since
Rcmdr package is already attached.  Try

> Commander()

instead.  Make sure you use capital C.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 "AKA" 
 <[EMAIL PROTECTED] 
 com>   To 
 Sent by:
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Anybody ever notice...  
 06/12/2006 05:21  
 PM
   
   
   
   




It could be a little bug or a fault in my setup but I notice that after I
end an Rcmdr session I can't restart it without restarting Rgui (Windows)
Do I need to add something to my environment variables? Is it an issue with
Tcl/Tk or it's settings? Or what?
It is not a big deal but if someone has a fix for this I would give it a
shot I usually start Rcmd from the console library(Rcmdr) that have
anything
to do with it?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Group averages

2006-06-12 Thread Gabor Grothendieck
Assuming that yr and conf are the two factors referred to in the
description, create a function f which calculates the ith row
of the output and use sapply like this:

attach(data)
f <- function(i) {
hsgpa <- na.omit(hsgpa[-i][conf[-i] == conf[i] & yr[-i] == yr[i]])
if (length(hsgpa)) c(mean = mean(hsgpa), var = var(hsgpa))
else c(mean = NA, var = NA)
}
out <- t(sapply(1:nrow(data), f))

On 6/12/06, David Kling <[EMAIL PROTECTED]> wrote:
> Hello:
>
> I hope none of you will mind helping a newbie.  I'm a student research
> assistant working with a large data set in which observations are
> categorized according to two factors. I'm trying to calculate the group
> mean and variance of a variable (called 'hsgpa' in the example data
> presented below) to each observation  , excluding that observation.  For
> example, if there are 20 observations with the same value of the two
> factors, for each of the 20 I'd like to generate the mean and variance
> of the 'hsgpa' values of the other 19 group members.  This must be done
> for every observation in the data set.
>
> I've searched the R mail archives, read the manuals, and read
> documentation for tapply() andby() as well as summaryBy() in the 'doBy'
> package and with() from 'Hmisc.'  It may be that since I'm new to
> writing functions and R is the first language I've ever worked with I'm
> less able to come up with a solution than some other new R users.  None
> of the functions I have tried have been succesful, and it doesn't seem
> worth it to reproduce and explain my best effort.  I hope someone has
> some ideas!  Looking at what an experienced user would try should help
> me with my present task as well as future problems.
>
> Below I've included some lines that will generate a sample data set
> similar to the one I'm working with:
>
> #
> #Example data:
> #
> case <- sample(seq(1,1,1),5000,replace=FALSE)
> hsgpa <- rbeta(5000,7,1.5)*4.25
> yr <- sample(seq(1993,2005,1),5000,replace=TRUE)
> conf <- sample(letters[1:5],5000,replace=TRUE)
> data <- data.frame(case=case,hsgpa=hsgpa,yr=yr,conf=conf)
> data$conf <- as.character(data$conf)
> s1 <- sample(seq(1,5000,1),500,replace=FALSE)
> k <- data$hsgpa
> k[row.names(data) %in% s1] <- NA
> data$hsgpa <- k
> s2 <- sample(seq(1,5000,1),100,replace=FALSE)
> k <- data$yr
> k[row.names(data) %in% s2] <- NA
> data$yr <- k
> k <- data$conf
> k[row.names(data) %in% s2] <- NA
> data$conf <- k
> remove(case,hsgpa,yr,conf,s1,s2,k)
> #
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Group averages

2006-06-12 Thread jim holtman
Not exactly sure what you mean, but here is something that might be close.
I used only a subset of your data to see it this is what you want.  This
computes the mean of all hpgpa, excluding that row:

> data[x[['2005.e']],]  # subset of your data for yr=2005, conf='e'
 casehsgpa   yr conf
73   3442 3.406104 2005e
216  3017 4.071830 2005e
284  3626 3.418870 2005e
797  2184 3.459729 2005e
881  3030 3.147831 2005e
1030 9600 4.140025 2005e
1071 1972 3.423202 2005e
1100 8293 3.880199 2005e
1219 5162 3.470179 2005e
1276 5905 3.533801 2005e
1312 3785 3.521670 2005e
1363 8880 2.975047 2005e
1426  123 3.070349 2005e
1427  947   NA 2005e
1475 3592 3.955794 2005e
1635  366 3.172360 2005e
1708 5257 3.612822 2005e
1736 6256   NA 2005e
1831 2112 3.719371 2005e
1943 6528 3.322816 2005e
1997  553   NA 2005e
2208 2849 3.657016 2005e
2240 6543   NA 2005e
2360 9360   NA 2005e
2611 4354 3.123671 2005e
2659 1444 4.080455 2005e
2704 9502   NA 2005e
2714 8594 3.657861 2005e
2732 4453 2.251620 2005e
2778  875 3.913294 2005e
2802 4022 3.970620 2005e
2884 4473 3.650706 2005e
2945  181 3.777851 2005e
3059 6755 3.809683 2005e
3327 8153   NA 2005e
3380 3737 3.676996 2005e
3404 4419 2.306697 2005e
3577 3577 4.196025 2005e
3608  457 4.150389 2005e
3857 8642 3.220720 2005e
3967  482 2.147233 2005e
4122 4363   NA 2005e
4185  651 4.087515 2005e
4226  544 4.153056 2005e
4362 1496 3.835143 2005e
4475 1614 3.978524 2005e
4680 6883 3.633342 2005e
4739 5212   NA 2005e
4843 3515 3.020855 2005e
4867 2580 3.814048 2005e
4887 7937 3.797753 2005e
> y <- data[x[['2005.e']],]
> str(y)
`data.frame':   51 obs. of  4 variables:
 $ case : num  3442 3017 3626 2184 3030 ...
 $ hsgpa: num  3.41 4.07 3.42 3.46 3.15 ...
 $ yr   : num  2005 2005 2005 2005 2005 ...
 $ conf : chr  "e" "e" "e" "e" ...
> # compute the mean of all except the given row
> sapply(seq(nrow(y)), function(x) mean(y$hsgpa[-x],na.rm=TRUE))
 [1] 3.556268 3.540030 3.555956 3.554960 3.562567 3.538367 3.555851 3.544704
3.554705 3.553153
[11] 3.553449 3.566781 3.564457 3.552692 3.542861 3.561969 3.551226 3.552692
3.548627 3.558299
[21] 3.552692 3.550148 3.552692 3.552692 3.563156 3.539820 3.552692 3.550127
3.584426 3.543897
[31] 3.542499 3.550302 3.547201 3.546424 3.552692 3.549660 3.583082 3.537001
3.538114 3.560789
[41] 3.586972 3.552692 3.539648 3.538049 3.545803 3.542306 3.550725 3.552692
3.565664 3.546318
[51] 3.546715
> y$mean <- sapply(seq(nrow(y)), function(x) mean(y$hsgpa[-x],na.rm=TRUE))
> y
 casehsgpa   yr conf mean
73   3442 3.406104 2005e 3.556268
216  3017 4.071830 2005e 3.540030
284  3626 3.418870 2005e 3.555956
797  2184 3.459729 2005e 3.554960
881  3030 3.147831 2005e 3.562567
1030 9600 4.140025 2005e 3.538367
1071 1972 3.423202 2005e 3.555851
1100 8293 3.880199 2005e 3.544704
1219 5162 3.470179 2005e 3.554705
1276 5905 3.533801 2005e 3.553153
1312 3785 3.521670 2005e 3.553449
1363 8880 2.975047 2005e 3.566781
1426  123 3.070349 2005e 3.564457
1427  947   NA 2005e 3.552692
1475 3592 3.955794 2005e 3.542861
1635  366 3.172360 2005e 3.561969
1708 5257 3.612822 2005e 3.551226
1736 6256   NA 2005e 3.552692
1831 2112 3.719371 2005e 3.548627
1943 6528 3.322816 2005e 3.558299
1997  553   NA 2005e 3.552692
2208 2849 3.657016 2005e 3.550148
2240 6543   NA 2005e 3.552692
2360 9360   NA 2005e 3.552692
2611 4354 3.123671 2005e 3.563156
2659 1444 4.080455 2005e 3.539820
2704 9502   NA 2005e 3.552692
2714 8594 3.657861 2005e 3.550127
2732 4453 2.251620 2005e 3.584426
2778  875 3.913294 2005e 3.543897
2802 4022 3.970620 2005e 3.542499
2884 4473 3.650706 2005e 3.550302
2945  181 3.777851 2005e 3.547201
3059 6755 3.809683 2005e 3.546424
3327 8153   NA 2005e 3.552692
3380 3737 3.676996 2005e 3.549660
3404 4419 2.306697 2005e 3.583082
3577 3577 4.196025 2005e 3.537001
3608  457 4.150389 2005e 3.538114
3857 8642 3.220720 2005e 3.560789
3967  482 2.147233 2005e 3.586972
4122 4363   NA 2005e 3.552692
4185  651 4.087515 2005e 3.539648
4226  544 4.153056 2005e 3.538049
4362 1496 3.835143 2005e 3.545803
4475 1614 3.978524 2005e 3.542306
4680 6883 3.633342 2005e 3.550725
4739 5212   NA 2005e 3.552692
4843 3515 3.020855 2005e 3.565664
4867 2580 3.814048 2005e 3.546318
4887 7937 3.797753 2005e 3.546715
>



On 6/12/06, David Kling <[EMAIL PROTECTED]> wrote:
>
> Hello:
>
> I hope none of you will mind helping a newbie.  I'm a student research
> assistant working with a large data set in which observations are
> categorized according to two factors. I'm trying to calculate the group
> mean and variance of a variable (

[R] Anybody ever notice...

2006-06-12 Thread AKA
It could be a little bug or a fault in my setup but I notice that after I
end an Rcmdr session I can't restart it without restarting Rgui (Windows)
Do I need to add something to my environment variables? Is it an issue with
Tcl/Tk or it's settings? Or what?
It is not a big deal but if someone has a fix for this I would give it a
shot I usually start Rcmd from the console library(Rcmdr) that have anything
to do with it?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] non parametric estimates of the hazard with right censored data

2006-06-12 Thread Dimitri Szerman
Hi,

I want to plot non parametric estimates of the empirical hazard function for
right censored data. I've tried many functions from different packages
(muhaz, Design, survival, eha, event), but none of them gave me what I
wanted. Am I missing something?

Here's what I want. The data below is the same used by Kiefer (J. Economic
Literature, 1988), which in turns use a subset of the data used by Kiefer
(J. Econometrics, 1985) in his study of strikes duration.

## R

dur = c( 7, 9, 13 ,14 ,26 ,29 ,52 ,80 ,9 ,37 ,41 ,49 ,52 ,80 ,3 ,17 ,19 ,28
,72 ,80 ,80 ,80 ,80 ,80 ,80 ,15 ,61,80,2,25 ,80 ,3 ,10 ,1 ,2 ,2 ,3 ,3 ,4
,8,11 ,22 ,23 ,27 ,32 ,33 ,35 ,43 ,43 ,44 ,80 ,5 ,49 ,2 ,12 ,12 ,21 ,21 ,27
,38 ,42 ,80)

cen = c(1, 1 ,1 ,1 ,1 ,1 ,1 ,0,1 ,1 ,1 ,1 ,1 ,0 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0
,0 ,0 ,1 ,1 ,0 ,1 ,1 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1
,1 ,1 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1,1, 0)

library(survival)
hfit = survfit( Surv(dur, cen) ~ 1 )
tevent = data.frame( tj=summary(hfit)$time,
 hj=summary(hfit)$n.event,
 nj=summary(hfit)$n.risk,

haz=summary(hfit)$n.event/summary(hfit)$n.risk)
plot(tevent$tj, tevent$haz, type="s", xlim=c(0,80), ylim=c(0,.13) )

## END

This plot is the same presented by Kiefer (figure 7). I even managed to plot
the *cumulative*, or *integrated* hazard (figure 8), but the hazard itself.
As you can see, I could do it myself, but as I want to do (many, many) plots
by strata, a ready-to-go function would help a lot.


Thany you so much,

Dimitri

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Group averages

2006-06-12 Thread David Kling
Hello:

I hope none of you will mind helping a newbie.  I'm a student research 
assistant working with a large data set in which observations are 
categorized according to two factors. I'm trying to calculate the group 
mean and variance of a variable (called 'hsgpa' in the example data 
presented below) to each observation  , excluding that observation.  For 
example, if there are 20 observations with the same value of the two 
factors, for each of the 20 I'd like to generate the mean and variance 
of the 'hsgpa' values of the other 19 group members.  This must be done 
for every observation in the data set.

I've searched the R mail archives, read the manuals, and read 
documentation for tapply() andby() as well as summaryBy() in the 'doBy' 
package and with() from 'Hmisc.'  It may be that since I'm new to 
writing functions and R is the first language I've ever worked with I'm 
less able to come up with a solution than some other new R users.  None 
of the functions I have tried have been succesful, and it doesn't seem 
worth it to reproduce and explain my best effort.  I hope someone has 
some ideas!  Looking at what an experienced user would try should help 
me with my present task as well as future problems.

Below I've included some lines that will generate a sample data set 
similar to the one I'm working with:

#
#Example data:
#
case <- sample(seq(1,1,1),5000,replace=FALSE)
hsgpa <- rbeta(5000,7,1.5)*4.25
yr <- sample(seq(1993,2005,1),5000,replace=TRUE)
conf <- sample(letters[1:5],5000,replace=TRUE)
data <- data.frame(case=case,hsgpa=hsgpa,yr=yr,conf=conf)
data$conf <- as.character(data$conf)
s1 <- sample(seq(1,5000,1),500,replace=FALSE)
k <- data$hsgpa
k[row.names(data) %in% s1] <- NA
data$hsgpa <- k
s2 <- sample(seq(1,5000,1),100,replace=FALSE)
k <- data$yr
k[row.names(data) %in% s2] <- NA
data$yr <- k
k <- data$conf
k[row.names(data) %in% s2] <- NA
data$conf <- k
remove(case,hsgpa,yr,conf,s1,s2,k)
#

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] multivariate quantile estimation

2006-06-12 Thread Anna Oganyan
Hello,
is there any function/package in R for multivariate quantile estimation?
(I couldn't find any for the moment)
Thank you!
Anna

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] scripts to process array CGH data files from NimbleGen

2006-06-12 Thread Steven McKinney


Before I reinvent the wheel, has anyone set up scripts to read in
array CGH data files from NimbleGen, for use in the aCGH package or
a similar package?

I have normalized NimbleGen files
([array_id]_[identifier]_normalized.txt in the NimbleGen naming scheme)
several to a directory, to read in and use to create an aCGH object.

Any info appreciated.

Best

Steve McKinney



Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] bootstrap cauchy

2006-06-12 Thread Paulius Ptakauskas
Hi,
   
  I have some problems – I have a Cauchy distribution with density function 
   
  f(x) = sigma / (pi * (sigma^2 + (x- miu)^2) ), 
   
  where sigma = scale and miu = location (in my case sigma = 3, miu = 0), and I 
have to find with bootstrap
   
  E | sigma_estimated^3 – sigma^3 |  (#),
   
  where sigma_estimated, I guess, is  bootstrap estimate. 
   
  So, I can find sigma with R function fitdistr() from the real data, witch are 
generated with rcauchy(1000, 0, 3), I guess sigma_estimated I can find with  
function fitdistr too, but I don’t know how to take just scale column. Anyone 
knows? 
   
  Ok, if my bootstrap will have R=1000 I have to find (#) something like this:
   
  E | sigma_estimated^3 – sigma^3 | = (1/R) * sum (r = 1:R) [|sigma_boot(r)^3 – 
sigma^3|]?
   
  Next problem – I have with kernel estimate a density f() function? How can I 
do this with R?
   
  And the last – with bootstrap I have to estimate a characteristic function, 
witch is 
   
  c = exp{i*t*miu – sigma|t|} (in my case it will be c = exp{– sigma|t|})? Is 
it possible to solve this problem with R?
   
   
   
  Sorry for my broken English and huge thanks to everyone who will help me! :)
   

 __



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] r's optim vs. matlab's fminsearch

2006-06-12 Thread Michael H. Prager
In using Nelder-Mead outside R, I find it critical to restart the 
algorithm (repeatedly) after it thinks it's found a solution, to see if 
it can do better.  I can't say whether the R and Matlab implementations 
do this automatically or not.


on 6/12/2006 3:00 PM Anthony Bishara said the following:
>   Thanks for the feedback.  I should've mentioned before that the
> function is non-smooth.  Also, it has a 3-element free parameter vector, and
> I've been using a grid of 27 vectors of starting parameters.  
>
> Anthony
>
> -Original Message-
> From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
> Sent: Monday, June 12, 2006 1:40 PM
> To: Anthony Bishara
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] r's optim vs. matlab's fminsearch
>
> Unless you know the function to be non-smooth, I suggest you use 
> method="BFGS" in R.
>
> BTW, all such algorithms are only designed to find local minima, and so 
> the choice of starting point may be crucial.
>
> On Mon, 12 Jun 2006, Anthony Bishara wrote:
>
>   
>> Hi,
>> I'm having a problem converting a Matlab program into R.  The R code works
>> almost all the time, but about 4% of the time R's optim function gets
>> 
> stuck
>   
>> on a local minimum whereas matlab's fminsearch function does not (or at
>> least fminsearch finds a better minimum than optim).  My understanding is
>> that both functions default to Nelder-Mead optimization, but what's
>> different about the two functions?  Below, I've pasted the relevant
>> 
> default
>   
>> options I could find. Are there other options I should to consider?  Does
>> Matlab have default settings for reflection, contraction, and expansion,
>> 
> and
>   
>> if so what are they?  Are there other reasons optim and fminsearch might
>> work differently?
>> Thanks.
>>
>> ***Matlab's fminsearch defaults***
>> MaxFunEvals: '200*numberofvariables'
>> MaxIter: '200*numberofvariables'
>> TolFun: 1.e-004  #Termination tolerance on the function
>> value.
>> TolX: 1.e-004#Termination tolerance on x.
>>
>> ***R's optim defaults (for Nelder-Mead)***
>> maxit=500
>> reltol=1e-8
>> alpha=1.0#Reflection
>> beta=.5  #Contraction
>> gamma=2.0#Expansion
>>
>>
>> Anthony J. Bishara
>> Post-Doctoral Fellow
>> Department of Psychological & Brain Sciences
>> Indiana University
>> 1101 E. Tenth St.
>> Bloomington, IN 47405
>> (812)856-4678
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> 
> http://www.R-project.org/posting-guide.html
>   
>
>   

-- 
Michael Prager, Ph.D.
Southeast Fisheries Science Center
NOAA Center for Coastal Fisheries and Habitat Research
Beaufort, North Carolina  28516
** Opinions expressed are personal, not official.  No
** official endorsement of any product is made or implied.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] r's optim vs. matlab's fminsearch

2006-06-12 Thread Anthony Bishara
Thanks for the feedback.  I should've mentioned before that the
function is non-smooth.  Also, it has a 3-element free parameter vector, and
I've been using a grid of 27 vectors of starting parameters.  

Anthony

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 12, 2006 1:40 PM
To: Anthony Bishara
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] r's optim vs. matlab's fminsearch

Unless you know the function to be non-smooth, I suggest you use 
method="BFGS" in R.

BTW, all such algorithms are only designed to find local minima, and so 
the choice of starting point may be crucial.

On Mon, 12 Jun 2006, Anthony Bishara wrote:

> Hi,
> I'm having a problem converting a Matlab program into R.  The R code works
> almost all the time, but about 4% of the time R's optim function gets
stuck
> on a local minimum whereas matlab's fminsearch function does not (or at
> least fminsearch finds a better minimum than optim).  My understanding is
> that both functions default to Nelder-Mead optimization, but what's
> different about the two functions?  Below, I've pasted the relevant
default
> options I could find. Are there other options I should to consider?  Does
> Matlab have default settings for reflection, contraction, and expansion,
and
> if so what are they?  Are there other reasons optim and fminsearch might
> work differently?
> Thanks.
>
> ***Matlab's fminsearch defaults***
> MaxFunEvals: '200*numberofvariables'
> MaxIter: '200*numberofvariables'
> TolFun: 1.e-004   #Termination tolerance on the function
> value.
> TolX: 1.e-004 #Termination tolerance on x.
>
> ***R's optim defaults (for Nelder-Mead)***
> maxit=500
> reltol=1e-8
> alpha=1.0 #Reflection
> beta=.5   #Contraction
> gamma=2.0 #Expansion
>
>
> Anthony J. Bishara
> Post-Doctoral Fellow
> Department of Psychological & Brain Sciences
> Indiana University
> 1101 E. Tenth St.
> Bloomington, IN 47405
> (812)856-4678
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] select the last row by id group

2006-06-12 Thread Gabor Grothendieck
Try this:

score[tapply(rownames(score), score$id, tail, 1),]


On 6/12/06, Tony Chu <[EMAIL PROTECTED]> wrote:
>  Dear R users:
>
>  I have a small test dataframe as the follows :
>
> math = c(80,75,70,65,65,70)
> reading = c(65,70,88,NA,90,NA)
> id = c('001','001','001','002','003','003')
> score = data.frame(id, reading, math)
>
> > score
>   id reading math
> 1 001  65   80
> 2 001  70   75
> 3 001  88   70
> 4 002  NA   65
> 5 003  9065
> 6 003  NA   70
>
>  Could someone advise me tips about how to select the last row from
> each id group of 001, 002, & 003?
>
> In other words, the rows I need are :
>
>   id reading math
> 3 001  88   70
> 4 002  NA   65
> 6 003  NA   70
>
>  I tried function sebset but could not go very far. Thanks !
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] select the last row by id group

2006-06-12 Thread Dimitrios Rizopoulos
one approach is the following:

math <- c(80, 75, 70, 65, 65, 70)
reading <- c(65, 70, 88, NA, 90, NA)
id <- c('001', '001', '001', '002', '003', '003')
score <- data.frame(id, reading, math)
#
ind <- cumsum(tapply(score$id, score$id, length))
score[ind, ]


I hope it helps.

Best,
Dimitris

 
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Tony Chu <[EMAIL PROTECTED]>:

>   Dear R users:
> 
>   I have a small test dataframe as the follows :
> 
> math = c(80,75,70,65,65,70)
> reading = c(65,70,88,NA,90,NA)
> id = c('001','001','001','002','003','003')
> score = data.frame(id, reading, math)
> 
> > score
>id reading math
> 1 001  65   80
> 2 001  70   75
> 3 001  88   70
> 4 002  NA   65
> 5 003  9065
> 6 003  NA   70
> 
>   Could someone advise me tips about how to select the last row from
> each id group of 001, 002, & 003?
> 
> In other words, the rows I need are :
> 
>id reading math
> 3 001  88   70
> 4 002  NA   65
> 6 003  NA   70
> 
>  I tried function sebset but could not go very far. Thanks !
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] r's optim vs. matlab's fminsearch

2006-06-12 Thread Spencer Graves
  Have you also tried 'nlminb'?  A year or so ago, Doug Bates switched 
from optim to nlminb for mixed-effects estimation.  I'm not certain I 
know why, but I think 'nlminb' may automatically adjust the 'scale' 
parameter by default, while "optim" does not automatically adjust the 
comparable 'control$parscale'.  If Matlab does reasonable auto-scaling, 
that might explain the difference.  Others (e.g., Professors Ripley and 
Bates) might be able to add more.

  There might be more information on this in 'RSiteSearch', but I think 
it's temporarily off line right now.  And, of course, you can always 
read the R code.  Both 'nlminb' and 'optim' call compiled code, but the 
source should be available.

  Hope this helps,
  Spencer Graves

Prof Brian Ripley wrote:
> Unless you know the function to be non-smooth, I suggest you use 
> method="BFGS" in R.
> 
> BTW, all such algorithms are only designed to find local minima, and so 
> the choice of starting point may be crucial.
> 
> On Mon, 12 Jun 2006, Anthony Bishara wrote:
> 
>> Hi,
>> I'm having a problem converting a Matlab program into R.  The R code works
>> almost all the time, but about 4% of the time R's optim function gets stuck
>> on a local minimum whereas matlab's fminsearch function does not (or at
>> least fminsearch finds a better minimum than optim).  My understanding is
>> that both functions default to Nelder-Mead optimization, but what's
>> different about the two functions?  Below, I've pasted the relevant default
>> options I could find. Are there other options I should to consider?  Does
>> Matlab have default settings for reflection, contraction, and expansion, and
>> if so what are they?  Are there other reasons optim and fminsearch might
>> work differently?
>> Thanks.
>>
>> ***Matlab's fminsearch defaults***
>> MaxFunEvals: '200*numberofvariables'
>> MaxIter: '200*numberofvariables'
>> TolFun: 1.e-004  #Termination tolerance on the function
>> value.
>> TolX: 1.e-004#Termination tolerance on x.
>>
>> ***R's optim defaults (for Nelder-Mead)***
>> maxit=500
>> reltol=1e-8
>> alpha=1.0#Reflection
>> beta=.5  #Contraction
>> gamma=2.0#Expansion
>>
>>
>> Anthony J. Bishara
>> Post-Doctoral Fellow
>> Department of Psychological & Brain Sciences
>> Indiana University
>> 1101 E. Tenth St.
>> Bloomington, IN 47405
>> (812)856-4678
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] r's optim vs. matlab's fminsearch

2006-06-12 Thread Prof Brian Ripley
Unless you know the function to be non-smooth, I suggest you use 
method="BFGS" in R.

BTW, all such algorithms are only designed to find local minima, and so 
the choice of starting point may be crucial.

On Mon, 12 Jun 2006, Anthony Bishara wrote:

> Hi,
> I'm having a problem converting a Matlab program into R.  The R code works
> almost all the time, but about 4% of the time R's optim function gets stuck
> on a local minimum whereas matlab's fminsearch function does not (or at
> least fminsearch finds a better minimum than optim).  My understanding is
> that both functions default to Nelder-Mead optimization, but what's
> different about the two functions?  Below, I've pasted the relevant default
> options I could find. Are there other options I should to consider?  Does
> Matlab have default settings for reflection, contraction, and expansion, and
> if so what are they?  Are there other reasons optim and fminsearch might
> work differently?
> Thanks.
>
> ***Matlab's fminsearch defaults***
> MaxFunEvals: '200*numberofvariables'
> MaxIter: '200*numberofvariables'
> TolFun: 1.e-004   #Termination tolerance on the function
> value.
> TolX: 1.e-004 #Termination tolerance on x.
>
> ***R's optim defaults (for Nelder-Mead)***
> maxit=500
> reltol=1e-8
> alpha=1.0 #Reflection
> beta=.5   #Contraction
> gamma=2.0 #Expansion
>
>
> Anthony J. Bishara
> Post-Doctoral Fellow
> Department of Psychological & Brain Sciences
> Indiana University
> 1101 E. Tenth St.
> Bloomington, IN 47405
> (812)856-4678
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] select the last row by id group

2006-06-12 Thread Tony Chu
  Dear R users:

  I have a small test dataframe as the follows :

math = c(80,75,70,65,65,70)
reading = c(65,70,88,NA,90,NA)
id = c('001','001','001','002','003','003')
score = data.frame(id, reading, math)

> score
   id reading math
1 001  65   80
2 001  70   75
3 001  88   70
4 002  NA   65
5 003  9065
6 003  NA   70

  Could someone advise me tips about how to select the last row from
each id group of 001, 002, & 003?

In other words, the rows I need are :

   id reading math
3 001  88   70
4 002  NA   65
6 003  NA   70

 I tried function sebset but could not go very far. Thanks !

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] r's optim vs. matlab's fminsearch

2006-06-12 Thread Anthony Bishara
Hi,
I'm having a problem converting a Matlab program into R.  The R code works
almost all the time, but about 4% of the time R's optim function gets stuck
on a local minimum whereas matlab's fminsearch function does not (or at
least fminsearch finds a better minimum than optim).  My understanding is
that both functions default to Nelder-Mead optimization, but what's
different about the two functions?  Below, I've pasted the relevant default
options I could find. Are there other options I should to consider?  Does
Matlab have default settings for reflection, contraction, and expansion, and
if so what are they?  Are there other reasons optim and fminsearch might
work differently?
Thanks.

***Matlab's fminsearch defaults***
MaxFunEvals: '200*numberofvariables'
MaxIter: '200*numberofvariables'
TolFun: 1.e-004 #Termination tolerance on the function
value.
TolX: 1.e-004   #Termination tolerance on x.

***R's optim defaults (for Nelder-Mead)***
maxit=500
reltol=1e-8
alpha=1.0   #Reflection
beta=.5 #Contraction
gamma=2.0   #Expansion  


Anthony J. Bishara
Post-Doctoral Fellow
Department of Psychological & Brain Sciences
Indiana University
1101 E. Tenth St.
Bloomington, IN 47405
(812)856-4678

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [R-pkgs] New version of Subselect package

2006-06-12 Thread Jorge Cadima

Version 0.9-99 of package "subselect" is now on CRAN. 

The subselect package has functions that search for k-variable subsets
of a p-variable (p>k) data set that are optimal under some
criterion. Search algorithms include a full search algorithm "leaps",
based on Furnival and Wilson's leaps and bounds algorithm, and three
random search algorithms: a genetic algorithm ("genetic"), a simulated
annealing algorithm ("anneal") and a modified local search algorithm
("improve"). Previous versions of subselect had three criteria for
optimality ("rm", "rv" and "gcd"), based on exploratory data analysis
considerations. This new version adds four new criteria ("tau2",
"zeta2", "xi2" and "ccr12"), associated with the multivariate linear
hypothesis and the well-known test statistics for that hypothesis
(Wilks' lambda, Roy's largest root, Pillai's trace and the
Hotelling-Lawley statistic). Subselect 0.9-99 also includes two
functions that prepare the arguments for the search functions
associated with the new criteria in the most frequent contexts of
application of the multivariate linear hypothesis - linear regression
(function "lmHmat") and linear discriminant analysis ("ldaHmat") - as
well as another function ("glhHmat") that prepares these arguments for
an analysis associated with a hypothesis specified by the user. The
package documentation includes numerous examples.  

Feedback is appreciated.

Best regards,
Jorge Cadima


-- 
Jorge Cadima
Departamento de Matemática
Instituto Superior de Agronomia
Universidade Técnica de Lisboa
Tapada da Ajuda
1349-017 Lisboa
Portugal

e-mail: [EMAIL PROTECTED]
phone: +351 21 365 3317
fax: +351 21 363 07 23

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R usage for log analysis

2006-06-12 Thread Duncan Temple Lang

Using Perl or R shouldn't be an either/or issue.
We can call Perl code from R (via RSPerl at least)
and then we get the benefit of well tested, fast code
that might exist in Perl to read the log files
and the ability to do interactive, exploratory analysis in R.
And reading the file in Perl does give a significant reduction
in compute time and memory.

When I do this I put the logs into a database, but I use a
one-line Perl script to get them into the appropriate format.

Xiaoting Hua wrote:
> I heared some project use Perl to analysis log file. And I don't think
> it's suit to analysis log file for R.
> 
> On 6/11/06, Gabriel Diaz <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> Is there any software project that uses R to do log file analisys?
>>
>> thanks
>>
>> gabi
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>>
> 
> 
> 
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R usage for log analysis

2006-06-12 Thread Allen S. Rout
"Gabriel Diaz" <[EMAIL PROTECTED]> writes:

> I'm taking an overview to the project documentation, and seems the
> database is the way to go to handle log files of GB order (normally
> between 2 and 4 GB each 15 day dump).

> In this document http://cran.r-project.org/doc/manuals/R-data.html,
> says R will load all data into memory to process it when using
> read.table and such. Using a database will do the same? Well,
> currently i have no machine with > 2 GB of memory.

Remember, swap too.  This means you're using more time, not running
into a hard limit.

If you're concerned about gross size, then preprocessing could be
useful; but consider: RAM is cheap.  Calibrate RAM purchases
w.r.t. hours of your coding time, -before- you start the project.
Then you can at least mutter to yourself when you waste more than the
cost of core trying to make the problem small. :)

It's entirely reasonable to do all your development work on a smaller
set, and then dump the real data into it and go home.  Unless you've
got something O(N^2) or so, you should be fine.


- Allen S. Rout

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] nested mixed-effect model: variance components

2006-06-12 Thread Christoph Buser
Dear Eric

Do you really have habitats nested within lagoons or are they
partially crossed (meaning that you have the same habitats in
different lagoons)?

If you have them perfectly nested, I think that you cannot
calculate both a fixed effect for habitats and a random effect
for lagoon (see the example below, lme and aov).

You can compare e.g. two lagoons by defining a contrast of the
habitats of one lagoon against the habitats of the other (if you
think that this is a meaningful test to interpret), but you
cannot estimate a random effect lagoon in presence of a nested
FIXED effect habitat. 

aov() will not return you the test and warn you about the
singular model. 

lme() will estimate a variance component for lagoon, but does
not provide you a test for the fixed factor.

Regards,

Christoph Buser



set.seed(1)
dat <- data.frame(y = rnorm(100), lagoon = factor(rep(1:4,each = 25)),
  habitat = factor(rep(1:20, each = 5)))

summary(aov(y~habitat + Error(lagoon/habitat), data = dat))

library(nlme)
summary(lme(y~habitat, random = ~1|lagoon/habitat, data = dat))


--
Christoph Buser <[EMAIL PROTECTED]>
Seminar fuer Statistik, LEO C13
ETH Zurich  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--



Eric Pante writes:
 > Dear listers,
 > 
 > I am trying to assess variance components for a nested, mixed-effects 
 > model. I think I got an answer that make sense from R, but I have a 
 > warning message and I wanted to check that what I am looking at is 
 > actually what I need:
 > 
 > my data are organized as transects within stations, stations within 
 > habitats, habitats within lagoons.
 > lagoons: random, habitats: fixed
 > the question is: how much variation is due to lagoons? habitats? 
 > lagoons*habitat? transects?
 > 
 > Here is my code:
 > 
 > res <- aov(COVER ~ HABITAT + Error(HABITAT+LAGOON+LAGOON/HABITAT), 
 > data=cov)
 > summary(res)
 > 
 > and I get Sum Sq for each to calculate variance components:
 > 
 > Error: STRATE
 > Df Sum Sq Mean Sq
 > STRATE  5 4493.1   898.6
 > 
 > Error: ATOLL
 >Df Sum Sq Mean Sq F value Pr(>F)
 > Residuals  5 3340.5   668.1
 > 
 > Error: STRATE:ATOLL
 >Df  Sum Sq Mean Sq F value Pr(>F)
 > Residuals 18 2442.71  135.71
 > 
 > Error: Within
 > Df Sum Sq Mean Sq F value Pr(>F)
 > Residuals 145 6422.044.3
 > 
 > My error message seems to come from the LAGOON/HABITAT, the Error is 
 > computed.
 > Warning message: Error() model is singular in: aov(COVER ~ HABITAT + 
 > Error(HABITAT+LAGOON+LAGOON/HABITAT), data=cov),
 > 
 > THANKS !!!
 > eric
 > 
 > 
 > 
 > Eric Pante
 > 
 > College of Charleston, Grice Marine Laboratory
 > 205 Fort Johnson Road, Charleston SC 29412
 > Phone: 843-953-9190 (lab)  -9200 (main office)
 > 
 > 
 >  "On ne force pas la curiosite, on l'eveille ..."
 >  Daniel Pennac
 > 
 > __
 > R-help@stat.math.ethz.ch mailing list
 > https://stat.ethz.ch/mailman/listinfo/r-help
 > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Calculating survival for set time intervals

2006-06-12 Thread Thomas Lumley
On Sat, 10 Jun 2006, Gregory Pierce wrote:

> Hello friends and fellow R users,
>
> I have successfully tabulated and entered my survival data into R and
> have generated survival curves. But I would like to be able to determine
> what the survival rates are now at one month, three months, six months
> and one year.
>
> I have a data set, via.wall, which I have entered into R, and which
> generates the following Surv object:
>
> Surv(Days,Status==1)
>  [1] 648+   3  109  241   997  849+ 1053+ 539+ 121   42  490
> 21  870+
> [16] 175   20  434  289  826+ 831+ 664  698+   5   24  655+  187+
> 85+  65+
> [31] 547+   81   55+  69  499+ 448+   0  158+  31  246+ 230+  19
> 118+  54
> [46]  48+  45+  21+ 670+ 585  558+ 544+ 494  481+ 474+ 472+ 461  447
> 446+ 443+
> [61] 429+ 423+ 401  395+ 390  390+ 389+ 383+ 383+ 373+ 362+ 354  344+
> 342  336+
> [76] 335+ 326+ 306  300+ 292  284+ 280+ 271  246+ 237+ 234  233+ 233
> 230+ 230+
> [91] 226+ 225+ 218+ 215  211+ 199+ 191+ 191  190+ 184+ 169+ 163+ 161+
> 153  150
> [106] 129+ 110+ 107+ 100+  84+  77+  69+  52+  38+  11+
>> names(wall.via)
> [1] "Description" "Patient" "Physician"   "MRN" "Age"
> [6] "Status"  "Days""Cr"  "INR" "BR"
> [11] "MELD""type"
>
> I can guess pretty accurately by looking at the graph what the survival
> rates are at each interval, but I would like to understand how to
> instruct R to calculate it. Hope I have made this clear. I am just a
> beginner, so forgive me if this is trivial. It just isn't clear to me.

You will have generated survival curves with survfit().  Give them to 
summary() and specify the times you want. For example, using one of the 
built-in data sets:

> fit <- survfit(Surv(time, status) ~ x, data = aml)
> summary(fit,times=c(10,20,30,40))
Call: survfit(formula = Surv(time, status) ~ x, data = aml)

 x=Maintained
  time n.risk n.event survival std.err lower 95% CI upper 95% CI
10 10   10.909  0.08670.7541.000
20  7   20.716  0.13970.4881.000
30  5   10.614  0.15260.3770.999
40  3   20.368  0.16270.1550.875

 x=Nonmaintained
  time n.risk n.event survival std.err lower 95% CI upper 95% CI
10  8   40.667   0.136   0.44680.995
20  6   10.583   0.142   0.36160.941
30  4   30.292   0.139   0.11480.741
40  2   10.194   0.122   0.05690.664


-thomas


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Maximum likelihood estimation of Regression parameters

2006-06-12 Thread Bart Joosen
I'm working with lm for some time, so I know the function.
The problem was that I purchased the book to learn more about linear models
and couldn't find the equivalent for the maximum likelihood in R, I used lm,
mle, and a few others, but it never allow you to set a variance parameter.
But after reading some further, I should be aware of posting to quick, sorry
for that.

I have read the Practical regression and anova in R by Faraway some month
ago, and I know that the Venable and Ripley book should be the one to buy,
but I think I can't find it for about 10$ as I did with the "Applied linear
statistical models".

As I'm not in the position to spend a lot of money an buying books, I should
do my work with the contributed documents, and the "wrong" book.

Thanks for your help and time both of you

Bart

- Original Message -
From: "Spencer Graves" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Bart Joosen" <[EMAIL PROTECTED]>; 
Sent: Sunday, June 11, 2006 5:20 PM
Subject: Re: [R] Maximum likelihood estimation of Regression parameters


>   Have you looked at "lm"?  I think that's what you want.
>
>   Also, have you reviewed the "Documentation" list at
> "www.r-project.org"?  Neter, Kutner, nachtsheim & Wasserman has had a
> long and successful run having first appeared in 1974 and having gone
> through several editions since then.  However, it apparently has not
> kept up with the R revolution, and I would not recommend it today.
>
>   Beyond this, if you don't have Venables and Ripley (2002) Modern
> Applied Statistics with S (Springer), I recommend you look at it first.
>   It has numerous index entries on "regression" and is all around my
> favorite book on R generally.
>
>   Also, have you checked the "Documentation" briefly outlined at
> 'www.r-project.org', including the "Contributed Documentation" on CRAN,
> and "Practical Regression and Anova using R" by Faraway in particular?
>
>   hope this helps.
>   Spencer Graves
>
> Xiaoting Hua wrote:
> > mle(stats4)Maximum Likelihood Estimation
> >
> > is it list above what you want?
> >
> > On 6/10/06, Bart Joosen <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >>
> >> I want to use Maximum likelihood to estimate the parameters from my
> >> regression line.
> >> I have purchased the book "Applied linear statistical models" from
> >> Neter, Kutner, nachtsheim & Wasserman, and in one of the first
> >> chapters, they use maximum likelihood to estimate the parameters.
> >> Now I want to tried it for my self, but couldn't find the right
function.
> >> In the book, they give a fixed variance to work with, but I couldn't
> >> find a function where I can estimate the predictor and where I have to
> >> give the variance.
> >> Or isn't this neccesairy?
> >> Also they calculate likelihood values for the different values, used
> >> to estimate the parameters (like a normal probability curve), is it
> >> possible to do this with R?
> >>
> >> Kind regards
> >>
> >> Bart
> >>[[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@stat.math.ethz.ch mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide!
> >> http://www.R-project.org/posting-guide.html
> >>
> >
> >
> >
> > 
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R usage for log analysis

2006-06-12 Thread bogdan romocea
I wouldn't use a DBMS at all -- it is not necessary and I don't see
what you would get in return. Instead I would split very large log
files into a number of pieces so that each piece fits in memory (see
below for an example), then process them in a loop. See the list and
the documentation if you have questions about how to read text files,
count strings etc.

#---split big files in two---
for F in `ls *log`
do
  fn=`echo $F | awk -F\. '{print $1}'`
  ln=`wc -l $F | awk '{print $1}'`  #number of lines in the file
  forsplit=`expr $ln / 2 + 50`  #no. of lines in each chunk, tweak as needed
  echo Splitting $F into pieces of $forsplit lines each
  split -l $forsplit $F $fn
done


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Gabriel Diaz
> Sent: Monday, June 12, 2006 9:52 AM
> To: Jean-Luc Fontaine
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] R usage for log analysis
>
> Hello
>
> Thanks all for the answers.
>
> I'm taking an overview to the project documentation, and seems the
> database is the way to go to handle log files of GB order (normally
> between 2 and 4 GB each 15 day dump).
>
> In this document http://cran.r-project.org/doc/manuals/R-data.html,
> says R will load all data into memory to process it when using
> read.table and such. Using a database will do the same? Well,
> currently i have no machine with > 2 GB of memory.
>
> The moodss thing looks nice, thanks for the link. But what i have to
> do now is an offline analysis of big log files :-). I will try to go
> with the mysql -> R way.
>
> gabi
>
>
>
> On 6/12/06, Jean-Luc Fontaine <[EMAIL PROTECTED]> wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Allen S. Rout wrote:
> > >
> > >
> > > Don't expect a warm welcome.  This community is like all
> open-source
> > > communities, sharply focused on its' own concerns and
> expertise.  And,
> > > in an unusual experience for computer types, our core competencies
> > > hold little or no sway here; they don't even give us much
> of a leg up.
> > > Just wait 'till you want to do something nutso like
> produce a business
> > > graphic. :)
> > >
> > > I'm working on understanding enough of R packaging and
> documentation
> > > to begin a 'task view' focused on systems administration,
> for humble
> > > submission. That might end up being mostly "log
> analysis"; the term
> > > can describe much of what we do, if it's stretched a bit.
>  I'm hoping
> > > the task view will attract the teeming masses of
> sysadmins trapped in
> > > the mire of Gnuplot and friends.
> > Although not specifically solving the problem at hand, you
> might want
> > to take a look at moodss and moomps
> (http://moodss.sourceforge.net/),
> > modular monitoring applications, which uses R
> > (http://jfontain.free.fr/statistics.htm) and its log module
> > (http://jfontain.free.fr/log/log.htm).
> >
> > - --
> > Jean-Luc Fontaine  http://jfontain.free.fr/
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.3 (GNU/Linux)
> > Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
> >
> > iD8DBQFEjT2ykG/MMvcT1qQRAuF6AJ9nf5phV/GMmCHPuc5bVyA+SoXqGACgnLuZ
> > u1tZpFOTCHNKOfFLZOC9uXI=
> > =V8yo
> > -END PGP SIGNATURE-
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> >
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Chapters

2006-06-12 Thread Marshall Feldman
Thanks.

Reading the discussion of differences between S and R, I had almost come to
this conclusion but wanted to be sure. Since R keeps its working data in
RAM, the use of chapters seemed unlikely, but I wanted to be sure.

I am, however, surprised this has not come up before. The online
documentation says R is an "implementation" of S, but since there are no
standards defining S versus variations on it, exactly what an
"implementation of S" means is not clear. Besides, other than the online
documentation on R, people using R must use the various books using S. I had
expected others to have asked for clarification on the differences between R
and S, including the various incarnations of the latter.

Thanks again.

Marsh Feldman

Dr. Marshall Feldman
Acting Director of Research and Academic Affairs
Center for Urban Studies and Research 
The University of Rhode Island
80 Washington Street
Providence, RI 02903-1819
email: marsh @ uri.edu (remove spaces) 
telephone: (401) 277-5218
fax: (401) 277-5099


-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 12, 2006 2:07 AM
To: Marshall Feldman
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Chapters

On Sun, 11 Jun 2006, Marshall Feldman wrote:

> I'm surprised this isn't a FAQ, but I searched all over and could not find
a
> reference to it.

I have never seen in mentioned before.  R is not an implementation of S4 
as described in Chambers (1998), so I do not know where you got the idea 
that was relevant.  (The methods package in R is an implementation of 
something close to the class system described in that book, but R can be 
used without the methods package.)

> Chambers (1998) makes repeated references to "Chapters" in S (e.g., p. 6),
> but I can find no reference to "Chapters" in R. Since Chapters were not
used
> in earlier versions of S, I'm wondering if R uses them or not. If it does,
> how does one get them to work? I've been unable to do so.

The closest analogues are

1) packages
2) using different working directories.

Since R does not store objects on file and chapters are directories with 
collections of stored objects (and other things, including DLLs), the 
analogues cannot be very close.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] strange behaviour with rotated viewports in grid

2006-06-12 Thread Rafael Najmanovich
Dear All,

The issue I reported earlier seems to be restricted at least to Mac  
OSX GUI using 2.3.1. It does not occur in the Terminal in Mac OSX (R  
version 2.3.1) or in Linux (R version 2.2.1). I will separately send  
this to r-sig-mac.
Best,

On 12 Jun 2006, at 11:26, Rafael Najmanovich wrote:

>   Dear all,
>
>   I am having a problem using grid when rotating a viewport. It  
> seems to plot everything on a grey background colour which I am not  
> able to get rid of. Even book examples such as that that plot  
> figure 5.10 in P. Murrell's R Graphics book show the same behaviour.
>   The following example illustrates this issue. I would appreciate  
> if anyone has a way to solve this.
>   Best regards,
>
>   r.
>
> pushViewport(viewport(width=0.9,height=0.9,name="vp1"))
> grid.rect()
> pushViewport(viewport(width=0.3,height=0.9,angle=0,name="vp2"))
> grid.rect()
> upViewport()
> pushViewport(viewport(width=0.3,height=0.9,angle=10,name="vp3"))
> grid.rect()
>
>
> Dr. Rafael Najmanovich
> European Bioinformatics Institute
> Wellcome Trust Genome Campus
> Cambridge CB10 1SD
> United Kingdom
>
> [EMAIL PROTECTED] - www.ebi.ac.uk/~rafi
> +44-1223-492599 (voice) +44-7786-968257(mobile) +44-1223-494468 (fax)
>
>

Dr. Rafael Najmanovich
European Bioinformatics Institute
Wellcome Trust Genome Campus
Cambridge CB10 1SD
United Kingdom

[EMAIL PROTECTED] - www.ebi.ac.uk/~rafi
+44-1223-492599 (voice) +44-7786-968257(mobile) +44-1223-494468 (fax)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R usage for log analysis

2006-06-12 Thread Gabriel Diaz
Hello

Thanks all for the answers.

I'm taking an overview to the project documentation, and seems the
database is the way to go to handle log files of GB order (normally
between 2 and 4 GB each 15 day dump).

In this document http://cran.r-project.org/doc/manuals/R-data.html,
says R will load all data into memory to process it when using
read.table and such. Using a database will do the same? Well,
currently i have no machine with > 2 GB of memory.

The moodss thing looks nice, thanks for the link. But what i have to
do now is an offline analysis of big log files :-). I will try to go
with the mysql -> R way.

gabi



On 6/12/06, Jean-Luc Fontaine <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Allen S. Rout wrote:
> >
> >
> > Don't expect a warm welcome.  This community is like all open-source
> > communities, sharply focused on its' own concerns and expertise.  And,
> > in an unusual experience for computer types, our core competencies
> > hold little or no sway here; they don't even give us much of a leg up.
> > Just wait 'till you want to do something nutso like produce a business
> > graphic. :)
> >
> > I'm working on understanding enough of R packaging and documentation
> > to begin a 'task view' focused on systems administration, for humble
> > submission. That might end up being mostly "log analysis"; the term
> > can describe much of what we do, if it's stretched a bit.  I'm hoping
> > the task view will attract the teeming masses of sysadmins trapped in
> > the mire of Gnuplot and friends.
> Although not specifically solving the problem at hand, you might want
> to take a look at moodss and moomps (http://moodss.sourceforge.net/),
> modular monitoring applications, which uses R
> (http://jfontain.free.fr/statistics.htm) and its log module
> (http://jfontain.free.fr/log/log.htm).
>
> - --
> Jean-Luc Fontaine  http://jfontain.free.fr/
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.3 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
>
> iD8DBQFEjT2ykG/MMvcT1qQRAuF6AJ9nf5phV/GMmCHPuc5bVyA+SoXqGACgnLuZ
> u1tZpFOTCHNKOfFLZOC9uXI=
> =V8yo
> -END PGP SIGNATURE-
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] NA values

2006-06-12 Thread Gavin Simpson
On Mon, 2006-06-12 at 18:18 +0530, Arun Kumar Saha wrote:
> Dear all R users,
> 
> I am wondering whether there is any way to replace all "NA" values in a data
> frame by some numerical value, suppose 1000?
> 
> Thanks and Regards

Hi, Arun,

sapply(dat, function(x) {x[is.na(x)] <- 1000; x})

e.g.:

## some dummy data
dat <- as.data.frame(matrix(rnorm(100), ncol = 10))
## add some NAs
samp <- sample(1:10, 4)
dat[samp, -samp] <- NA
dat
## replace NAs with 1000
dat <- sapply(dat, function(x) {x[is.na(x)] <- 1000; x})
dat

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
*  Note new Address, Telephone & Fax numbers from 6th April 2006  *
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson
ECRC & ENSIS  [t] +44 (0)20 7679 0522
UCL Department of Geography   [f] +44 (0)20 7679 0565
Pearson Building  [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street  [w] http://www.ucl.ac.uk/~ucfagls/cv/
London, UK.   [w] http://www.ucl.ac.uk/~ucfagls/
WC1E 6BT.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] NA values

2006-06-12 Thread Duncan Murdoch
On 6/12/2006 8:48 AM, Arun Kumar Saha wrote:
> Dear all R users,
> 
> I am wondering whether there is any way to replace all "NA" values in a data
> frame by some numerical value, suppose 1000?

In a vector it is easy, e.g. x[is.na(x)] <- 1000.  A dataframe is a list 
of vectors, so you could iterate through the list, using one of the 
apply functions (or even a for loop):

apply(x, 2, function(col) {col[is.na(col)] <- 1000; col} )

which is essentially a short form for

for (i in 1:ncol(x)) {
   col <- x[,i]
   col[is.na(col)] <- 1000
   x[,i] <- col
}

Duncan Murdoch

> 
> Thanks and Regards
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] NA values

2006-06-12 Thread Petr Pikal
Hi

yes, but I do not recommend you to do it

> df<-data.frame(a=1:10, b=11:20)
> df[5,2]<-NA
> df
a  b
1   1 11
2   2 12
3   3 13
4   4 14
5   5 NA
6   6 16
7   7 17
8   8 18
9   9 19
10 10 20
> df[is.na(df)]<-1000
> df
ab
1   1   11
2   2   12
3   3   13
4   4   14
5   5 1000
6   6   16
7   7   17
8   8   18
9   9   19
10 10   20
> 

but in that case you can not simply compute means, sums and other 
values just by e.g.

colSums(df, na.rm=T)

HTH
Petr





On 12 Jun 2006 at 18:18, Arun Kumar Saha wrote:

Date sent:  Mon, 12 Jun 2006 18:18:33 +0530
From:   "Arun Kumar Saha" <[EMAIL PROTECTED]>
To: "r-help@stat.math.ethz.ch" 
Subject:[R] NA values

> Dear all R users,
> 
> I am wondering whether there is any way to replace all "NA" values in
> a data frame by some numerical value, suppose 1000?
> 
> Thanks and Regards
> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Limit extension with geodata

2006-06-12 Thread Vidal, Josep
  Hello. I am working with a matrix 612x618 and when I transform this data 
in a geodata, and when, for example, I want to calculate the mean with the 
funtion summary, the program say that the vector is too big and don't 
calculate. I want know if I do anything wrong or the program, with a geodata, 
has any limit of extension. Thank you very much. Josep

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] weird behaviour of summary.default

2006-06-12 Thread Prof Brian Ripley
On Mon, 12 Jun 2006, Stefano Calza wrote:

> Hi all.
>
> I may missing something here, but if I do summary.default(1:), I get:
>
>   Min. 1st Qu.  MedianMean 3rd Qu.Max.
>  12500500050007500
>
>
> but if I do summary.default(1:10001) I get:
>
>   Min. 1st Qu.  MedianMean 3rd Qu.Max.
>  12501500150017501   1
>
> i.e. Max is rounded to 1.
>
> What's wrong?

Nothing: you asked for it to be rounded.  Try reading the help page:

   digits: integer, used for number formatting with 'signif()' (for
   'summary.default') or 'format()' (for 'summary.data.frame').

and

> summary(1:10001, digits=7)
Min. 1st Qu.  MedianMean 3rd Qu.Max.
   12501500150017501   10001


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] NA values

2006-06-12 Thread Arun Kumar Saha
Dear all R users,

I am wondering whether there is any way to replace all "NA" values in a data
frame by some numerical value, suppose 1000?

Thanks and Regards

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] weird behaviour of summary.default

2006-06-12 Thread Gabor Grothendieck
Try

summary(1:10001, digits = 5)

or

old <- options(digits = 8)
summary(1:10001)


Note default for digits= in:

args(summary.default)



On 6/12/06, Stefano Calza <[EMAIL PROTECTED]> wrote:
> Hi all.
>
> I may missing something here, but if I do summary.default(1:), I get:
>
>   Min. 1st Qu.  MedianMean 3rd Qu.Max.
>  12500500050007500
>
>
> but if I do summary.default(1:10001) I get:
>
>   Min. 1st Qu.  MedianMean 3rd Qu.Max.
>  12501500150017501   1
>
> i.e. Max is rounded to 1.
>
> What's wrong?
>
> My system:
>
>   _
> platform   i486-pc-linux-gnu
> arch   i486
> os linux-gnu
> system i486, linux-gnu
> status
> major  2
> minor  3.1
> year   2006
> month  06
> day01
> svn rev38247
> language   R
> version.string Version 2.3.1 (2006-06-01)
>
>
> Regards,
> Stefano
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] weird behaviour of summary.default

2006-06-12 Thread Stefano Calza
Hi all.

I may missing something here, but if I do summary.default(1:), I get:

   Min. 1st Qu.  MedianMean 3rd Qu.Max. 
  12500500050007500 


but if I do summary.default(1:10001) I get:

   Min. 1st Qu.  MedianMean 3rd Qu.Max. 
  12501500150017501   1 

i.e. Max is rounded to 1.

What's wrong?

My system:

   _ 
platform   i486-pc-linux-gnu 
arch   i486  
os linux-gnu 
system i486, linux-gnu   
status   
major  2 
minor  3.1   
year   2006  
month  06
day01
svn rev38247 
language   R 
version.string Version 2.3.1 (2006-06-01)


Regards,
Stefano

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] variance specification using glm and quasi

2006-06-12 Thread Prof Brian Ripley
On Mon, 12 Jun 2006, Jeff Miller wrote:

> Cameron and Trivedi in their 1998 Regression Analysis of Count Data refer to
> NB1 and NB2
>
> NB1 is the negative binomial model with variance = mu + (alpha * mu^1)
> yielding (1+alpha)*mu
>
> NB2 sets the power to 2; hence, variance = mu + (alpha*mu^2)
>
> I think that NB2 can be requested via
>
> negbin2<-glm(hhm~sex+age,family=quasi(var="mu^2",link="log"))
>
> Is that right?

No.  That is variance = phi*mu^2, not mu + (alpha*mu^2).

> If so, how I can get NB1? The quasi family appears to be very
> limited in variance specification options.

[Not so in the R-devel version of R: you can supply any variance 
function.]

You can use your own family in any version of R.  Package MASS has for 
many years supplied negative.binomial, which has mu + mu^2/theta, a 
parametrization of `NB2'.  It even provides glm.nb to estimate theta.

Note that (and this is explicitly in your reference) (1+alpha)*mu = phi*mu 
so that NB1 can be fitted as a quasipoisson GLM, although the 
quasilikelihood used is the *not* the likelihood of the model (which is 
not a GLM).  You could easily fit this model by maximum likelihood by 
direct maximization: p.445 of MASS provides a suitable template.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] solving first-order differential equation

2006-06-12 Thread Joerg van den Hoff
ZhanWu Dai wrote:
> I am an initial user of R. Could you give me some explanations or examples on 
> how to solve the first order differential equations by the first-order 
> Runge-Kutta method? 
> 
> Thank you very much
> 
> Kind regards
> 
> 
> 
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

not really an answer, but a remark:

if your ODE is of the form

dy
---  - k y = A f(x)
dx

(k, A const.) it might be a better idea to use the 'analytic' solution
instead of runge-kutta (faster, probably more accurate).
for instance, if the initial condition is

y(x=0) = 0

and you're looking only at x>0 the solution simply is


y(x) = A (x) {*} exp(-kx)


where {*} means the finite (continous) convolution extending from 0 to x:

y(x) = A  integral from z=0 to z=x {f(z) exp(-k(x-z)) dz}


(which, of course, still has to be computed numerically in general.)
this closed-form solution can then
be used, for instance, to determine the unknown parameters (k, A) from a
least squares fit to measured f(x), y(x)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Fitting Distributions Directly From a Histogram

2006-06-12 Thread Prof Brian Ripley
On Mon, 12 Jun 2006, Lorenzo Isella wrote:

> Dear All,
>
> A simple question: packages like fitdistr should be ideal to analyze
> samples of data taken from a univariate distribution, but what if
> rather than the raw data of the observations you are given directly
> and only a histogram?

(It is unusual for the actual data not to be available in real problems.)

> I was thinking about generating artificially a set of data
> corresponding to the counts binned in the histogram, but this sounds
> too cumbersome.

And that is not in any case a correct approach, since the mle from 
binned data is not the same as the mle from any dataset corresponding to 
the binned counts.

You could use mle (package stats4) to estimate parameters from the 
likelihood of the grouped data.

> Another question is the following: fitdistr provides the value of the
> log-likely hood function, but what if I want e.g. a chi square test to
> get some insight on the goodness of the fitting?
> I am sure there must be a way to get it straightforwardly without
> coding it myself.

It is not well-defined, as you need to choose a binning to do a chisq 
test.  Once you have (e.g. via cut and table), chisq.test() will produce 
the test statistic and refer it to a reference distribution (which will 
not take any parameter estimation into account).

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Fitting Distributions Directly From a Histogram

2006-06-12 Thread Lorenzo Isella
Dear All,

A simple question: packages like fitdistr should be ideal to analyze
samples of data taken from a univariate distribution, but what if
rather than the raw data of the observations you are given directly
and only a histogram?
I was thinking about generating artificially a set of data
corresponding to the counts binned in the histogram, but this sounds
too cumbersome.
Another question is the following: fitdistr provides the value of the
log-likely hood function, but what if I want e.g. a chi square test to
get some insight on the goodness of the fitting?
I am sure there must be a way to get it straightforwardly without
coding it myself.
Many thanks

Lorenzo

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] solving first-order differential equation

2006-06-12 Thread Johannes Ranke
The fourth-order Runge-Kutta method is in the odesolve package on CRAN, 
but they manual says, only for didactial purposes. First order
differential equations are generally conveniently solved by the 
lsoda function in this package. I hope this helps, even if it does not
directly answer your question.

Best regards,

Johannes Ranke

* ZhanWu Dai <[EMAIL PROTECTED]> [060612 12:00]:
> 
> I am an initial user of R. Could you give me some explanations or examples on 
> how to solve the first order differential equations by the first-order 
> Runge-Kutta method? 
> 
> Thank you very much
> 
> Kind regards
> 

> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Dr. Johannes Ranke [EMAIL PROTECTED]
UFT Bremen, Leobenerstr. 1 +49 421 218 8971 
D-28359 Bremen http://www.uft.uni-bremen.de/chemie/ranke

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] strange behaviour with rotated viewports in grid

2006-06-12 Thread Rafael Najmanovich
Dear all,

I am having a problem using grid when rotating a viewport. It seems  
to plot everything on a grey background colour which I am not able to  
get rid of. Even book examples such as that that plot figure 5.10 in  
P. Murrell's R Graphics book show the same behaviour.
The following example illustrates this issue. I would appreciate if  
anyone has a way to solve this.
Best regards,

r.

pushViewport(viewport(width=0.9,height=0.9,name="vp1"))
grid.rect()
pushViewport(viewport(width=0.3,height=0.9,angle=0,name="vp2"))
grid.rect()
upViewport()
pushViewport(viewport(width=0.3,height=0.9,angle=10,name="vp3"))
grid.rect()


Dr. Rafael Najmanovich
European Bioinformatics Institute
Wellcome Trust Genome Campus
Cambridge CB10 1SD
United Kingdom

[EMAIL PROTECTED] - www.ebi.ac.uk/~rafi
+44-1223-492599 (voice) +44-7786-968257(mobile) +44-1223-494468 (fax)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R usage for log analysis

2006-06-12 Thread Jean-Luc Fontaine
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Allen S. Rout wrote:
>
>
> Don't expect a warm welcome.  This community is like all open-source
> communities, sharply focused on its' own concerns and expertise.  And,
> in an unusual experience for computer types, our core competencies
> hold little or no sway here; they don't even give us much of a leg up.
> Just wait 'till you want to do something nutso like produce a business
> graphic. :)
>
> I'm working on understanding enough of R packaging and documentation
> to begin a 'task view' focused on systems administration, for humble
> submission. That might end up being mostly "log analysis"; the term
> can describe much of what we do, if it's stretched a bit.  I'm hoping
> the task view will attract the teeming masses of sysadmins trapped in
> the mire of Gnuplot and friends.
Although not specifically solving the problem at hand, you might want
to take a look at moodss and moomps (http://moodss.sourceforge.net/),
modular monitoring applications, which uses R
(http://jfontain.free.fr/statistics.htm) and its log module
(http://jfontain.free.fr/log/log.htm).

- --
Jean-Luc Fontaine  http://jfontain.free.fr/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFEjT2ykG/MMvcT1qQRAuF6AJ9nf5phV/GMmCHPuc5bVyA+SoXqGACgnLuZ
u1tZpFOTCHNKOfFLZOC9uXI=
=V8yo
-END PGP SIGNATURE-

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Combinig two data frames

2006-06-12 Thread Petr Pikal
Hi

I would recommend to use list instead

how do you know that the result shall not be
  AB
 1   NA
 3   5
 4   6
 5   3
 2   5

> A<-1:5
> B<-4:7
> L<-list(A,B)
> L
[[1]]
[1] 1 2 3 4 5

[[2]]
[1] 4 5 6 7

If you insist on data frame you has to tell the program which cells 
are to be empty or if you have common column(s) you can use merge

> CC
  statepsu weight
1 A. P.  Urban  0
2  Mah.  Rural  0
3  W.B.  Rural  0
4  Ass.  Rural  0
5 M. P.  Urban  0
6 A. P.  Urban  0
> CC1
  statepsu aaa
1 A. P.  Urban 1.3
2 A. P.  Rural 1.2
3 M. P.  Urban 0.8
>
 merge(CC,CC1, all=T)
  statepsu weight aaa
1 A. P.  Rural NA 1.2
2 A. P.  Urban  0 1.3
3 A. P.  Urban  0 1.3
4  Ass.  Rural  0  NA
5 M. P.  Urban  0 0.8
6  Mah.  Rural  0  NA
7  W.B.  Rural  0  NA

HTH
Petr





On 12 Jun 2006 at 14:44, Arun Kumar Saha wrote:

Date sent:  Mon, 12 Jun 2006 14:44:14 +0530
From:   "Arun Kumar Saha" <[EMAIL PROTECTED]>
To: "r-help@stat.math.ethz.ch" 
Subject:[R] Combinig two data frames

> Dear all r-users,
> 
> Suppose I have two data frame:
> 
> A
> 1
> 3
> 4
> 5
> 2
> 
> and
> 
> B
> 5
> 6
> 3
> 5
> 
> Now I want combine this two data frames without losing any value from
> either data frame. More precisely I want to see
> 
>  AB
> 1   5
> 3   6
> 4   3
> 5   5
> 2   NA
> 
> I tried with cbind function but failed, as it only works when two data
> frames have equal number of rows. Can anyone suggest me any code that
> can be used for any data set?
> 
> Thanks and regards
> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] solving first-order differential equation

2006-06-12 Thread ZhanWu Dai

I am an initial user of R. Could you give me some explanations or examples on 
how to solve the first order differential equations by the first-order 
Runge-Kutta method? 

Thank you very much

Kind regards

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Combinig two data frames

2006-06-12 Thread Marc Schwartz
On Mon, 2006-06-12 at 14:44 +0530, Arun Kumar Saha wrote:
> Dear all r-users,
> 
> Suppose I have two data frame:
> 
> A
> 1
> 3
> 4
> 5
> 2
> 
> and
> 
> B
> 5
> 6
> 3
> 5
> 
> Now I want combine this two data frames without losing any value from either
> data frame. More precisely I want to see
> 
>  AB
> 1   5
> 3   6
> 4   3
> 5   5
> 2   NA
> 
> I tried with cbind function but failed, as it only works when two data
> frames have equal number of rows. Can anyone suggest me any code that can be
> used for any data set?

You can use merge() to do this.  merge() will perform SQL-like joins on
the two data frames.

In this case, we are going to merge A and B, telling merge() to use the
rownames in the two data frames as the basis for matching rows ('by'
argument). 

We also tell it to include all rows ('all' argument) in case some (or
all) of the rownames do not match between the two.

Finally, we take the result of the operation, which by default will
include an additional first column of the rownames themselves and we
delete that column.

> merge(A, B, all = TRUE, by = "row.names")[, -1]
  A  B
1 1  5
2 3  6
3 4  3
4 5  5
5 2 NA

See ?merge for more information.  There are also many variations on its
use that you will find in the list archives.

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Combinig two data frames

2006-06-12 Thread Arun Kumar Saha
Dear all r-users,

Suppose I have two data frame:

A
1
3
4
5
2

and

B
5
6
3
5

Now I want combine this two data frames without losing any value from either
data frame. More precisely I want to see

 AB
1   5
3   6
4   3
5   5
2   NA

I tried with cbind function but failed, as it only works when two data
frames have equal number of rows. Can anyone suggest me any code that can be
used for any data set?

Thanks and regards

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] quantile() with weights

2006-06-12 Thread Christophe DECLERCQ
 > De : [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] De la part de Wouter
> Envoyé : vendredi 9 juin 2006 19:15
> Hi list,
> 
> I'm looking for a way to calculate quantiles (such as in 
> quantile()), but with the ability to assign a different 
> weight to each member of the sample vector.
> [...]
 
See 'wtd.quantile' in the 'Hmisc' package. 

Christophe
--
Christophe Declercq, MD
Observatoire régional de la santé Nord-Pas-de-Calais
235, avenue de la recherche
BP 86 F-59373 LOOS CEDEX
Phone +33 3 20 15 49 24
Fax + 33 3 20 15 10 46
E-mail [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How can i add a color bar with base package

2006-06-12 Thread Petr Pikal
Hi

see ?rect
e.g.
> image(1:12, 1:12, outer(1:12, 1:12,"+"))
> for (i in 1:12) rect(10+(i/12-1/12), 8, 10+i/12, 
10,col=heat.colors(12)[i])
> 
HTH
Petr


On 9 Jun 2006 at 17:19, Yves Magliulo wrote:

From:   Yves Magliulo <[EMAIL PROTECTED]>
To: r-help@stat.math.ethz.ch
Organization:   Climpact
Date sent:  09 Jun 2006 17:19:34 +0200
Subject:[R]  How can i add a color bar with base package
Send reply to:  [EMAIL PROTECTED]



> Hi,
> 
> I'm trying to find this for 3 hours now so i come here to find any
> help. How can I add a color bar to show the color scales to what is
> generated by image(), similar to the one in figures generated by
> filled.contour() using only the base package although i know there is
> solution with contributed package.
> 
> it's sounds very easy but i can't get it! :-(
> 
> thanks by advance.
> 
> ---
> Yves Magliulo
> R&D Engineer
> CLIMPACT : www.climpact.com
> tel : 01 44 27 34 31
> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Regex engine types

2006-06-12 Thread Prof Brian Ripley
On Sat, 10 Jun 2006, Prof Brian Ripley wrote:

> ?regex does describe this:
>
> A range of characters may be specified by giving the first and last
> characters, separated by a hyphen.  (Character ranges are
> interpreted in the collation order of the current locale.)
>
> You did not tell us your locale, but based on questions from you in the past 
> I would guess en_NZ.utf8.  In that locale the collation order is wWxXyYzZ, so 
> your surprise is explained.  (It seems the PCRE code is not using the same 
> ordering in that locale.)

Some digging shows that Perl does not say explicitly what order it uses 
(at least in the man pages on my system), but that PCRE uses (see man 
pcrepattern)

- numerical order of the bytes in a single-byte locale
- numerical order of Unicode points in a UTF-8 locale.

whereas the basic/extended code uses the order set by the locale category 
LC_COLLATE and interpreted by the C function wcscoll (and byte order 
if that is not available).


Gabor Grothendieck  worte:

> I get the same thing on "Version 2.3.1 Patched (2006-06-04 r38279)"
> but on "R version 2.2.1, 2005-12-20" it gives character(0), as
> expected, so there is some change between versions of R.  I am
> on Windows XP.

And a helpful person would have studied the CHANGES file before 
commenting!  It says:

   Internationalization
   

   There is no longer a separate 'East Asian' version of R.dll.

In R 2.2.1 the fully internationalized version behaved as 2.3.1 did, but 
the 8-bit-only version for Windows always used byte-order collation. The 
difference is most likely that GG was using the 8-bit-only version, a 
Windows-specific issue.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] using several columns from a Table in a procedure

2006-06-12 Thread Petr Pikal
Hi

not sure what you want but if you just would  like to filter numeric 
columns

file[,sapply(file, is.numeric)]

HTH
Petr


On 10 Jun 2006 at 22:26, Milton Cezar wrote:

Date sent:  Sat, 10 Jun 2006 22:26:35 -0300 (ART)
From:   Milton Cezar <[EMAIL PROTECTED]>
To: r-help@stat.math.ethz.ch
Subject:[R] using several columns from a Table in a procedure

> Dear R-friends
> 
>   I have a table with more than 50 columns (variables). Many of them
>   are numeric and others are of type char. I would like repeat a group
>   of command using only a set of the numeric variables, excluding
>   others (for example V8, V12 etc) and not using the char ones. As a
>   sample I want:
> 
>   
>   x11() 
>   plot (X, v2)
>   model_v2<-glm (v2~X)
>   lines (X, predict(model_v2))
> 
>   x11()
>   plot (X, v3)
>   model_v3<-glm (v3~X)
>   lines (X, predict(model_v3))
> 
>   x11()
>   plot (X, v4)
>   model_v4<-glm (v4~X)
>   lines (X, predict(model_v4))
>   
>   -
> 
>   Look that I even use de X variable agains the other ones. How can I
>   do that? Another question is how can I change the name of a column
>   in a table?
> 
>   Thanks A Lot
> 
>   Miltinho
> 
> 
> 
>  __
> 
> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html