Re: [R] installing package hier.part on Mac OSX

2005-02-10 Thread Prof Brian Ripley
For MacOS we have
Binary packages, foo.tgz
Source packages, foo.tar.gz
Neither are `zip files' (things created by zip, usually with extension .zip).
It looks like you have not installed a source package before, and you 
either do not have the development tools installed or they are not in your 
path.

That there is no binary version of a package available usually indicates a 
problem with it on MacOS X, at least on the autobuilder's version of 
MacOS.

On Wed, 9 Feb 2005, Theresa Talley wrote:
Hi-
I've been trying to install the hier.part package on
my mac (OSX 10.3.7) and it is not working for some
reason. I am downloading the package source called :
hier.part_1.0.tar.gz.  When I try to auto install from
the cran site, I get this message:
* Installing *source* package 'hier.part' ...
** libs
/Library/Frameworks/R.framework/Resources/bin/SHLIB:
line 1: make: command not found
And when I try to install from the zip file on my
computer, I get this message:
What precisely did you do here?
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
Error in file(file, "r") : unable to open connection
In addition: Warning messages:
1: Installation of package hier.part had non-zero exit
status in: install.packages(c("hier.part"), lib =
"/Library/Frameworks/R.framework/Resources/library",
2: tar returned non-zero exit code: 512 in: untar(pkg,
tmpDir)
3: cannot open file `hier.part_1.0.tar/DESCRIPTION'
I've successfully installed other packages (e.g.,
vegan, cluster) so am not sure if there is something
different about this one or if I’m just being dopey.

--
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: [Fwd: Re: Fw: [R] Contour plot]

2005-02-10 Thread Petr Pikal


On 9 Feb 2005 at 16:32, [EMAIL PROTECTED] wrote:

> Petr,
> 
> It works perfectly! But I still have a question;
> 
> I have fit the following data;
> 
> x,y,z
> 1,10,11
> 2,11,15
> 3,12,21
> 4,13,29
> 5,14,39
> 6,15,51
> 7,16,65
> 8,17,81
> 9,18,99
> 10,19,119
> 
> >dat.lm <- lm(z~I(x^2)+y, data=dat)
> >dat.lm
> 
> Call:
> lm(formula = z ~ I(x^2) + y, data = dat)
> 
> Coefficients:
> (Intercept)   I(x^2)y
>   1.841e-141.000e+001.000e+00
> 
> How do I create the "z" matrix from dat.lm?? Without having to type
> over all the coefficients?

Maybe
expand.grid() and predict()

# new data
x<-1:10
y<-20:60

new.df<-expand.grid(x,y) #make data.frame
names(new.df)<-c("x","y") #change to propper names

contour(x,y,matrix(predict(dat.lm, new.df),10,41))

Cheers
Petr



> 
> Kind regards, Darius Blaszijk
> 
> - Oorspronkelijk bericht
> - Onderwerp: Re: Fw: [R] Contour plot Van:
>   "Petr Pikal" <[EMAIL PROTECTED]> Datum: Wo, 9 februari,
> 2005 11:23 am Aan:   [EMAIL PROTECTED]
>r-help@stat.math.ethz.ch
> --
> 
> 
> Hi Darius
> 
> 
> On 8 Feb 2005 at 17:43, [EMAIL PROTECTED] wrote:
> 
> > I understand that I need to have a (in this case) square matrix with
> > all
> the data. But the question now is;
> >
> > - can the contourplot not interpolate the missing values
> >
> > or alternatively
> >
> > - I have fit a model to the z data (z = 100 + 0.5x + 0.5y). How can
> > I
> make from this model a "square" matrix z to make a contour plot?
> 
> 
> Will
> 
> x<-1:10
> y<-1:10
> z <- outer(x,y,function(x,y) 100 + 0.5*x + 0.5*y)
> contour(x,y,z)
> 
> work as you wish?
> Cheers
> Petr
> 
> 
> >
> > Kind regards, Darius Blaszijk
> >
> > - Original Message -
> > From: "Achim Zeileis" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Cc: 
> > Sent: Tuesday, February 08, 2005 1:51 AM
> > Subject: Re: [R] Contour plot
> >
> >
> > > On Tue, 8 Feb 2005 01:15:06 +0100 [EMAIL PROTECTED] wrote:
> > >
> > > > Hello,
> > > >
> > > > I would like to make a contourplot of the following data;
> > > >
> > > > > x <- 1:10
> > > > > y <- 1:10
> > > > > z <- 100:110
> > > >
> > > > By doing >contour(x,y,z) I get the following error;
> > > >
> > > > "Error in contour.default(x, y, z) : no proper `z' matrix
> > > > specified"
> > > >
> > > > How do I fix this??
> > >
> > > x and y specify a grid and thus z must provide a value for each
> combination of the x's and y's! For example:
> > >   x <- y <- 1:10
> > >   contour(x, y, outer(x, y))
> > > Also look at
> > >   outer(x, y)
> > > and read ?contour.
> > >
> > > Z
> > >
> > > > Kind regards, Datius Blaszijk
> > > >
> > > > [[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
> 
> 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

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] question about sorting POSIXt vector

2005-02-10 Thread Petr Pikal
Hi Bogdan

the behaviour is result of ct and lt POSIX class

try

> str(test)
`POSIXlt', format: chr [1:4] "2005-02-08 18:49:15" "2005-02-07 
18:36:54" "2005-02-04 18:37:03" "2005-02-06 18:29:04"
> str(tst)
`POSIXct', format: chr [1:4] "2005-02-08 18:49:15" "2005-02-07 
18:36:54" "2005-02-04 18:37:03" "2005-02-06 18:29:04"
>

or

> length(tst)
[1] 4
> length(test)
[1] 9
>

and read help pages about POSIX how to convert

Cheers
Petr


On 9 Feb 2005 at 17:38, bogdan romocea wrote:

> Dear useRs,
> 
> How come the first attempt to sort a POSIXt vector fails (Error:
> non-atomic type in greater), while the second succeeds? (Code inserted
> below.) The documentation says that POSIXt is used to allow operations
> such as subtraction, so I'd expect sorting to work. Is this perhaps an
> OS issue? (I run R 2.0.1 on Win xp.)
> 
> Thank you,
> b.
> 
> #code
> test <- c("2005-02-08 18:49:15","2005-02-07 18:36:54",
>  "2005-02-04 18:37:03","2005-02-06 18:29:04")
> test <- strptime(test,format="%Y-%m-%d %H:%M:%S")
> order(test,decreasing=F)  #doesn't work - why?
> tst <- test + 0
> order(tst,decreasing=F)   #works - how come?
> print(tst)
> #run
> > test <- c("2005-02-08 18:49:15","2005-02-07 18:36:54",
> + "2005-02-04 18:37:03","2005-02-06 18:29:04")
> > test <- strptime(test,format="%Y-%m-%d %H:%M:%S")
> > order(test,decreasing=F)#doesn't work - why?
> Error in order(test, decreasing = F) : non-atomic type in greater >
> tst <- test + 0 > order(tst,decreasing=F)#works - how come? [1] 3 4 2
> 1 > print(tst) [1] "2005-02-08 18:49:15 Eastern Standard Time"
> "2005-02-07 18:36:54 Eastern Standard Time" [3] "2005-02-04 18:37:03
> Eastern Standard Time" "2005-02-06 18:29:04 Eastern Standard Time" >
> 
> __
> 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] Mean calculated from R1.9.1 different from R2.0.1

2005-02-10 Thread Chang-Heok Soh
Hello,
I ran my simulations on the Unix verson of R1.9.1 and the Windows version
of R2.0.1 on XP.  I kept getting different values for the mean of the same
column of the same matrix, and am perplexed.  I would appreciate if anyone
could help explain the difference?

Here is a sample code:

set.seed(7293)
z1v <- rnorm(1000, mean=68, sd=13)
z1v <- (z1v-mean(z1v))/sd(z1v)

Using R1.9.1 on Unix, I get:

mean(z1v)
[1] -4.88775e-15

Using R2.0.1 on Windows XP, I get:

mean(z1v)
[1] -3.7497e-16

The same problem occurs when I dump the data from one version and
then source it using the other version.

Thanks for the help.

Regards,
Chang-Heok

__
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] installing package hier.part on Mac OSX

2005-02-10 Thread Jari Oksanen
On Thu, 2005-02-10 at 08:01 +, Prof Brian Ripley wrote:
> For MacOS we have
> 
> Binary packages, foo.tgz
> Source packages, foo.tar.gz
> 
> Neither are `zip files' (things created by zip, usually with extension .zip).
> 
> It looks like you have not installed a source package before, and you 
> either do not have the development tools installed or they are not in your 
> path.

In this case probably the tools are missing, starting from 'make'. You
should install the Development Tools / X-Code which come with the MacOS
X installation cd/dvd at least from version 10.3.x. Otherwise you can
get the development tools from http://developer.apple.com/. Moreover,
in this case you need to get a Fortran compiler which does not come with
MacOS. See R for Mac OS X FAQ, section "the Fortran compiler g77 gcc
3.3". 

> 
> That there is no binary version of a package available usually indicates a 
> problem with it on MacOS X, at least on the autobuilder's version of 
> MacOS.
> 
Well, 'hier.part' is younger than the latest entry in Mac binary
packages: there is nothing after Jan 19, 2005. The binary package builds
beautifully in MacOS X. However, it seems to require package 'gtools'
that I can't find in CRAN nor in BioConductor repositories. It seems
that this didn't prevent passing tests to be included at CRAN or
producing Windows binaries. 

Theresa, I can send you a Mac binary if you don't want to see the
trouble of installing X-Code and g77. However, it failed with missing
'gtools' upon loading.

cheers, jari oksanen
> On Wed, 9 Feb 2005, Theresa Talley wrote:
> 
> > Hi-
> > I've been trying to install the hier.part package on
> > my mac (OSX 10.3.7) and it is not working for some
> > reason. I am downloading the package source called :
> > hier.part_1.0.tar.gz.  When I try to auto install from
> > the cran site, I get this message:
> > * Installing *source* package 'hier.part' ...
> > ** libs
> > /Library/Frameworks/R.framework/Resources/bin/SHLIB:
> > line 1: make: command not found
> >
> > And when I try to install from the zip file on my
> > computer, I get this message:
> 
> What precisely did you do here?
> 
> > gzip: stdin: not in gzip format
> > tar: Child returned status 1
> > tar: Error exit delayed from previous errors
> > Error in file(file, "r") : unable to open connection
> > In addition: Warning messages:
> > 1: Installation of package hier.part had non-zero exit
> > status in: install.packages(c("hier.part"), lib =
> > "/Library/Frameworks/R.framework/Resources/library",
> > 2: tar returned non-zero exit code: 512 in: untar(pkg,
> > tmpDir)
> > 3: cannot open file `hier.part_1.0.tar/DESCRIPTION'
> >
> > I've successfully installed other packages (e.g.,
> > vegan, cluster) so am not sure if there is something
> > different about this one or if I’m just being dopey.
> 
> 
> -- 
> 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-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] installing package hier.part on Mac OSX

2005-02-10 Thread Prof Brian Ripley
On Thu, 10 Feb 2005, Jari Oksanen wrote:
On Thu, 2005-02-10 at 08:01 +, Prof Brian Ripley wrote:
For MacOS we have
Binary packages, foo.tgz
Source packages, foo.tar.gz
Neither are `zip files' (things created by zip, usually with extension .zip).
It looks like you have not installed a source package before, and you
either do not have the development tools installed or they are not in your
path.
In this case probably the tools are missing, starting from 'make'. You
should install the Development Tools / X-Code which come with the MacOS
X installation cd/dvd at least from version 10.3.x. Otherwise you can
get the development tools from http://developer.apple.com/. Moreover,
in this case you need to get a Fortran compiler which does not come with
MacOS. See R for Mac OS X FAQ, section "the Fortran compiler g77 gcc
3.3".
That there is no binary version of a package available usually indicates a
problem with it on MacOS X, at least on the autobuilder's version of
MacOS.
Well, 'hier.part' is younger than the latest entry in Mac binary
packages: there is nothing after Jan 19, 2005. The binary package builds
As hier.part's tarball is dated 3 November 2004, this is obviously false
(and I had checked).
beautifully in MacOS X. However, it seems to require package 'gtools'
that I can't find in CRAN nor in BioConductor repositories. It seems
that this didn't prevent passing tests to be included at CRAN or
producing Windows binaries.
Theresa, I can send you a Mac binary if you don't want to see the
trouble of installing X-Code and g77. However, it failed with missing
'gtools' upon loading.
gtools is part of gregmisc, so you should have been able to find it.
--
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] Mean calculated from R1.9.1 different from R2.0.1

2005-02-10 Thread Petr Pikal
Hi

Isn't it due to rounding and floating point precision of different 
OSses?

Cheers
Petr



On 10 Feb 2005 at 3:44, Chang-Heok Soh wrote:

> Hello,
> I ran my simulations on the Unix verson of R1.9.1 and the Windows
> version of R2.0.1 on XP.  I kept getting different values for the mean
> of the same column of the same matrix, and am perplexed.  I would
> appreciate if anyone could help explain the difference?
> 
> Here is a sample code:
> 
> set.seed(7293)
> z1v <- rnorm(1000, mean=68, sd=13)
> z1v <- (z1v-mean(z1v))/sd(z1v)
> 
> Using R1.9.1 on Unix, I get:
> 
> mean(z1v)
> [1] -4.88775e-15
> 
> Using R2.0.1 on Windows XP, I get:
> 
> mean(z1v)
> [1] -3.7497e-16
> 
> The same problem occurs when I dump the data from one version and then
> source it using the other version.
> 
> Thanks for the help.
> 
> Regards,
> Chang-Heok
> 
> __
> 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] Annual cumulative sums from time series

2005-02-10 Thread Georg Hoermann
Hello world,

I am actually transferring a course in data management for
students in biology, geography and agriculture 
from statistica to R - it works
surprisingly well. If anyone is interested in my scratch/notepad
(in German language), please see

www.hydrology.uni-kiel.de/~schorsch/statistik/statistik_datenauswertung.pdf

(pages 40-52)

The dataset is:

www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv

It contains a 10 year dataset. So far for introduction, now
comes the problem:

we often need cumulative *annual* sums (sunshine, precipitation),
 i.e. the sum
must reset to 0 at the beginning of the year. I know
of cumsum(), but I do not now how to split the dataset automagically 
into annual pieces so I can cumsum() every year separately.
I have the strong hope that the solution is one of these
one-liners which leave the students with eyes wide open in surprise and 
makes them true believers in the power of the command-line 8-).

Thanks & Greetings
Georg


-- 
Georg Hoermann, Luebeck, Germany
Tel. 0451/47 70 32, 0172/431 57 15, Penguin #189476

__
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] Annual cumulative sums from time series

2005-02-10 Thread Dimitris Rizopoulos
maybe something like this:
dat <- data.frame(years=rep(1994:2004, each=10), x=rnorm(110), 
y=rnorm(110))
lapply(split(dat[,-1], dat$years), cumsum)

is what you want.
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/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: "Georg Hoermann" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, February 10, 2005 11:01 AM
Subject: [R] Annual cumulative sums from time series


Hello world,
I am actually transferring a course in data management for
students in biology, geography and agriculture
from statistica to R - it works
surprisingly well. If anyone is interested in my scratch/notepad
(in German language), please see
www.hydrology.uni-kiel.de/~schorsch/statistik/statistik_datenauswertung.pdf
(pages 40-52)
The dataset is:
www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv
It contains a 10 year dataset. So far for introduction, now
comes the problem:
we often need cumulative *annual* sums (sunshine, precipitation),
i.e. the sum
must reset to 0 at the beginning of the year. I know
of cumsum(), but I do not now how to split the dataset automagically
into annual pieces so I can cumsum() every year separately.
I have the strong hope that the solution is one of these
one-liners which leave the students with eyes wide open in surprise 
and
makes them true believers in the power of the command-line 8-).

Thanks & Greetings
Georg
--
Georg Hoermann, Luebeck, Germany
Tel. 0451/47 70 32, 0172/431 57 15, Penguin #189476
__
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] Annual cumulative sums from time series

2005-02-10 Thread Petr Pikal
Hi Georg

If you know which value belongs to which year you can use

tapply, by, aggregate family like:

years<-rep(c(2000,2001,2002,2003), each=10)
values<-(1:40)
test<-cbind(years,values)
test<-data.frame(test)
aggregate(test$values,list(y=test$years),sum)

Cheers
Petr



On 10 Feb 2005 at 11:01, Georg Hoermann wrote:

> Hello world,
> 
> I am actually transferring a course in data management for
> students in biology, geography and agriculture 
> from statistica to R - it works
> surprisingly well. If anyone is interested in my scratch/notepad
> (in German language), please see
> 
> www.hydrology.uni-kiel.de/~schorsch/statistik/statistik_datenauswertun
> g.pdf
> 
> (pages 40-52)
> 
> The dataset is:
> 
> www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv
> 
> It contains a 10 year dataset. So far for introduction, now
> comes the problem:
> 
> we often need cumulative *annual* sums (sunshine, precipitation),
>  i.e. the sum
> must reset to 0 at the beginning of the year. I know
> of cumsum(), but I do not now how to split the dataset automagically
> into annual pieces so I can cumsum() every year separately. I have the
> strong hope that the solution is one of these one-liners which leave
> the students with eyes wide open in surprise and makes them true
> believers in the power of the command-line 8-).
> 
> Thanks & Greetings
> Georg
> 
> 
> -- 
> Georg Hoermann, Luebeck, Germany
> Tel. 0451/47 70 32, 0172/431 57 15, Penguin #189476
> 
> __
> 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] Writing output to a file in a loop

2005-02-10 Thread Wojtek Slusarski
Hello,
My problem is, that I have to build hundreds of GARCH models to obtain 
volatility forecasts. I would like to run a loop, that would build those 
forecasts for me. There is no problem, with writing only the results of 
the forecasts, but I'd like to have stored results of the models in some 
file, that I could check later, what are the models like, to be able to 
compare if I should use GARCH(1,1) or GARCH(0,4) or any other, that 
suits the data best. The data file looks like that:

TICKER;DTMMDD;OPEN;HIGH;LOW;CLOSE;VOL
WIG20;19940414;1000,00;1000,00;1000,00;1000,00;71600
WIG20;19940418;1050,47;1050,47;1050,47;1050,47;99950
WIG20;19940419;1124,92;1124,92;1124,92;1124,92;138059
...
I wrote a script to do that, but when I use sink() to save the results 
in a text file, after running the script files are empty. I read in FAQ, 
that in a loop R only computes and prints only some warning messages, 
but I don't know how to do that in any other way, to ommit this problem.
Below I enclose the code:


library(tseries)
wig20 <- read.csv("wig20.txt", sep=";", dec=",")
m <- 2321#upper bound of time series
niter <- 10#length(wig20$CLOSE)- m
fcv <- 0
for (i in 1:niter){

m <- m + 1
r <- 100*diff(log(wig20$CLOSE[1:m]))
y <- r - mean(r)
fit <- garch(y, order = c(1,1))
sink("garch21.txt", append = TRUE)
summary(fit)
logLik(fit)
sink()
cv <- predict(fit, genuine=TRUE)
fcv <- c(fcv,cv[length(cv)/2,1])
postscript("garch21.ps",encoding="ISOLatin2",
title = paste("Day: ",wig20$DTMMDD[m]),
paper = "a4",
family = "URWTimes",
append = TRUE)

plot(fit, ask=FALSE)

dev.off()

}
sink("forecasts.txt")
fcv
sink()
###
The most wondering thing for me is that, plots are stored in the ps 
file, but only the ones from last iteration. In manuals there is:

append: logical; currently *disregarded*; just there for
  compatibility reasons.
What does *disregarded* actually mean and when I will be able to add a 
title before each set of plots, because now the option title is not 
adding anything to file.

I will be very thankfull for any help.
Best regards,
Wojtek Slusarski
__
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] Annual cumulative sums from time series

2005-02-10 Thread Roger Bivand
On Thu, 10 Feb 2005, Georg Hoermann wrote:

> Hello world,
> 
> I am actually transferring a course in data management for
> students in biology, geography and agriculture 
> from statistica to R - it works
> surprisingly well. If anyone is interested in my scratch/notepad
> (in German language), please see
> 
> www.hydrology.uni-kiel.de/~schorsch/statistik/statistik_datenauswertung.pdf
> 
> (pages 40-52)
> 
> The dataset is:
> 
> www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv
> 
> It contains a 10 year dataset. So far for introduction, now
> comes the problem:
> 
> we often need cumulative *annual* sums (sunshine, precipitation),
>  i.e. the sum
> must reset to 0 at the beginning of the year. I know
> of cumsum(), but I do not now how to split the dataset automagically 
> into annual pieces so I can cumsum() every year separately.
> I have the strong hope that the solution is one of these
> one-liners which leave the students with eyes wide open in surprise and 
> makes them true believers in the power of the command-line 8-).
> 

> kiel <- 
> read.csv(url("http://www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv";))
> yrs <- factor(strftime(strptime(as.character(kiel$DATUM), "%d.%m.%Y"), 
+ "%Y")) # this is clumsy, there are probably better ways
> tpks1 <- unlist(tapply(kiel$Sonnen, yrs, cumsum))
> str(tpks1)
 Named num [1:3652] 0.12 0.24 0.24 0.24 5.52 ...
 - attr(*, "names")= chr [1:3652] "19891" "19892" "19893" "19894" ...
> kiel$Sonnen[1:5]
[1] 0.12 0.12 0.00 0.00 5.28

I don't know if you want the name attribute on your annual cumulative 
sums, but for now they help control what's going on. This looks OK:

> try1 <- tapply(kiel$Sonnen, yrs, cumsum)
> cols <- rainbow(length(try1))
> plot(x=c(1,366), y=c(0,1200), type="n")
> for (i in 1:length(try1)) lines(1:length(try1[[i]]), try1[[i]], 
+ col=cols[i])
> legend(c(0,70), c(700,1100), names(try1), col=cols, lwd=1)

for a quick impression.


> Thanks & Greetings
> Georg
> 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
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] Histogram Bar Spacing or Border Width

2005-02-10 Thread Henrik Bengtsson
See http://www.maths.lth.se/help/R/plot.histogram/ and note the note at the
top of the page.

Henrik Bengtsson

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Prof 
> Brian Ripley
> Sent: Wednesday, February 09, 2005 10:48 PM
> To: Thomas Hopper
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] Histogram Bar Spacing or Border Width
> 
> 
> A hint: hist() does no plotting.  That is done by the 
> "histogram" method 
> of plot(), which you can copy and modify to your own 
> needs/desires. Alternatively you can create myplot() and call
> 
> myplot(hist(..., plot=TRUE), ...)
> 
> On Wed, 9 Feb 2005, Thomas Hopper wrote:
> 
> > I understand the problem from a statistical perspective, 
> and you make 
> > an
> > excellent point (as I have come to expect, reading this 
> list). However, I'm 
> > thinking about it from a visual/aesthetic perspective.
> >
> > Let me try this. Plot two histograms side-by-side:
> >
> >> x <- rnorm(10)
> >> par(mfcol=c(1,2))
> >> hist(x)
> >> hist(x,col="gray",border="gray")
> >
> > Which one is easier to interpret? To my eyes, the default 
> hist() is, 
> > but
> > given the statistical meaning of a histogram, I think I 
> could argue that the 
> > gray version is a more accurate representation of the data.
> >
> > The default histogram delimits the space between subareas 
> to make the 
> > graph
> > easier to read. I'm just trying to tweak this to further 
> improve it. I don't 
> > want to separate the bars so much as control (and, I hope, 
> improve) their 
> > appearance.
> >
> > Thanks,
> >
> > Tom
> >
> > On Feb 9, 2005, at 11:06 AM, Prof Brian Ripley wrote:
> >
> >> A histogram is a density estimate (at least as defined in the 
> >> Encyclopedia
> >> of Statistics Sciences, if not in many US Universities).  
> It is an area, 
> >> not a series of unrelated bars, so it makes no sense to 
> have spaces between 
> >> the subareas.
> >> 
> >> Unfortunately, hist() will also produce barplots of counts.
> >> 
> >> On Wed, 9 Feb 2005, Thomas Hopper wrote:
> >> 
> >>> Is there any way to control the spacing between bars in a 
> histogram, 
> >>> or
> >>> change the border width (I'm assuming the hist() function, though 
> >>> alternatives are welcome)? I'm interested in changing the 
> visual spacing 
> >>> between columns in a plotted histogram.
> >>> 
> >>> The general effect I'm looking for can be accomplished in 
> barplots 
> >>> using
> >>> the "width=" parameter, but I have not been able to find 
> a way to adjust 
> >>> the apparent spacing in histograms.
> >> 
> >> -- 
> >> 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
> >> 
> >> 
> > ---
> > In cyberspace, no one can hear you scream.
> >
> >
> 
> -- 
> 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-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] Annual cumulative sums from time series

2005-02-10 Thread Peter Dalgaard
"Dimitris Rizopoulos" <[EMAIL PROTECTED]> writes:

> maybe something like this:
> 
> dat <- data.frame(years=rep(1994:2004, each=10), x=rnorm(110),

(I thought they abolished the 10 month year after the failure of the
French revolution. :-) )

> y=rnorm(110))
> lapply(split(dat[,-1], dat$years), cumsum)

or to get a matching data frame:

 yr <- dat$years
 cum <- dat[-1]
 split(cum,yr) <- lapply(split(cum,yr),cumsum)

(or do.call("cbind",  lapply(split(dat[,-1], dat$years), cumsum)), if
you can rely on data being in group order.)


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
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] Writing output to a file in a loop

2005-02-10 Thread Roger Bivand
On Thu, 10 Feb 2005, Wojtek Slusarski wrote:

> Hello,
> My problem is, that I have to build hundreds of GARCH models to obtain 
> volatility forecasts. I would like to run a loop, that would build those 
> forecasts for me. There is no problem, with writing only the results of 
> the forecasts, but I'd like to have stored results of the models in some 
> file, that I could check later, what are the models like, to be able to 
> compare if I should use GARCH(1,1) or GARCH(0,4) or any other, that 
> suits the data best. The data file looks like that:
> 
> TICKER;DTMMDD;OPEN;HIGH;LOW;CLOSE;VOL
> WIG20;19940414;1000,00;1000,00;1000,00;1000,00;71600
> WIG20;19940418;1050,47;1050,47;1050,47;1050,47;99950
> WIG20;19940419;1124,92;1124,92;1124,92;1124,92;138059
> ...
> 
> I wrote a script to do that, but when I use sink() to save the results 
> in a text file, after running the script files are empty. I read in FAQ, 
> that in a loop R only computes and prints only some warning messages, 
> but I don't know how to do that in any other way, to ommit this problem.
> Below I enclose the code:
> 
> 
> 
> library(tseries)
> 
> wig20 <- read.csv("wig20.txt", sep=";", dec=",")
> m <- 2321 #upper bound of time series
> niter <- 10#length(wig20$CLOSE)- m
> fcv <- 0
> 
> 
> for (i in 1:niter){
>   
>   m <- m + 1
>   r <- 100*diff(log(wig20$CLOSE[1:m]))
>   y <- r - mean(r)
>   fit <- garch(y, order = c(1,1))
> 
>   sink("garch21.txt", append = TRUE)
>   summary(fit)
>   logLik(fit)
>   sink()
> 
>   cv <- predict(fit, genuine=TRUE)
>   fcv <- c(fcv,cv[length(cv)/2,1])
> 
>   postscript("garch21.ps",encoding="ISOLatin2",
>   title = paste("Day: ",wig20$DTMMDD[m]),
>   paper = "a4",
>   family = "URWTimes",
>   append = TRUE)
>   
>   plot(fit, ask=FALSE)
>   
>   dev.off()
>   
> }
> 
> sink("forecasts.txt")
> 
>  fcv
> 
> sink()
> 
> ###

First, you should enclose the functions that output results in the loop in 
print(), so that they do print, in loops this has to be done and is a FAQ 
(often met with lattice graphics)

> 
> The most wondering thing for me is that, plots are stored in the ps 
> file, but only the ones from last iteration. In manuals there is:
> 
> append: logical; currently *disregarded*; just there for
>compatibility reasons.
> 
> What does *disregarded* actually mean and when I will be able to add a 
> title before each set of plots, because now the option title is not 
> adding anything to file.
> 
Well disregarded here seems to mean exactly that. Why not open the 
postscript device before the loop starts, with onefile = TRUE, write to it 
in the loop, then dev.off() after the loop? You are getting the last 
graphic because that is what you are telling it to do, the others are 
being overwritten, because you are opening and closing the same file 
inside the loop, and append doesn't exist. 


> I will be very thankfull for any help.
> 
> Best regards,
> Wojtek Slusarski
> 
> __
> 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
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
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


[R] Failure of update.packages()

2005-02-10 Thread I M S White
Can anyone explain why with latest version of R (2.0.1) on FC3, installed
from R-2.0.1-0.fdr.2.fc3.i386.rpm, update.packages() produces the message

/usr/lib/R/bin/Rcmd exec: INSTALL: not found.

Indeed /usr/lib/R/bin seems to lack various shell scripts (INSTALL,
REMOVE, etc).

==
I.White
University of Edinburgh
Ashworth Laboratories, West Mains Road
Edinburgh EH9 3JT
Tel: 0131 650 5490  Fax: 0131 650 6564
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] Mean calculated from R1.9.1 different from R2.0.1

2005-02-10 Thread Campbell
This may or may not be related, but looking at the random number
generators in Numerical Recipies In C book it would appear that random
number generators with identical seeds will give different results 
depending upon whther they are compliled with 64 bit or 32 bit 
settings.


Is this the case with the random number generators in R?

Phineas Campbell


 

>>> Chang-Heok Soh <[EMAIL PROTECTED]> 02/10/05 8:44 AM >>>
Hello,
I ran my simulations on the Unix verson of R1.9.1 and the Windows
version
of R2.0.1 on XP.  I kept getting different values for the mean of the
same
column of the same matrix, and am perplexed.  I would appreciate if
anyone
could help explain the difference?

Here is a sample code:

set.seed(7293)
z1v <- rnorm(1000, mean=68, sd=13)
z1v <- (z1v-mean(z1v))/sd(z1v)

Using R1.9.1 on Unix, I get:

mean(z1v)
[1] -4.88775e-15

Using R2.0.1 on Windows XP, I get:

mean(z1v)
[1] -3.7497e-16

The same problem occurs when I dump the data from one version and
then source it using the other version.

Thanks for the help.

Regards,
Chang-Heok

__
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] Writing output to a file in a loop

2005-02-10 Thread Wojtek Slusarski
Roger Bivand wrote:
First, you should enclose the functions that output results in the loop in 
print(), so that they do print, in loops this has to be done and is a FAQ 
(often met with lattice graphics)
I am sorry for that, that I didn't find that. Now it works great. If 
anyone needs that, that's what I have inside the loop:

sink("zz.txt", append = TRUE)
print(out <- summary(fit))
print(out <- logLik(fit))
sink()
The most wondering thing for me is that, plots are stored in the ps 
file, but only the ones from last iteration. In manuals there is:

append: logical; currently *disregarded*; just there for
  compatibility reasons.
What does *disregarded* actually mean and when I will be able to add a 
title before each set of plots, because now the option title is not 
adding anything to file.

Well disregarded here seems to mean exactly that. Why not open the 
postscript device before the loop starts, with onefile = TRUE, write to it 
in the loop, then dev.off() after the loop? You are getting the last 
graphic because that is what you are telling it to do, the others are 
being overwritten, because you are opening and closing the same file 
inside the loop, and append doesn't exist. 
Well, I don't know how to change the properties main, xlab and ylab in 
the GARCH object for plots, when I do plot(fit), so I made for each 
model separate file containing name of the model and date. Those plots 
are just for me, to have a look if the residuals from the model are OK. 
I am not going to print them.

Once again, thanks a lot.
Best regards,
Wojtek Slusarski
__
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] Failure of update.packages()

2005-02-10 Thread Peter Dalgaard
I M S White <[EMAIL PROTECTED]> writes:

> Can anyone explain why with latest version of R (2.0.1) on FC3, installed
> from R-2.0.1-0.fdr.2.fc3.i386.rpm, update.packages() produces the message
> 
> /usr/lib/R/bin/Rcmd exec: INSTALL: not found.
> 
> Indeed /usr/lib/R/bin seems to lack various shell scripts (INSTALL,
> REMOVE, etc).
> 
> ==
> I.White
> University of Edinburgh
> Ashworth Laboratories, West Mains Road
> Edinburgh EH9 3JT
> Tel: 0131 650 5490  Fax: 0131 650 6564
> E-mail: [EMAIL PROTECTED]

You need to install the R-devel package too:

R-devel-2.0.1-0.fdr.2.fc3.i386.rpm 

The big idea is that this will suck in all the required compilers,
libraries, and include files via RPM dependencies, but users with
limited disk space may be content with the binaries of R+recommended
packages. 

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
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] Writing output to a file in a loop

2005-02-10 Thread Miguel A. Arranz
That is correct, you have to specify with print or cat what you want to sink. 
This should work for you:
print(summary(fit))
print(logLik(fit))
print(fcv)

I hope this helps.


On Thursday 10 February 2005 11:40, Wojtek Slusarski wrote:
> Hello,
> My problem is, that I have to build hundreds of GARCH models to obtain
> volatility forecasts. I would like to run a loop, that would build those
> forecasts for me. There is no problem, with writing only the results of
> the forecasts, but I'd like to have stored results of the models in some
> file, that I could check later, what are the models like, to be able to
> compare if I should use GARCH(1,1) or GARCH(0,4) or any other, that
> suits the data best. The data file looks like that:
>
> TICKER;DTMMDD;OPEN;HIGH;LOW;CLOSE;VOL
> WIG20;19940414;1000,00;1000,00;1000,00;1000,00;71600
> WIG20;19940418;1050,47;1050,47;1050,47;1050,47;99950
> WIG20;19940419;1124,92;1124,92;1124,92;1124,92;138059
> ...
>
> I wrote a script to do that, but when I use sink() to save the results
> in a text file, after running the script files are empty. I read in FAQ,
> that in a loop R only computes and prints only some warning messages,
> but I don't know how to do that in any other way, to ommit this problem.
> Below I enclose the code:
>
> 
>
> library(tseries)
>
> wig20 <- read.csv("wig20.txt", sep=";", dec=",")
> m <- 2321#upper bound of time series
> niter <- 10#length(wig20$CLOSE)- m
> fcv <- 0
>
>
> for (i in 1:niter){
>
>  m <- m + 1
>  r <- 100*diff(log(wig20$CLOSE[1:m]))
>  y <- r - mean(r)
>  fit <- garch(y, order = c(1,1))
>
>  sink("garch21.txt", append = TRUE)
>   summary(fit)
>   logLik(fit)
>  sink()
>
>  cv <- predict(fit, genuine=TRUE)
>  fcv <- c(fcv,cv[length(cv)/2,1])
>
>  postscript("garch21.ps",encoding="ISOLatin2",
>title = paste("Day: ",wig20$DTMMDD[m]),
>paper = "a4",
>family = "URWTimes",
>append = TRUE)
>
>   plot(fit, ask=FALSE)
>
>  dev.off()
>
> }
>
> sink("forecasts.txt")
>
>  fcv
>
> sink()
>
> ###
>
> The most wondering thing for me is that, plots are stored in the ps
> file, but only the ones from last iteration. In manuals there is:
>
> append: logical; currently *disregarded*; just there for
>compatibility reasons.
>
> What does *disregarded* actually mean and when I will be able to add a
> title before each set of plots, because now the option title is not
> adding anything to file.
>
> I will be very thankfull for any help.
>
> Best regards,
> Wojtek Slusarski
>
> __
> 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] Mean calculated from R1.9.1 different from R2.0.1

2005-02-10 Thread Prof Brian Ripley
On Thu, 10 Feb 2005, Campbell wrote:
This may or may not be related,
It is completely unrelated: see earlier replies in this thread.
but looking at the random number
generators in Numerical Recipies In C book it would appear that random
number generators with identical seeds will give different results
depending upon whther they are compliled with 64 bit or 32 bit
settings.
Is this the case with the random number generators in R?
No, as R cannot be `compliled with 64 bit or 32 bit settings', whatever 
that is supposed to mean.

If your concern is with 32- vs 64- bit ints, we do ensure that R is 
compiled with 32-bit ints, and we do check the operation of the basic 
random number generators.  On the other hand, all known 64-bit ports of R 
use IEC60559 doubles (8 bytes, effective 53-bit mantissa), as do all 
current 32-bit ports that I am aware of.

At least on machines with standard IEC60559 arithmetic you will get the 
same stream of random numbers on every implementation.  Now GCC does not
support fully IEC60559 on ix86 and some other chips, but lots of testing 
has shown that to be close enough to be true for practical purposes.
Lots of R tests do use specific starting seeds and do give the same 
answers of many different architectures up to rounding error (the issue 
here).

--
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] Failure of update.packages()

2005-02-10 Thread Jari Oksanen
On Thu, 2005-02-10 at 13:52 +0100, Peter Dalgaard wrote:
> I M S White <[EMAIL PROTECTED]> writes:
> 
> > Can anyone explain why with latest version of R (2.0.1) on FC3, installed
> > from R-2.0.1-0.fdr.2.fc3.i386.rpm, update.packages() produces the message
> > 
> > /usr/lib/R/bin/Rcmd exec: INSTALL: not found.
> > 
> > Indeed /usr/lib/R/bin seems to lack various shell scripts (INSTALL,
> > REMOVE, etc).

> You need to install the R-devel package too:
> 1
> R-devel-2.0.1-0.fdr.2.fc3.i386.rpm 
> 
> The big idea is that this will suck in all the required compilers,
> libraries, and include files via RPM dependencies, but users with
> limited disk space may be content with the binaries of R+recommended
> packages. 
> 
This kind of problems were to be anticipated, weren't they? The great
divide between use-only and devel packages is a rpm packaging standard,
but not very useful in this case: it splits a 568K devel chip from a
15.4M chunk of base R. Moreover, you don't have a repository of binary
packages for Linux which means that not many people can use the 568K
saving in download times (saving in disk space is more considerable of
course). So are there plans for binary Linux packages for other distros
than Debian so that people could use the non-devel piece of R only?

cheers, jari oksanen
-- 
Jari Oksanen <[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] Using a number as a name to access a list

2005-02-10 Thread michael watson \(IAH-C\)
Hi

Dumb question time again, for which I apologise.

I have a variable that contains the following numerical text "04010".
This is the name to access a list:

> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"

Marvellous!  Except I want to do that when "04010" is assigned to a
variable called path and I can't figure out how to do it!

> path <- "04010"
>
> # the original and best
> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
>
> # clearly this doesn't, and shouldn't, work
> as.list(KEGGPATHID2NAME)$path
NULL
>
> # this produces a string...
> eval(paste("as.list(KEGGPATHID2NAME)$",path,sep=''))
[1] "as.list(KEGGPATHID2NAME)$04010"
>
> # as does this
> eval(paste('as.list(KEGGPATHID2NAME)$"',path,'"',sep=''))
[1] "as.list(KEGGPATHID2NAME)$\"04010\""
>

Whats really annoying is that when everyone mails me the answer, I'm
going to have known how obvious it is Thanks in advance

Mick
Village Idiot

__
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] RE: Using a number as a name to access a list

2005-02-10 Thread michael watson \(IAH-C\)
The answer of course is parse()!

Thank you and good night!
M

-Original Message-
From: michael watson (IAH-C) 
Sent: 10 February 2005 13:36
To: r-help@stat.math.ethz.ch
Subject: Using a number as a name to access a list


Hi

Dumb question time again, for which I apologise.

I have a variable that contains the following numerical text "04010".
This is the name to access a list:

> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"

Marvellous!  Except I want to do that when "04010" is assigned to a
variable called path and I can't figure out how to do it!

> path <- "04010"
>
> # the original and best
> as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
>
> # clearly this doesn't, and shouldn't, work 
> as.list(KEGGPATHID2NAME)$path
NULL
>
> # this produces a string...
> eval(paste("as.list(KEGGPATHID2NAME)$",path,sep=''))
[1] "as.list(KEGGPATHID2NAME)$04010"
>
> # as does this
> eval(paste('as.list(KEGGPATHID2NAME)$"',path,'"',sep=''))
[1] "as.list(KEGGPATHID2NAME)$\"04010\""
>

Whats really annoying is that when everyone mails me the answer, I'm
going to have known how obvious it is Thanks in advance

Mick
Village Idiot

__
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] Failure of update.packages()

2005-02-10 Thread plummer
Quoting Jari Oksanen <[EMAIL PROTECTED]>:

> On Thu, 2005-02-10 at 13:52 +0100, Peter Dalgaard wrote:
> > I M S White <[EMAIL PROTECTED]> writes:
> >
> > > Can anyone explain why with latest version of R (2.0.1) on FC3, installed
> > > from R-2.0.1-0.fdr.2.fc3.i386.rpm, update.packages() produces the message
> > >
> > > /usr/lib/R/bin/Rcmd exec: INSTALL: not found.
> > >
> > > Indeed /usr/lib/R/bin seems to lack various shell scripts (INSTALL,
> > > REMOVE, etc).
>
> > You need to install the R-devel package too:
> > 1
> > R-devel-2.0.1-0.fdr.2.fc3.i386.rpm
> >
> > The big idea is that this will suck in all the required compilers,
> > libraries, and include files via RPM dependencies, but users with
> > limited disk space may be content with the binaries of R+recommended
> > packages.
> >
> This kind of problems were to be anticipated, weren't they? The great
> divide between use-only and devel packages is a rpm packaging standard,
> but not very useful in this case: it splits a 568K devel chip from a
> 15.4M chunk of base R. Moreover, you don't have a repository of binary
> packages for Linux which means that not many people can use the 568K
> saving in download times (saving in disk space is more considerable of
> course). So are there plans for binary Linux packages for other distros
> than Debian so that people could use the non-devel piece of R only?
>
> cheers, jari oksanen

The splitting is an experiment (and I said so when I announced it).
It does have unforseen consequences, like implicating me in maintaining a
repository of binary RPMs for CRAN packages, which I'm not particularly keen
on.

So I shall probably revert to a single RPM, and force the installation
requirements to be the same as the build requirements.  This was, in fact,
Peter's suggestion which shows that not everybody is as short-sighted as me.

Martyn

__
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 a number as a name to access a list

2005-02-10 Thread Dimitris Rizopoulos
lists are like vectors, i.e.,
x <- c("a" = 1, "b" = 2)
path <- "b"
x[path]
the same applies to lists:
lis <- list(a = 1:3)
path <- "a"
lis[path]
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/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: "michael watson (IAH-C)" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, February 10, 2005 2:35 PM
Subject: [R] Using a number as a name to access a list


Hi
Dumb question time again, for which I apologise.
I have a variable that contains the following numerical text 
"04010".
This is the name to access a list:

as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
Marvellous!  Except I want to do that when "04010" is assigned to a
variable called path and I can't figure out how to do it!
path <- "04010"
# the original and best
as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
# clearly this doesn't, and shouldn't, work
as.list(KEGGPATHID2NAME)$path
NULL
# this produces a string...
eval(paste("as.list(KEGGPATHID2NAME)$",path,sep=''))
[1] "as.list(KEGGPATHID2NAME)$04010"
# as does this
eval(paste('as.list(KEGGPATHID2NAME)$"',path,'"',sep=''))
[1] "as.list(KEGGPATHID2NAME)$\"04010\""

Whats really annoying is that when everyone mails me the answer, I'm
going to have known how obvious it is Thanks in advance
Mick
Village Idiot
__
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] Using a number as a name to access a list

2005-02-10 Thread Jan T. Kim
On Thu, Feb 10, 2005 at 01:35:56PM -, michael watson (IAH-C) wrote:

> I have a variable that contains the following numerical text "04010".
> This is the name to access a list:
> 
> > as.list(KEGGPATHID2NAME)$"04010"
> [1] "MAPK signaling pathway"
> 
> Marvellous!  Except I want to do that when "04010" is assigned to a
> variable called path and I can't figure out how to do it!
> 
> > path <- "04010"
> >
> > # the original and best
> > as.list(KEGGPATHID2NAME)$"04010"
> [1] "MAPK signaling pathway"
> >
> > # clearly this doesn't, and shouldn't, work
> > as.list(KEGGPATHID2NAME)$path
> NULL

$ allows only a literal character string or a symbol as the index, according
to the R language definition, but [[ indexing does the same as $ and can
be used for computed indexing. So

as.list(KEGGPATHID2NAME)[[path]]

should do what you want.

Greetinx, Jan
-- 
 +- Jan T. Kim ---+
 |*NEW*email: [EMAIL PROTECTED]   |
 |*NEW*WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=<  hierarchical systems are for files, not for humans  >=-*

__
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] algorithms for matching and Hungarian method

2005-02-10 Thread Martin Olivier
Hi all,
I would like to match two partitions. That is, if I have exactly the 
same objects grouped
together for the two partitions, the labels may be arbitrarly permuted. 
and so, i would like
to know the correspondances of the groups between the two clusterings.

In the e1701 pachage, it is possible to use the function  matchClasses() 
for this problem. The problem is that
for k greater than 10 (k number of classes), I have a memory problem. So 
I would like to know
if this function explicitly examine all k! possible matches, or if it 
uses the Hungarian
method (or an other optimal algorithm).  If not, do you know if I can 
find one.

Best 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


[R] xyplot() question

2005-02-10 Thread Christoph Scherber
Dear R Users,
I have an xyplot() where different plotting symbols are used for 
subgroups (originally used within S-Plus, but hopefully it´s also 
applicable to R users).
How can I fit separate regression lines for every subgroup? So far, I 
can only plot the overall fitted line.

The code looks like this:
trellis.device()
sps<-trellis.par.get("superpose.symbol")
sps$pch<-1:7
trellis.par.set("superpose.symbol",sps)
spl <- trellis.par.get("superpose.line")  
ps$lty <- 1:7 
trellis.par.set("superpose.line",spl) 
xyplot(a~b|factor+treatment,
groups=external,data=ownframe,layout=c(2,2),
panel=function(x,y,subscripts,...){panel.superpose(x,y,subscripts,...);panel.lmline(x,y)}) 

Thank you very much for your help!
Regards
Christioph
__
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] xyplot() question

2005-02-10 Thread Deepayan Sarkar
On Thursday 10 February 2005 09:34, Christoph Scherber wrote:
> Dear R Users,
>
> I have an xyplot() where different plotting symbols are used for
> subgroups (originally used within S-Plus, but hopefully it´s also
> applicable to R users).
>  How can I fit separate regression lines for every subgroup? So far,
> I can only plot the overall fitted line.
>
> The code looks like this:
>
> trellis.device()
> sps<-trellis.par.get("superpose.symbol")
> sps$pch<-1:7
> trellis.par.set("superpose.symbol",sps)
>
> spl <- trellis.par.get("superpose.line")
> ps$lty <- 1:7
> trellis.par.set("superpose.line",spl)
> xyplot(a~b|factor+treatment,
> groups=external,data=ownframe,layout=c(2,2),
> panel=function(x,y,subscripts,...){panel.superpose(x,y,subscripts,...
>);panel.lmline(x,y)})

xyplot(a~b|factor+treatment,
   groups=external,data=ownframe,layout=c(2,2),
   panel.groups=function(x,y,...){ 
   panel.xyplot(x,y,...)
   panel.lmline(x,y,...)
   }) 

or

xyplot(a~b|factor+treatment,
   groups=external,data=ownframe,layout=c(2,2),
   type = c('p', 'r'))

Deepayan

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


Re: [R] install RMySQL

2005-02-10 Thread Don MacQueen
I have a working installation of RMySQL in Mac OS X (10.3.7). I have 
libz in /usr/lib, as you do.
None of my personal installation notes mention doing anything special 
for /usr/lib/libz*.
My R was built from a source distribution; it is not a binary 
distribution. (version info below)

The only extra step I do is to define environment variables 
PKG_CPPFLAGS and PKG_LIBS,
like this:

mysql.home <- '/usr/local/mysql'
Sys.putenv('PKG_CPPFLAGS'=paste('-I',file.path(mysql.home,'include'),sep=''))
Sys.putenv('PKG_LIBS'=paste('-L',file.path(mysql.home,'lib'),' 
-lmysqlclient',sep=''))
install.packages('RMySQL')

You could try adding /usr/lib to PKG_LIBS.
-Don

 version
 _   
platform powerpc-apple-darwin6.8.5
arch powerpc 
os   darwin6.8.5 
system   powerpc, darwin6.8.5
status   
major2   
minor0.1 
year 2004
month11  
day  15  
language R   

RMySQL is 0.5-5
At 9:10 AM -0600 2/9/05, Xander  Meadow wrote:
Hi,
I'm still trying to get RMySQL installed on my Mac.  When I try and
install from R (version 2.0.1) I'm told that the library "libz" can't be
located.  It suggests checking in /usr/lib to see if I have the
necessary libraries.  However, if I check /usr/lib I find I have the
following:
libz.1.1.3.dylib*
libz.1.dylib*
libz.dylib@
Since I have the libraries that RMySQL needs to install I can't figure
out why the installation is failing.  Does anyone have any thoughts on
how to get RMySQL installed on my Mac?  Thanks so much.
Xander
On Mon, 2005-02-07 at 13:52, Xander Meadow wrote:
 Hi,
 Thank you for responding.  One thing I forgot to mention (although I'm
 guessing you figured it out anyway) is that I'm running Mac OS X.
 I checked and I've got the file /usr/include/zlib.h installed on my
 machine.  Is this enough for R or does it need a more robust
 installation of zlib?  If this is enough, how do I let R know about the
 zlib.h file. If it's not, where should I get the correct zlib from?
 Thank you for any and all responses.
 -Xander
 On Mon, 2005-02-07 at 13:43, Roger D. Peng wrote:
 > R comes with it's own copy of zlib so even if it is compiled into R,
 > there isn't necessarily a system-wide installation of the library.
 > You may still need to install it.
 >
 > -roger
 >
 > Xander Meadow wrote:
 > > Hi,
 > >
 > > I've got a Dual G5 running 10.3.7 and I'm trying to install RMySQL.
 > > I've already got R up and running.  When I try the command
 > >
 > >
 > >>install.packages("RMySQL")
 > >
 > >
 > > It downloads a few things and then produces the following error:
 > > ---
 > > Configuration error:
 > >Could not locate the library "libz" required by MySQL.
 > > 
 > > INSTRUCTIONS:
 > > 
 > >The "libz" library is required by the MySQL client library
 > >in order to compress/uncompress connections between clients
 > >and the MySQL engine.
 > > 
 > >Make sure you have "libz" installed properly and/or included
 > >in your $LD_LIBRARY_PATH.  Perhaps it is not in any of the
 > >standard directories (e.g., /usr/lib/, /usr/local/lib)?
 > > 
 > > Aborting the installation of RMySQL.
 > > 
 > > ERROR: configuration failed for package 'RMySQL'
 > > 
 > >
 > > However, if I check for libz I get:
 > >
 > >
 > >>capabilities("libz")
 > >
 > > libz
 > > TRUE
 > >
 > > I'm not sure what the problem is because R is telling me that it doesn't
 > > know where libz is, but then it's also telling me it does know where
 > > libz is.
 > >
 > > Has anyone else seen this problem or know how I can get RMySQL installed
 > > on my machine?
 > >
 > > Just as an added note I know that install.packages works because
 > > >
 > >
 > >>install.packages("DBI")
 > >
 > >
 > > worked without a problem.
 > >
 > > Thanks again.
 > >
 > > -Xander
 > >
 > > __
 > > 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

--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
__
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-gui

RE: [R] Annual cumulative sums from time series

2005-02-10 Thread Brahm, David
Georg Hoermann [mailto:[EMAIL PROTECTED] wrote:
> www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv ...
contains a 10 year dataset.
> We often need cumulative *annual* sums (sunshine, precipitation), i.e.
the sum must reset to 0
> at the beginning of the year. I know of cumsum(), but I do not now how
to split the dataset
> automagically into annual pieces so I can cumsum() every year
separately.

Several replies have been given using tapply/aggregate/split; here is a
more primitive approach.
I do the cumsum once for the series, and call it "x".  Then I subtract
from x the value of x on 12/31
of the prior year:

R> y <- read.csv("erle_stat.csv", as.is=TRUE)
R> year <- substring(y$DATUM, 7)
R> x <- cumsum(y$Peff)
R> y$cumPeff <- x - c(0,x)[match(year, year)]

-- David Brahm ([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] Looking for tools to run case crossover analysis

2005-02-10 Thread Thomas Lumley
On Wed, 10 Feb 2005, Arin Basu wrote:
Hi All:
I am interested in tools available in R that will enable me to run 
analysis of case crossover studies.

Conditional logistic regression, the basic tool, is the survival package.
-thomas
__
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] RE: Using a number as a name to access a list

2005-02-10 Thread Thomas Lumley
On Thu, 10 Feb 2005, michael watson (IAH-C) wrote:
The answer of course is parse()!
Nononono.  If the answer is parse() you should usually rethink the 
question.

The answer is as.list(WHATEVERITWASCALLED)[[path]]
-thomas
Thank you and good night!
M
-Original Message-
From: michael watson (IAH-C)
Sent: 10 February 2005 13:36
To: r-help@stat.math.ethz.ch
Subject: Using a number as a name to access a list
Hi
Dumb question time again, for which I apologise.
I have a variable that contains the following numerical text "04010".
This is the name to access a list:
as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
Marvellous!  Except I want to do that when "04010" is assigned to a
variable called path and I can't figure out how to do it!
path <- "04010"
# the original and best
as.list(KEGGPATHID2NAME)$"04010"
[1] "MAPK signaling pathway"
# clearly this doesn't, and shouldn't, work
as.list(KEGGPATHID2NAME)$path
NULL
# this produces a string...
eval(paste("as.list(KEGGPATHID2NAME)$",path,sep=''))
[1] "as.list(KEGGPATHID2NAME)$04010"
# as does this
eval(paste('as.list(KEGGPATHID2NAME)$"',path,'"',sep=''))
[1] "as.list(KEGGPATHID2NAME)$\"04010\""

Whats really annoying is that when everyone mails me the answer, I'm
going to have known how obvious it is Thanks in advance
Mick
Village Idiot
__
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
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


[R] correcting for autocorrelation in models with panel data?

2005-02-10 Thread David Hugh-Jones
Hi 

I have some panel data for the 50 US states over about 25 years, and I
would like to test a simple model via OLS, using this data. I know how
to run OLS in R, and I think I can see how to  create Panel Corrected
Standard Errors using

http://jackman.stanford.edu/classes/350C/pcse.r

What I can't figure out is how to correct for autocorrelation over
time. I have found a lot of R stuff on time series models but they all
seem focused on predicting a single variable from its previous values.
Can anyone explain to me how to detect and get round autocorrelation?
Is there a package for panel data that I have missed?

I appreciate that this is probably just as much about my ignorance of
econometrics as about R itself!

Cheers
David

__
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] Failure of update.packages()

2005-02-10 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

> Quoting Jari Oksanen <[EMAIL PROTECTED]>:
> 
> > On Thu, 2005-02-10 at 13:52 +0100, Peter Dalgaard wrote:
> > > I M S White <[EMAIL PROTECTED]> writes:
> > >
> > > > Can anyone explain why with latest version of R (2.0.1) on FC3, 
> > > > installed
> > > > from R-2.0.1-0.fdr.2.fc3.i386.rpm, update.packages() produces the 
> > > > message
> > > >
> > > > /usr/lib/R/bin/Rcmd exec: INSTALL: not found.
> > > >
> > > > Indeed /usr/lib/R/bin seems to lack various shell scripts (INSTALL,
> > > > REMOVE, etc).
> >
> > > You need to install the R-devel package too:
> > > 1
> > > R-devel-2.0.1-0.fdr.2.fc3.i386.rpm
> > >
> > > The big idea is that this will suck in all the required compilers,
> > > libraries, and include files via RPM dependencies, but users with
> > > limited disk space may be content with the binaries of R+recommended
> > > packages.
> > >
> > This kind of problems were to be anticipated, weren't they? The great
> > divide between use-only and devel packages is a rpm packaging standard,
> > but not very useful in this case: it splits a 568K devel chip from a
> > 15.4M chunk of base R. Moreover, you don't have a repository of binary
> > packages for Linux which means that not many people can use the 568K
> > saving in download times (saving in disk space is more considerable of
> > course). So are there plans for binary Linux packages for other distros
> > than Debian so that people could use the non-devel piece of R only?
> >
> > cheers, jari oksanen
> 
> The splitting is an experiment (and I said so when I announced it).
> It does have unforseen consequences, like implicating me in maintaining a
> repository of binary RPMs for CRAN packages, which I'm not particularly keen
> on.
> 
> So I shall probably revert to a single RPM, and force the installation
> requirements to be the same as the build requirements.  This was, in fact,
> Peter's suggestion which shows that not everybody is as short-sighted as me.
> 
> Martyn

Hmm... Actually, you had sort of convinced me that the split might be
a good idea. Point being of course that it's not the 568K that gets
shaved off in R-devel, it's the 12M for gcc + the 5M for g77 + 28M for
perl + more, which are only needed for installing packages and are
therefore not dependencies of the main R RPM. Maintaining binary
package RPMs was never in the cards as I saw it. However, it then only
makes sense if a sizable proportion of R users are never going to
install packages. Otherwise you get cost of having to explain the
point repeatedly, at basically zero benefit.

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
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] correcting for autocorrelation in models with panel data?

2005-02-10 Thread Doran, Harold
In the nlme package you can find the gls() function to account for
autocorrelation over time using corAR1. Syntax might look something like
this:

fm1 <- gls(response ~ IV, long, correlation=corAR1(form=~1|ID),
method='ML')

You can also use weights() for heteroscedasticity.

-Harold

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Hugh-Jones
Sent: Thursday, February 10, 2005 12:15 PM
To: r-help@stat.math.ethz.ch
Subject: [R] correcting for autocorrelation in models with panel data?

Hi 

I have some panel data for the 50 US states over about 25 years, and I
would like to test a simple model via OLS, using this data. I know how
to run OLS in R, and I think I can see how to  create Panel Corrected
Standard Errors using

http://jackman.stanford.edu/classes/350C/pcse.r

What I can't figure out is how to correct for autocorrelation over time.
I have found a lot of R stuff on time series models but they all seem
focused on predicting a single variable from its previous values.
Can anyone explain to me how to detect and get round autocorrelation?
Is there a package for panel data that I have missed?

I appreciate that this is probably just as much about my ignorance of
econometrics as about R itself!

Cheers
David

__
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] Conversion of Affy IDs , LocusLink IDs etc...

2005-02-10 Thread Pankaj Chopra
Hi,

I was trying to compare differential expression data
from multiple studies ( 4 dataset downloaded from NCBI
GEO). The expression dataset are from Affy, as well as
cDNA (dual channel) platforms. Before I conduct
analysis, I have to map the gene IDs so that the
different genes are comparable.

Which packages, and what commands do I need for this?

thanks,

Pankaj

__
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] Automaattinen poissaolovastaus: Document

2005-02-10 Thread Volotinen Jaana
Hei,

Olen lomalla ja palaan 16.02.2005.

Tilinavauksia hoitaa Annika Berglund 9 09-825 550.
Tilinavauksissa saattaa olla parin päivän viive.

T: Jaana Volotinen

[[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] install RMySQL

2005-02-10 Thread Xander Meadow
Hi,

Thank you so much for the help.  After setting the environment variables
I was able to install RMySQL.  Thanks again.


>Xander

On Thu, 2005-02-10 at 10:09, Don MacQueen wrote:
> I have a working installation of RMySQL in Mac OS X (10.3.7). I have 
> libz in /usr/lib, as you do.
> None of my personal installation notes mention doing anything special 
> for /usr/lib/libz*.
> My R was built from a source distribution; it is not a binary 
> distribution. (version info below)
> 
> The only extra step I do is to define environment variables 
> PKG_CPPFLAGS and PKG_LIBS,
> like this:
> 
> mysql.home <- '/usr/local/mysql'
> Sys.putenv('PKG_CPPFLAGS'=paste('-I',file.path(mysql.home,'include'),sep=''))
> Sys.putenv('PKG_LIBS'=paste('-L',file.path(mysql.home,'lib'),' 
> -lmysqlclient',sep=''))
> install.packages('RMySQL')
> 
> You could try adding /usr/lib to PKG_LIBS.
> 
> -Don
> 
> 
> >  version
>   _   
> platform powerpc-apple-darwin6.8.5
> arch powerpc 
> os   darwin6.8.5 
> system   powerpc, darwin6.8.5
> status   
> major2   
> minor0.1 
> year 2004
> month11  
> day  15  
> language R   
> 
> 
> RMySQL is 0.5-5
> 
> 
> At 9:10 AM -0600 2/9/05, Xander  Meadow wrote:
> >Hi,
> >
> >I'm still trying to get RMySQL installed on my Mac.  When I try and
> >install from R (version 2.0.1) I'm told that the library "libz" can't be
> >located.  It suggests checking in /usr/lib to see if I have the
> >necessary libraries.  However, if I check /usr/lib I find I have the
> >following:
> >
> >libz.1.1.3.dylib*
> >libz.1.dylib*
> >libz.dylib@
> >
> >Since I have the libraries that RMySQL needs to install I can't figure
> >out why the installation is failing.  Does anyone have any thoughts on
> >how to get RMySQL installed on my Mac?  Thanks so much.
> >
> >>Xander
> >
> >On Mon, 2005-02-07 at 13:52, Xander Meadow wrote:
> >>  Hi,
> >>
> >>  Thank you for responding.  One thing I forgot to mention (although I'm
> >>  guessing you figured it out anyway) is that I'm running Mac OS X.
> >>
> >>  I checked and I've got the file /usr/include/zlib.h installed on my
> >>  machine.  Is this enough for R or does it need a more robust
> >>  installation of zlib?  If this is enough, how do I let R know about the
> >>  zlib.h file. If it's not, where should I get the correct zlib from?
> >>  Thank you for any and all responses.
> >>
> >>  -Xander
> >>
> >>  On Mon, 2005-02-07 at 13:43, Roger D. Peng wrote:
> >>  > R comes with it's own copy of zlib so even if it is compiled into R,
> >>  > there isn't necessarily a system-wide installation of the library.
> >>  > You may still need to install it.
> >>  >
> >>  > -roger
> >>  >
> >>  > Xander Meadow wrote:
> >>  > > Hi,
> >>  > >
> >>  > > I've got a Dual G5 running 10.3.7 and I'm trying to install RMySQL.
> >>  > > I've already got R up and running.  When I try the command
> >>  > >
> >>  > >
> >>  > >>install.packages("RMySQL")
> >>  > >
> >>  > >
> >>  > > It downloads a few things and then produces the following error:
> >>  > > ---
> >>  > > Configuration error:
> >>  > >Could not locate the library "libz" required by MySQL.
> >>  > > 
> >>  > > INSTRUCTIONS:
> >>  > > 
> >>  > >The "libz" library is required by the MySQL client library
> >>  > >in order to compress/uncompress connections between clients
> >>  > >and the MySQL engine.
> >>  > > 
> >>  > >Make sure you have "libz" installed properly and/or included
> >>  > >in your $LD_LIBRARY_PATH.  Perhaps it is not in any of the
> >>  > >standard directories (e.g., /usr/lib/, /usr/local/lib)?
> >>  > > 
> >>  > > Aborting the installation of RMySQL.
> >>  > > 
> >>  > > ERROR: configuration failed for package 'RMySQL'
> >>  > > 
> >>  > >
> >>  > > However, if I check for libz I get:
> >>  > >
> >>  > >
> >>  > >>capabilities("libz")
> >>  > >
> >>  > > libz
> >>  > > TRUE
> >>  > >
> >>  > > I'm not sure what the problem is because R is telling me that it 
> >> doesn't
> >>  > > know where libz is, but then it's also telling me it does know where
> >>  > > libz is.
> >>  > >
> >>  > > Has anyone else seen this problem or know how I can get RMySQL 
> >> installed
> >>  > > on my machine?
> >>  > >
> >>  > > Just as an added note I know that install.packages works because
> >  > > >
> >>  > >
> >>  > >>install.packages("DBI")
> >>  > >
> >>  > >
> >>  > > worked without a problem.
> >>  > >
> >>  > > Thanks again.
> >>  > >
> >>  > > -Xander
> >>  > >
> >>  > > __
> >>  > > 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] Conversion of Affy IDs , LocusLink IDs etc...

2005-02-10 Thread Uwe Ligges
Pankaj Chopra wrote:
Hi,
I was trying to compare differential expression data
from multiple studies ( 4 dataset downloaded from NCBI
GEO). The expression dataset are from Affy, as well as
cDNA (dual channel) platforms. Before I conduct
analysis, I have to map the gene IDs so that the
different genes are comparable.
Which packages, and what commands do I need for this?

Take a look at the Bioconductor project:
http://www.bioconductor.org/
Uwe Ligges
thanks,
Pankaj
__
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] testing slopes different than a given value

2005-02-10 Thread Manuel Gutierrez
In a multiple linear regression with two independent
variables is there any function in R to test for the
coefficients being different than some given values?
Example:
x1<-rnorm(100)
x2<-rnorm(100)
y<-3+0.6*x1+0.3*x2 
lm(y~x1+x2)
Obtain a test for the coefficients for x1 being 
different than 0.6 and for x2 different than 0.3
Thanks
Manuel

__
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] Conversion of Affy IDs , LocusLink IDs etc...

2005-02-10 Thread Berton Gunter
You may also be interested in the following, which point out potentially
severe problems with such metanalyses. 

http://www.cbs.dtu.dk/courses/norfa2004/Extras/5_1_Yves_TiG_meta-analysis_Ar
ticle.pdf

http://www.clinchem.org/cgi/content/full/47/8/1350

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges
> Sent: Thursday, February 10, 2005 10:29 AM
> To: Pankaj Chopra
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] Conversion of Affy IDs , LocusLink IDs etc...
> 
> Pankaj Chopra wrote:
> 
> > Hi,
> > 
> > I was trying to compare differential expression data
> > from multiple studies ( 4 dataset downloaded from NCBI
> > GEO). The expression dataset are from Affy, as well as
> > cDNA (dual channel) platforms. Before I conduct
> > analysis, I have to map the gene IDs so that the
> > different genes are comparable.
> > 
> > Which packages, and what commands do I need for this?
> 
> 
> Take a look at the Bioconductor project:
> http://www.bioconductor.org/
> 
> Uwe Ligges
> 
> > thanks,
> > 
> > Pankaj
> > 
> > __
> > 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] correcting for autocorrelation in models with panel data?

2005-02-10 Thread David Hugh-Jones
That's very helpful - I was on the point of giving up and going with
Stata! I will look into that in more detail. I assume that afterwards
it would be ok to apply the Beck and Katz procedure to get panel
corrected standard errors.

Cheers
David


On Thu, 10 Feb 2005 12:36:32 -0500, Doran, Harold <[EMAIL PROTECTED]> wrote:
> In the nlme package you can find the gls() function to account for
> autocorrelation over time using corAR1. Syntax might look something like
> this:
> 
> fm1 <- gls(response ~ IV, long, correlation=corAR1(form=~1|ID),
> method='ML')
> 
> You can also use weights() for heteroscedasticity.
> 
> -Harold
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of David Hugh-Jones
> Sent: Thursday, February 10, 2005 12:15 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] correcting for autocorrelation in models with panel data?
> 
> Hi
> 
> I have some panel data for the 50 US states over about 25 years, and I
> would like to test a simple model via OLS, using this data. I know how
> to run OLS in R, and I think I can see how to  create Panel Corrected
> Standard Errors using
> 
> http://jackman.stanford.edu/classes/350C/pcse.r
> 
> What I can't figure out is how to correct for autocorrelation over time.
> I have found a lot of R stuff on time series models but they all seem
> focused on predicting a single variable from its previous values.
> Can anyone explain to me how to detect and get round autocorrelation?
> Is there a package for panel data that I have missed?
> 
> I appreciate that this is probably just as much about my ignorance of
> econometrics as about R itself!
> 
> Cheers
> David
> 
> __
> 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] Mac OSX - outputting history to a source file (plain text file)

2005-02-10 Thread Ken Termiso
Hi,
I've got OSX 10.3 and R v2.0.1 and what I'd like to do is either take a 
history file and run it as a source file (after I modify it in a text 
editor) or simply output the command history to a plain text file that I 
could then modify and later run as source.

The .history files are somewhat serialized in that they are not 100% plain 
text, and using history(max.show = 25, reverse = FALSE) created a popup file 
with only "NA" in it.

Thanks in advance,
ken
__
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] Employment opportunities at Fair Isaac

2005-02-10 Thread Chen, Fei
Hi all,

We currently have 5 immediate openings in the Analytic Science/Product
Development organization of Fair Isaac in San Diego, CA, USA. Send me an
email if you are interested: [EMAIL PROTECTED]

Thanks much, and here's the blurb:
---

Position Overview:
Join a company that makes more than 25 billion decisions a year. By the
time you finish reading this job description Fair Isaac will have made
tens of thousands of decisions in credit risk assessment and fraud   
detection around the world. You will be a part of a talented team for
designing, developing, and deploying state-of-the-art, data-driven
predictive models to solve business problems using the latest
technologies
in neural networks, machine learning, statistical modeling, pattern
recognition, and artificial intelligence.

Job Responsibilities:
The main responsibilities include: analyzing and understanding large
amounts of historical data for data clean-up and filtering, pattern 
identification and feature extraction, feature (variable) selection,
experimenting with different types of algorithms and modeling
techniques,
analyzing performance, preparing model reports for communication with   
internal and external clients, participating in pre-sales, and providing
post implementation support.

Minimum Qualifications:
Master's or Ph.D. in science or engineering field. Industry or academic
experience in employing neural networks, machine learning techniques,
mathematical/statistical modeling, pattern recognition, or data
mining/data analysis on real world problems. Strong problem solving and

analytical ability. Excellent communication skills. A statistical
thinker
and quick learner. Team orientated attitude, as well as the ability to

work independently with minimum direction. Preferred experience with
Unix
and strong experience in C/C++ and Java.

Travel Percentage:  5

__
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] testing slopes different than a given value

2005-02-10 Thread John Fox
Dear Manuel,

Take a look at the linear.hypothesis function in the car package.

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Manuel 
> Gutierrez
> Sent: Thursday, February 10, 2005 1:36 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] testing slopes different than a given value
> 
> In a multiple linear regression with two independent 
> variables is there any function in R to test for the 
> coefficients being different than some given values?
> Example:
> x1<-rnorm(100)
> x2<-rnorm(100)
> y<-3+0.6*x1+0.3*x2
> lm(y~x1+x2)
> Obtain a test for the coefficients for x1 being different 
> than 0.6 and for x2 different than 0.3 Thanks Manuel
> 
> __
> 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] Failure of update.packages()

2005-02-10 Thread Jari Oksanen
On 10 Feb 2005, at 19:26, Peter Dalgaard wrote:
[EMAIL PROTECTED] writes:
Quoting Jari Oksanen <[EMAIL PROTECTED]>:
On Thu, 2005-02-10 at 13:52 +0100, Peter Dalgaard wrote:
I M S White <[EMAIL PROTECTED]> writes:
Can anyone explain why with latest version of R (2.0.1) on FC3, 
installed
from R-2.0.1-0.fdr.2.fc3.i386.rpm, update.packages() produces the 
message

/usr/lib/R/bin/Rcmd exec: INSTALL: not found.
Indeed /usr/lib/R/bin seems to lack various shell scripts (INSTALL,
REMOVE, etc).

You need to install the R-devel package too:
1
R-devel-2.0.1-0.fdr.2.fc3.i386.rpm
The big idea is that this will suck in all the required compilers,
libraries, and include files via RPM dependencies, but users with
limited disk space may be content with the binaries of R+recommended
packages.
This kind of problems were to be anticipated, weren't they? The great
divide between use-only and devel packages is a rpm packaging 
standard,
but not very useful in this case: it splits a 568K devel chip from a
15.4M chunk of base R. Moreover, you don't have a repository of 
binary
packages for Linux which means that not many people can use the 568K
saving in download times (saving in disk space is more considerable 
of
course). So are there plans for binary Linux packages for other 
distros
than Debian so that people could use the non-devel piece of R only?

cheers, jari oksanen
The splitting is an experiment (and I said so when I announced it).
It does have unforseen consequences, like implicating me in 
maintaining a
repository of binary RPMs for CRAN packages, which I'm not 
particularly keen
on.

So I shall probably revert to a single RPM, and force the installation
requirements to be the same as the build requirements.  This was, in 
fact,
Peter's suggestion which shows that not everybody is as short-sighted 
as me.

Martyn
Hmm... Actually, you had sort of convinced me that the split might be
a good idea. Point being of course that it's not the 568K that gets
shaved off in R-devel, it's the 12M for gcc + the 5M for g77 + 28M for
perl + more, which are only needed for installing packages and are
therefore not dependencies of the main R RPM. Maintaining binary
package RPMs was never in the cards as I saw it. However, it then only
makes sense if a sizable proportion of R users are never going to
install packages. Otherwise you get cost of having to explain the
point repeatedly, at basically zero benefit.
That's a good point. You could look at MacOS X standard installation to 
see what can be left out in a working installation. In default Mac, you 
don't have gcc (12M), nor g77, but you sure need perl for a sensible 
working machine, and tha't in default MacOS X installation. The price 
is that you need a possibility to install binary R packages. So not so 
much saving, but a bit more than what you get by shaving off R-devel.

cheers, jari oksanen
--
Jari Oksanen, Oulu, Finland
__
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] Annual cumulative sums from time series - SOLVED + questions

2005-02-10 Thread Georg Hoermann
Roger Bivand wrote:
On Thu, 10 Feb 2005, Georg Hoermann wrote:
Hello world,
based on the code of Roger I have now two solutions:
the first one (one line for the whole dataset)
- cut here --
erle <- 
read.csv(url("http://www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv";))
jahre <- factor(substring(erle$DATUM, 7))
tpks1 <- unlist(tapply(erle$Sonnen, jahre, cumsum))
plot(tpks1, type="l")

- cut here ---
The second one plots one line for each year:
 start - cut here 
# read data in from Internet
erle <- 
read.csv(url("http://www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv";))
# extract Year as a factor from variable DATUM
jahre <- factor(substring(erle$DATUM, 7))
try1 <- tapply(erle$Sonnen, jahre, cumsum)
# create colors for every year from rainbow color scheme
cols <- rainbow(length(try1))
plot(x=c(1,366), y=c(0,1200), type="n", xlab="Days", ylab="Cumulative 
sunshine (h)")
# draw the lines, one line for each year
for (i in 1:length(try1)) lines(1:length(try1[[i]]), try1[[i]], col=cols[i])

# ...and the legend
legend(c(0,100), c(400,1100), names(try1), col=cols, lwd=1, bty="n")
 end cut here -
For the second example, a mean sum for all years would also be a good 
idea...

Thanks for all solutions...
Merci & Gruss
Georg
--
Georg Hoermann, Dep. of Hydrology, Ecology, Kiel University, Germany
Tel. 0431-880-1207, icq - 348 340 729, 0172/4315715, Penguin #189476
__
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] Problem with "R CMD Rd2dvi": Rd.sty not found

2005-02-10 Thread Tuszynski, Jaroslaw W.

Hi,

I run into a problem with "R CMD Rd2dvi" command: it gives me "File `Rd.sty'
not found" error (See the output message on the bottom). I get the same
error when running "RCMD check". My system is: Windows 2000, R version
2.0.1, MiKTeX version 2.4. I do have a Rd.sty file in R_HOME/share/texm
directory.

I looked through newsgroups for any related discussions and found Arnab
Mukherji reporting the same problem on Dec 23 2003 (Subject: "[R] Rd.sty not
found -"). In reply Prof. Brian Ripley suggested the following:
It should be looking in TEXINPUTS, as is the point of the following
in the check script
$ENV{'TEXINPUTS'} = env_path(&file_path($R::Vars::R_HOME, "share",
"texmf"), $ENV{'TEXINPUTS'});
So you could try adding to TEXINPUTS yourself, and you should
certainly check the current setting of the environment variable (unset is
fine). 
I am not sure if I understand it correctly but I created environmental
variable TEXINPUTS with path to R_HOME/share/texm. It did not help.

Any other suggestions? 
Should I use some other version of Latex?
Do I have to configure it in any special way?

Thanks for any suggestions,


C:\programs\R\rw2001\src\library\caMassClass\man>R CMD Rd2dvi
BaselineSubstracton.Rd
Converting Rd files to LaTeX ...
BaselineSubstraction.Rd
Creating dvi output from LaTeX ...
This is pdfTeX, Version 3.141592-1.20a-rc7.2 (MiKTeX 2.4)
output format initialized to PDF
(Rd2.tex
LaTeX2e <2003/12/01>
Babel  and hyphenation patterns for english, french, german, ngerman,
dumylang, nohyphenation, loaded.

(C:\Program Files\latex\tex\latex\base\book.cls
Document Class: book 2004/02/16 v1.4f Standard LaTeX document class
(C:\Program Files\latex\tex\latex\base\bk10.clo))

! LaTeX Error: File `Rd.sty' not found.

Type X to quit or  to proceed,
or enter new name. (Default extension: sty)

Enter file name:
! Emergency stop.


l.4 \usepackage
   {makeidx}
No pages of output.
Transcript written on Rd2.log.
Couldn't find input index file Rd2 nor Rd2.idx.
Usage: c:\Program Files\latex\miktex\bin\makeindex.exe [-ilqrcg] [-s sty]
[-o id] [-t log] [-p num] [idx0 idx1 ...]
This is pdfTeX, Version 3.141592-1.20a-rc7.2 (MiKTeX 2.4)
output format initialized to PDF
(Rd2.tex
LaTeX2e <2003/12/01>
Babel  and hyphenation patterns for english, french, german, ngerman,
dumylang, nohyphenation, loaded.

(C:\Program Files\latex\tex\latex\base\book.cls
Document Class: book 2004/02/16 v1.4f Standard LaTeX document class
(C:\Program Files\latex\tex\latex\base\bk10.clo))

! LaTeX Error: File `Rd.sty' not found.

Type X to quit or  to proceed,
or enter new name. (Default extension: sty)

Enter file name:
! Emergency stop.


l.4 \usepackage
   {makeidx}
No pages of output.
Transcript written on Rd2.log.
Saving output to 'BaselineSubstraction.dvi' ...
cp: cannot stat `.Rd2dvi/Rd2.dvi': No such file or directory
Done
xdvi.bat: not found

Jarek
\===

 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192   ">   \
 [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] Problem with "R CMD Rd2dvi": Rd.sty not found

2005-02-10 Thread Gabor Grothendieck
Tuszynski, Jaroslaw W.  saic.com> writes:

: 
: Hi,
: 
: I run into a problem with "R CMD Rd2dvi" command: it gives me "File `Rd.sty'
: not found" error (See the output message on the bottom). I get the same
: error when running "RCMD check". My system is: Windows 2000, R version
: 2.0.1, MiKTeX version 2.4. I do have a Rd.sty file in R_HOME/share/texm
: directory.
: 
: I looked through newsgroups for any related discussions and found Arnab
: Mukherji reporting the same problem on Dec 23 2003 (Subject: "[R] Rd.sty not
: found -"). In reply Prof. Brian Ripley suggested the following:
:   It should be looking in TEXINPUTS, as is the point of the following
: in the check script
:   $ENV{'TEXINPUTS'} = env_path(&file_path($R::Vars::R_HOME, "share",
: "texmf"), $ENV{'TEXINPUTS'});
:   So you could try adding to TEXINPUTS yourself, and you should
: certainly check the current setting of the environment variable (unset is
: fine). 
: I am not sure if I understand it correctly but I created environmental
: variable TEXINPUTS with path to R_HOME/share/texm. It did not help.
: 
: Any other suggestions? 
: Should I use some other version of Latex?
: Do I have to configure it in any special way?
: 
: Thanks for any suggestions,
: 
: C:\programs\R\rw2001\src\library\caMassClass\man>R CMD Rd2dvi
: BaselineSubstracton.Rd
: Converting Rd files to LaTeX ...
: BaselineSubstraction.Rd
: Creating dvi output from LaTeX ...
: This is pdfTeX, Version 3.141592-1.20a-rc7.2 (MiKTeX 2.4)
: output format initialized to PDF
: (Rd2.tex
: LaTeX2e <2003/12/01>
: Babel  and hyphenation patterns for english, french, german, ngerman,
: dumylang, nohyphenation, loaded.
: 
: (C:\Program Files\latex\tex\latex\base\book.cls
: Document Class: book 2004/02/16 v1.4f Standard LaTeX document class
: (C:\Program Files\latex\tex\latex\base\bk10.clo))
: 
: ! LaTeX Error: File `Rd.sty' not found.
: 
: Type X to quit or  to proceed,
: or enter new name. (Default extension: sty)
: 
: Enter file name:
: ! Emergency stop.
: 
: 
: l.4 \usepackage
:{makeidx}
: No pages of output.
: Transcript written on Rd2.log.
: Couldn't find input index file Rd2 nor Rd2.idx.
: Usage: c:\Program Files\latex\miktex\bin\makeindex.exe [-ilqrcg] [-s sty]
: [-o id] [-t log] [-p num] [idx0 idx1 ...]
: This is pdfTeX, Version 3.141592-1.20a-rc7.2 (MiKTeX 2.4)
: output format initialized to PDF
: (Rd2.tex
: LaTeX2e <2003/12/01>
: Babel  and hyphenation patterns for english, french, german, ngerman,
: dumylang, nohyphenation, loaded.
: 
: (C:\Program Files\latex\tex\latex\base\book.cls
: Document Class: book 2004/02/16 v1.4f Standard LaTeX document class
: (C:\Program Files\latex\tex\latex\base\bk10.clo))
: 
: ! LaTeX Error: File `Rd.sty' not found.
: 
: Type X to quit or  to proceed,
: or enter new name. (Default extension: sty)
: 
: Enter file name:
: ! Emergency stop.
: 
: 
: l.4 \usepackage
:{makeidx}
: No pages of output.
: Transcript written on Rd2.log.
: Saving output to 'BaselineSubstraction.dvi' ...
: cp: cannot stat `.Rd2dvi/Rd2.dvi': No such file or directory
: Done
: xdvi.bat: not found
: 


There is some information on this at:

http://www.murdoch-sutherland.com/Rtools/miktex.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] rewrite of scatter.smooth to handle NAs

2005-02-10 Thread William Briggs
I rewrote scatter.smooth to handle missing values, but I have a question 
about a move I had to make.  Here's the code:

Mscatter.smooth<-function (x, y, span = 2/3, degree = 1, family = 
c("symmetric",
"gaussian"), xlab = deparse(substitute(x)), ylab = 
deparse(substitute(y)),
ylim = range(y, prediction$y), evaluation = 50, ...)
{
if (inherits(x, "formula")) {
if (length(x) < 3)
stop("need response in formula")
thiscall <- match.call()
thiscall$x <- x[[3]]
thiscall$y <- x[[2]]
return(invisible(eval(thiscall, sys.parent(
}
##
plot(x, y, xlab = xlab, ylab = ylab, ...)
	i<-complete.cases(x,y)
	x<-x[i]
	y<-y[i]
##
prediction <- loess.smooth(x, y, span, degree, family, evaluation)
lines(prediction)
invisible()
}

The changes I made are between the '###'.  The idea was only to 
pass complete cases on to loess.smooth and thus avoice the NA error 
you'd usually get by calling scatter.smooth with missing values.

I had to move the plot above the loess.smooth, whereas in the orginal 
scatter.smooth is was just below to take adavantage of prediction$y to 
set the ylim in the plotting function.

But if I try to plot after creating the complete cases, the names of the 
x and y variables disappear and instead the plotting labels on the x and 
y axis look like, for example, 'c(1,2,1.2,5.2, ...)', that is, the 
vector of values being plotted.

Why does that happen?
Matt
--
William (Matt) Briggs
Assistant Professor of Biostatistics
Division of General Internal Medicine
Weill Medical College of Cornell University
525 East 68th St., Box #46
New York, NY 10021
Tel: 212-628-0128; Fax: 212-746-8965
http://drclamp.wmbriggs.com
__
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] skip missing values in plots

2005-02-10 Thread Dean Sonneborn

 I really like these Trellis graphics but how do I get this code to 
skip the missing?

logreg<-read.csv("logreg.csv", header=TRUE, sep=",", na.string=" ")
attach(logreg)

bwplot(yesno~bc_pcb_tot |varlist, data=logreg, main="Box Cox PCB 
transformation",  auto.key=TRUE, fontfamily = "HersheySans" )


Dean Sonneborn M.S.
Public Health Sciences *
University of California, Davis
916 734-6656

* formerly Epidemiology & Preventive Medicine

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

2005-02-10 Thread T. Murlidharan Nair
I am trying to sample a subset from a matrix using sample.
The size of the matrix is 20X 1532. It works fine with this,
but when I transpose the matrix and try to sample it, it returns
null.  
pick.set<-sample(tissue.exp.t,5,replace=FALSE,prob=NULL)

Is there something that I am missing here ?  
Thanks ../Murli

__
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] rewrite of scatter.smooth to handle NAs

2005-02-10 Thread Berton Gunter
Lazy evaluation. See V&R's S Programming for a good explanation. But, in
brief, the default values for xlab and ylab are not evaluated until they are
needed. If plot(..., xlab=...) appears after the assignments to x and y,
then x and y are no longer the original argument expressions but numeric
vectors.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of William Briggs
> Sent: Thursday, February 10, 2005 1:29 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] rewrite of scatter.smooth to handle NAs
> 
> 
> I rewrote scatter.smooth to handle missing values, but I have 
> a question 
> about a move I had to make.  Here's the code:
> 
> Mscatter.smooth<-function (x, y, span = 2/3, degree = 1, family = 
> c("symmetric",
>  "gaussian"), xlab = deparse(substitute(x)), ylab = 
> deparse(substitute(y)),
>  ylim = range(y, prediction$y), evaluation = 50, ...)
> {
>  if (inherits(x, "formula")) {
>  if (length(x) < 3)
>  stop("need response in formula")
>  thiscall <- match.call()
>  thiscall$x <- x[[3]]
>  thiscall$y <- x[[2]]
>  return(invisible(eval(thiscall, sys.parent(
>  }
> ##
>  plot(x, y, xlab = xlab, ylab = ylab, ...)
>   i<-complete.cases(x,y)
>   x<-x[i]
>   y<-y[i]
> ##
>  prediction <- loess.smooth(x, y, span, degree, family, 
> evaluation)
>  lines(prediction)
>  invisible()
> }
> 
> The changes I made are between the '###'.  The idea 
> was only to 
> pass complete cases on to loess.smooth and thus avoice the NA error 
> you'd usually get by calling scatter.smooth with missing values.
> 
> I had to move the plot above the loess.smooth, whereas in the orginal 
> scatter.smooth is was just below to take adavantage of 
> prediction$y to 
> set the ylim in the plotting function.
> 
> But if I try to plot after creating the complete cases, the 
> names of the 
> x and y variables disappear and instead the plotting labels 
> on the x and 
> y axis look like, for example, 'c(1,2,1.2,5.2, ...)', that is, the 
> vector of values being plotted.
> 
> Why does that happen?
> 
> Matt
> -- 
> William (Matt) Briggs
> Assistant Professor of Biostatistics
> Division of General Internal Medicine
> Weill Medical College of Cornell University
> 525 East 68th St., Box #46
> New York, NY 10021
> Tel: 212-628-0128; Fax: 212-746-8965
> 
> http://drclamp.wmbriggs.com
> 
> __
> 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] Curious Behavior with Curve() and dnorm()

2005-02-10 Thread Thomas Hopper
I am attempting to wrap the histogram function in my own custom 
function, so that I can quickly generate some standard plots.

A part of what I want to do is to draw a normal curve over the histogram:
> x <- rnorm(1000)
> hist(x, freq=F)
> curve(dnorm(x), lty=3, add=T)
(for normal use, x would be a vector of empirical values, but the 
rnorm() function works for testing)

That works just as you'd expect, but I've found something a bit strange.
If I try the following:
> curve(dnorm(x, mean=mean(x), sd=sd(x)), lty=3, add=T)
I get a much flatter and broader curve (which looks like it probably has 
the same area as the first curve, though I haven't tested).

However, if I do
> z <- sd(x)
> curve(dnorm(x, mean=mean(x), sd=z), lty=1, add=T)
I get the curve you'd expect; it draws right over the first curve 
(curve(dnorm(x),...), above).

I haven't touched x between the call to curve() containing 
dnorm(...,sd=sd(x)) and the call to curve() containing dnorm(...,sd=z), 
and tests show that z == sd(x).

I get similar results if I manually type in the standard deviation of 
x--the expected curve is drawn--so the broader and flatter curve is only 
drawn when I call dnorm with sd=sd(x).

Is there a reason for this, or is there something odd going on with the 
call to curve()?

Regards,
Tom
__
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] rats in survival package

2005-02-10 Thread Gonzalez Ruiz, Juan Ramon
Dear R-listers,
 
Does anybody know what is the correct source of "rats" dataset in survival 
package?
 
The help gives the following information:
 
Rat data from survival5
Description:
 48 rats were injected with a carcinogen, and then randomized to
 either drug or placebo.  The number of tumors ranges from 0 to 13;
 all rats were  censored at 6 months after randomization.
Usage:
 data(rats)
Format:
   rat:  id
   rx:   treatment,(1=drug, 0=control)
   observation:  within rat
   start:entry time
   stop: exit time
   status:   event status
Source:
 Gail, Sautner and Brown, Biometrics 36, 255-66, 1980
 
but "rats" data.frame contains the variables:
 
names(rats)
[1] "litter" "rx" "time"   "status"
 
It seems to be 150 rats grouped in 50 litters, and 1 mouse is treated at each 
one. So this dataset does not agree with the description above mentioned. 
 
I am very interesting in knowing the reference of this data.
 
PS/ BTW, the correct source of  rats injected with a carcinogen is Gail, 
Santner and Brown,...
 
Thanks you very much in advance,
 
Juan
 
 
 
 
 

[[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] correcting for autocorrelation in models with panel data?

2005-02-10 Thread David Hugh-Jones
Assuming I have years in YEAR and state ids in ID, I guess the
correlation ought to be

corAR1(form = ~ YEAR | ID)

?

Thanks a lot,
David




On Thu, 10 Feb 2005 12:36:32 -0500, Doran, Harold <[EMAIL PROTECTED]> wrote:
> In the nlme package you can find the gls() function to account for
> autocorrelation over time using corAR1. Syntax might look something like
> this:
> 
> fm1 <- gls(response ~ IV, long, correlation=corAR1(form=~1|ID),
> method='ML')
> 
> You can also use weights() for heteroscedasticity.
> 
> -Harold
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of David Hugh-Jones
> Sent: Thursday, February 10, 2005 12:15 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] correcting for autocorrelation in models with panel data?
> 
> Hi
> 
> I have some panel data for the 50 US states over about 25 years, and I
> would like to test a simple model via OLS, using this data. I know how
> to run OLS in R, and I think I can see how to  create Panel Corrected
> Standard Errors using
> 
> http://jackman.stanford.edu/classes/350C/pcse.r
> 
> What I can't figure out is how to correct for autocorrelation over time.
> I have found a lot of R stuff on time series models but they all seem
> focused on predicting a single variable from its previous values.
> Can anyone explain to me how to detect and get round autocorrelation?
> Is there a package for panel data that I have missed?
> 
> I appreciate that this is probably just as much about my ignorance of
> econometrics as about R itself!
> 
> Cheers
> David
> 
> __
> 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] Problem with "R CMD Rd2dvi": Rd.sty not found

2005-02-10 Thread Prof Brian Ripley
This is a problem with a recent-ish change to MikTeX to make it use 
non-standard paths: see the notes on Duncan Murdoch's site at

  http://www.murdoch-sutherland.com/Rtools/miktex.html
Fptex is a standard distribution e.g. from TexLive.
On Thu, 10 Feb 2005, Tuszynski, Jaroslaw W. wrote:
Hi,
I run into a problem with "R CMD Rd2dvi" command: it gives me "File `Rd.sty'
not found" error (See the output message on the bottom). I get the same
error when running "RCMD check". My system is: Windows 2000, R version
2.0.1, MiKTeX version 2.4. I do have a Rd.sty file in R_HOME/share/texm
directory.
I looked through newsgroups for any related discussions and found Arnab
Mukherji reporting the same problem on Dec 23 2003 (Subject: "[R] Rd.sty not
found -"). In reply Prof. Brian Ripley suggested the following:
It should be looking in TEXINPUTS, as is the point of the following
in the check script
$ENV{'TEXINPUTS'} = env_path(&file_path($R::Vars::R_HOME, "share",
"texmf"), $ENV{'TEXINPUTS'});
So you could try adding to TEXINPUTS yourself, and you should
certainly check the current setting of the environment variable (unset is
fine).
I am not sure if I understand it correctly but I created environmental
variable TEXINPUTS with path to R_HOME/share/texm. It did not help.
Any other suggestions?
Should I use some other version of Latex?
Do I have to configure it in any special way?

--
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] rewrite of scatter.smooth to handle NAs

2005-02-10 Thread Prof Brian Ripley
You need evaluate deparse(substitute(x)) _before_ you change x.
so have
xlab; ylab
early in the body of your function.
However, NEWS in R-devel says
o   scatter.smooth() and loess.smooth() now handle missing values
in their inputs.
so why reinvent that wheel?
On Thu, 10 Feb 2005, William Briggs wrote:
I rewrote scatter.smooth to handle missing values, but I have a question 
about a move I had to make.  Here's the code:

Mscatter.smooth<-function (x, y, span = 2/3, degree = 1, family = 
c("symmetric",
   "gaussian"), xlab = deparse(substitute(x)), ylab = 
deparse(substitute(y)),
   ylim = range(y, prediction$y), evaluation = 50, ...)
{
   if (inherits(x, "formula")) {
   if (length(x) < 3)
   stop("need response in formula")
   thiscall <- match.call()
   thiscall$x <- x[[3]]
   thiscall$y <- x[[2]]
   return(invisible(eval(thiscall, sys.parent(
   }
##
   plot(x, y, xlab = xlab, ylab = ylab, ...)
	i<-complete.cases(x,y)
	x<-x[i]
	y<-y[i]
##
   prediction <- loess.smooth(x, y, span, degree, family, evaluation)
   lines(prediction)
   invisible()
}

The changes I made are between the '###'.  The idea was only to pass 
complete cases on to loess.smooth and thus avoice the NA error you'd usually 
get by calling scatter.smooth with missing values.

I had to move the plot above the loess.smooth, whereas in the orginal 
scatter.smooth is was just below to take adavantage of prediction$y to set 
the ylim in the plotting function.

But if I try to plot after creating the complete cases, the names of the x 
and y variables disappear and instead the plotting labels on the x and y axis 
look like, for example, 'c(1,2,1.2,5.2, ...)', that is, the vector of values 
being plotted.

Why does that happen?
Because it is documented that way!
--
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] Curious Behavior with Curve() and dnorm()

2005-02-10 Thread Prof Brian Ripley
For which x do you think sd(x) is evaluated?
Hint: the help page shows
expr: an expression written as a function of 'x', or alternatively
  the name of a function which will be plotted.
and you have written dnorm(x, mean=mean(x), sd=sd(x)) as function of x.
On Thu, 10 Feb 2005, Thomas Hopper wrote:
I am attempting to wrap the histogram function in my own custom function, so 
that I can quickly generate some standard plots.

A part of what I want to do is to draw a normal curve over the histogram:
x <- rnorm(1000)
hist(x, freq=F)
curve(dnorm(x), lty=3, add=T)
(for normal use, x would be a vector of empirical values, but the rnorm() 
function works for testing)

That works just as you'd expect, but I've found something a bit strange.
If I try the following:
curve(dnorm(x, mean=mean(x), sd=sd(x)), lty=3, add=T)
I get a much flatter and broader curve (which looks like it probably has the 
same area as the first curve, though I haven't tested).

However, if I do
z <- sd(x)
curve(dnorm(x, mean=mean(x), sd=z), lty=1, add=T)
I get the curve you'd expect; it draws right over the first curve 
(curve(dnorm(x),...), above).

I haven't touched x between the call to curve() containing 
dnorm(...,sd=sd(x)) and the call to curve() containing dnorm(...,sd=z), and 
tests show that z == sd(x).

I get similar results if I manually type in the standard deviation of x--the 
expected curve is drawn--so the broader and flatter curve is only drawn when 
I call dnorm with sd=sd(x).

Is there a reason for this, or is there something odd going on with the call 
to curve()?
It's working as documented.
--
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] Curious Behavior with Curve() and dnorm()

2005-02-10 Thread Peter Dalgaard
Thomas Hopper <[EMAIL PROTECTED]> writes:

> I am attempting to wrap the histogram function in my own custom
> function, so that I can quickly generate some standard plots.
> 
> A part of what I want to do is to draw a normal curve over the histogram:
> 
>  > x <- rnorm(1000)
>  > hist(x, freq=F)
>  > curve(dnorm(x), lty=3, add=T)
> 
> (for normal use, x would be a vector of empirical values, but the
> rnorm() function works for testing)
> 
> That works just as you'd expect, but I've found something a bit strange.
> 
> If I try the following:
> 
>  > curve(dnorm(x, mean=mean(x), sd=sd(x)), lty=3, add=T)
> 
> I get a much flatter and broader curve (which looks like it probably
> has the same area as the first curve, though I haven't tested).
> 
> However, if I do
> 
>  > z <- sd(x)
>  > curve(dnorm(x, mean=mean(x), sd=z), lty=1, add=T)
> 
> I get the curve you'd expect; it draws right over the first curve
> (curve(dnorm(x),...), above).

I don't think that is guaranteed, actually.

Notice that curve plots the *expression* as a function of the argument
"x". So it takes a bunch of x values, evenly spread across the
abscissa collects them into a vector and plugs that in as "x" in

curve(dnorm(x, mean=mean(x), sd=sd(x)), lty=3, add=T)

I.e. the x that gets plugged into mean(x) and sd(x) has nothing to do
with your original data (except that they both fit in the same xlim)! 

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
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] correcting for autocorrelation in models with panel data?

2005-02-10 Thread Prof Brian Ripley
Are the years equally spaced and in time order?
If so, it probably doesn't matter, and if not you may want corCAR1 not 
corAR1.

On Thu, 10 Feb 2005, David Hugh-Jones wrote:
Assuming I have years in YEAR and state ids in ID, I guess the
correlation ought to be
corAR1(form = ~ YEAR | ID)
?
Thanks a lot,
David

On Thu, 10 Feb 2005 12:36:32 -0500, Doran, Harold <[EMAIL PROTECTED]> wrote:
In the nlme package you can find the gls() function to account for
autocorrelation over time using corAR1. Syntax might look something like
this:
fm1 <- gls(response ~ IV, long, correlation=corAR1(form=~1|ID),
method='ML')
You can also use weights() for heteroscedasticity.
-Harold
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Hugh-Jones
Sent: Thursday, February 10, 2005 12:15 PM
To: r-help@stat.math.ethz.ch
Subject: [R] correcting for autocorrelation in models with panel data?
Hi
I have some panel data for the 50 US states over about 25 years, and I
would like to test a simple model via OLS, using this data. I know how
to run OLS in R, and I think I can see how to  create Panel Corrected
Standard Errors using
http://jackman.stanford.edu/classes/350C/pcse.r
What I can't figure out is how to correct for autocorrelation over time.
I have found a lot of R stuff on time series models but they all seem
focused on predicting a single variable from its previous values.
Can anyone explain to me how to detect and get round autocorrelation?
Is there a package for panel data that I have missed?
I appreciate that this is probably just as much about my ignorance of
econometrics as about R itself!
Cheers
David
--
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] sample

2005-02-10 Thread T. Murlidharan Nair
Just to explain my previous mail, here is the output I get.  

> dim(tissue.exp)
[1] 1532   20
> pick<-sample(tissue.exp,5,replace=TRUE)
> dim(pick)
[1] 15325
> tissue.exp.t<-t(tissue.exp)
> dim(tissue.exp.t)
[1]   20 1532
> pick<-sample(tissue.exp.t,5,replace=TRUE)
> dim(pick)
NULL

Thanks ../Murli
__
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] Problem with "R CMD Rd2dvi": Rd.sty not found

2005-02-10 Thread Gabor Grothendieck

Prof Brian Ripley  stats.ox.ac.uk> writes:

: 
: This is a problem with a recent-ish change to MikTeX to make it use 
: non-standard paths: see the notes on Duncan Murdoch's site at
: 
:http://www.murdoch-sutherland.com/Rtools/miktex.html
: 
: Fptex is a standard distribution e.g. from TexLive.

I initially started with MikTeX but then had the texinput problem
while trying to generate vignettes for a package so
tried fptex but found that the latter was huge (the .bat file
downloads about half a gig of files) and Miktex seems more polished.  
The most important shortcoming is that fptex lacks texi2dvi and while
Miktex lacks this too it has a substitute, texify.exe, which can
be used instead whereas fptex does not.  The Miktex developer told
me that the underlying tex engine he is using is missing the texinput
part and as soon as that is corrected he will incorporate it
into miktex.  This was quite a while ago and the situation 
may have changed somewhat.  I think some people have had good expeiences
with fptex but they probably were not trying to develop packages with
vignettes and certain other tasks that involve texinput.  I think had 
I known all this I just would have stuck to miktex and done the extra
configuration and saved myself having to download the huge fptex 
distribution.

__
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] rats in survival package

2005-02-10 Thread Gabor Grothendieck
Gonzalez Ruiz, Juan Ramon  ico.scs.es> writes:

: 
: Dear R-listers,
: 
: Does anybody know what is the correct source of "rats" dataset in survival 
package?
: 
: The help gives the following information:
: 
: Rat data from survival5
: Description:
:  48 rats were injected with a carcinogen, and then randomized to
:  either drug or placebo.  The number of tumors ranges from 0 to 13;
:  all rats were  censored at 6 months after randomization.
: Usage:
:  data(rats)
: Format:
:rat:  id
:rx:   treatment,(1=drug, 0=control)
:observation:  within rat
:start:entry time
:stop: exit time
:status:   event status
: Source:
:  Gail, Sautner and Brown, Biometrics 36, 255-66, 1980
: 
: but "rats" data.frame contains the variables:
: 
: names(rats)
: [1] "litter" "rx" "time"   "status"
: 
: It seems to be 150 rats grouped in 50 litters, and 1 mouse is treated at 
each one. So this dataset does not agree
: with the description above mentioned. 
: 
: I am very interesting in knowing the reference of this data.
: 
: PS/ BTW, the correct source of  rats injected with a carcinogen is Gail, 
Santner and Brown,...
: 

Not sure what your question is but the rats data set is also in
the mimR package and the ?rats help there may be of use.

library(mimR)
data(rats)
?rats

__
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] Saving graphs in formats other than PDF?

2005-02-10 Thread Jim and Chana Milks
I am running R 2.01 on Mac OS 10.3.7.  Whenever I save graphs, they are
saved as PDF files.  Are there any other file formats to which I could save
my graphs.  I would like to directly export my graphs to MS Word, if
possible.

Thank you in advance.

Sincerely,
Jim Milks
Graduate Student
Environmental Sciences Ph.D. Program
Wright State University
3640 Colonel Glenn Hwy
Dayton, OH 45435

__
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] time series questions?

2005-02-10 Thread Spencer Graves
 Two time series questions: 

FITTING TRANSFER FUNCTIONS WITH LAGS:  Consider the following toy example: 

> dates <- paste(11:21, "/01/2005", sep="")
> Dates <- as.Date(dates, "%d/%m/%Y")
> set.seed(1)
> DF <- data.frame(date=Dates, y=rnorm(11), x=rnorm(11, 3))
> arima(DF$y, c(1,0,0), xreg=lag(DF$x, 1))
 ar1  intercept  lag(DF$x, 1)
 -0.3876-1.13280.4280
s.e.   0.3556 0.64170.1945
sigma^2 estimated as 0.3807:  log likelihood = -10.38,  aic = 28.76
> arima(DF$y, c(1,0,0), xreg=lag(DF$x, 2))
 ar1  intercept  lag(DF$x, 2)
 -0.3876-1.13280.4280
s.e.   0.3556 0.64170.1945
sigma^2 estimated as 0.3807:  log likelihood = -10.38,  aic = 28.76
I NAIVELY THOUGHT THAT "lag" WOULD DO SOMETHING HERE.  Evidently, it 
didn't. 
The following seems to work: 

> arima(DF$y, c(1,0,0), xreg=c(DF$x[-1], NA))
 ar1  intercept  c(DF$x[-1], NA)
 -0.3943-0.2155   0.1185
s.e.   0.3454 0.8024   0.2464
sigma^2 estimated as 0.4889:  log likelihood = -10.7,  aic = 29.39
> arima(DF$y, c(1,0,0), xreg=c(DF$x[-(1:2)], NA, NA))
 ar1  intercept  c(DF$x[-(1:2)], NA, NA)
 -0.2385-0.6430   0.2472
s.e.   0.3073 0.8592   0.2485
sigma^2 estimated as 0.491:  log likelihood = -9.6,  aic = 27.2
 Is there a better way? 

ASSOCIATING A CALENDAR DATE WITH A 'ts' OBJECT
 In the previous example, I'd like to convert x and y into "ts" 
objects, retaining "Dates".  Is there a way to do this?  The following 
did not work: 

> ts(DF$y, start=Dates[1])
Error in Math.difftime((end - start) * frequency + 1.01) :
   floor not defined for difftime objects
 Thanks,
 spencer graves
__
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] table in R

2005-02-10 Thread Cuichang Zhao
Hello, 
I want to build some tables in my project using R, does R have some tables form 
that I can use? if i use the internal R table, how can initial a table before I 
use it?
 
I want to my tables to have some columns, for example:
(trial, x, y, goal) I want to put these columns into my tables, for i want to 
put data into each entry one by one. I have no idea about how big the table 
would be, so will it possible to use R's internal table?
 
Also, can someone please recommand me a good book or a good website about R.
 
 
Thank you so much.
 
C-Ming
 
Feb 10, 2005


-


[[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] time series questions (corrected)?

2005-02-10 Thread Spencer Graves
## The following corrects what I believe to have been an error in my 
previous post:

 Two time series questions:

I.  FITTING TRANSFER FUNCTIONS WITH LAGS:  Consider the following toy 
example:

dates <- paste(11:21, "/01/2005", sep="")
Dates <- as.Date(dates, "%d/%m/%Y")
set.seed(1)
DF <- data.frame(date=Dates, y=rnorm(11), x=rnorm(11, 3))
arima(DF$y, c(1,0,0), xreg=lag(DF$x, 1))
 ar1  intercept  lag(DF$x, 1)
 -0.3876-1.13280.4280
s.e.   0.3556 0.64170.1945
sigma^2 estimated as 0.3807:  log likelihood = -10.38,  aic = 28.76
arima(DF$y, c(1,0,0), xreg=lag(DF$x, 2))
 ar1  intercept  lag(DF$x, 2)
 -0.3876-1.13280.4280
s.e.   0.3556 0.64170.1945
sigma^2 estimated as 0.3807:  log likelihood = -10.38,  aic = 28.76
I NAIVELY THOUGHT THAT "lag" WOULD DO SOMETHING HERE.  Evidently, it
didn't.
The following seems to work:
> arima(DF$y, c(1,0,0), xreg=c(NA, DF$x[-11]))
  ar1  intercept  c(NA, DF$x[-11])
  -0.3994 0.3837   -0.0215
s.e.   0.3107 0.73660.2259
sigma^2 estimated as 0.5356:  log likelihood = -11.15,  aic = 30.31
> arima(DF$y, c(1,0,0), xreg=c(NA, NA, DF$x[-(10:11)]))
  ar1  intercept  c(NA, NA, DF$x[-(10:11)])
  -0.5703 0.9180-0.1794
s.e.   0.3374 0.6685 0.2115
sigma^2 estimated as 0.4871:  log likelihood = -9.73,  aic = 27.46
 Is there a better way?
II.  ASSOCIATING A CALENDAR DATE WITH A 'ts' OBJECT
 In the previous example, I'd like to convert x and y into "ts"
objects, retaining "Dates".  Is there a way to do this?  The following
did not work:
ts(DF$y, start=Dates[1])
Error in Math.difftime((end - start) * frequency + 1.01) :
   floor not defined for difftime objects
 Thanks,
 spencer graves
__
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] How to solve error : "cannot allocate vector of size 1208235 Kb"

2005-02-10 Thread Kum-Hoe Hwang
Howdy R gurus !

I am newbie to R
I use R 2.0.1 in Windows XP. When I run R
I got the follwoing memory error.
My physical memory size is 3 Gb.
My R got the memory problem when it reached to 
about 2 Gb.

Thanks in advance,


> library(spdep)
> sfr.lagsarlm <- lagsarlm(sfr.data$Bldgsqft ~ sfr.data$Ncounty + sfr.data$Nugb 
> + sfr.data$Ngroup, data=sfr.data, listw=sfr.listw, method="eigen") 
Error: cannot allocate vector of size 1208235 Kb
> memory.size(max=FALSE)
[1] 17862584
> memory.limit(size=NA)
[1] 3145728000
> 


-- 
Kum-Hoe Hwang, Ph.D.

Kyonggi Research Institute, Korea (ROK)
(Urban Planning and GIS)
Phone : 82-31-250-3283
Email : [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] importing minitab datasets

2005-02-10 Thread Peter Jaffe
I'm having trouble using the read.mtp function in the foreign package 
to import datasets from minitab (.mtw) format. Specifically, each file 
I try to import fails to load any data beyond a header row stating the 
version of Minitab that saved the dataset. I get this error:

incomplete final line found by readtableHeader on 'income.mtw'
The dataset appears to be complete (ie, using the scan() function I can 
view the contents, and the file does not end after the header, but the 
formatting characters make it impossible to guess what the raw data 
elements are). I got the same result trying to read minitab files from 
two different sources. Any suggestions would be appreciated.

Thanks,
Peter
__
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 to solve error : "cannot allocate vector of size 1208235 Kb"

2005-02-10 Thread Prof Brian Ripley
You need to read the rw-FAQ (as the posting guide asks) and make the R 
executable capable of using more than 2Gb (assuming that you have already 
enabled your OS).

On Fri, 11 Feb 2005, Kum-Hoe Hwang wrote:
Howdy R gurus !
I am newbie to R
I use R 2.0.1 in Windows XP. When I run R
I got the follwoing memory error.
My physical memory size is 3 Gb.
My R got the memory problem when it reached to
about 2 Gb.
Thanks in advance,

library(spdep)
sfr.lagsarlm <- lagsarlm(sfr.data$Bldgsqft ~ sfr.data$Ncounty + sfr.data$Nugb + 
sfr.data$Ngroup, data=sfr.data, listw=sfr.listw, method="eigen")
Error: cannot allocate vector of size 1208235 Kb
memory.size(max=FALSE)
[1] 17862584
That tells you the state after that command failed: the max=TRUE figure is
more interesting at that point.
memory.limit(size=NA)
[1] 3145728000


--
Kum-Hoe Hwang, Ph.D.
Kyonggi Research Institute, Korea (ROK)
(Urban Planning and GIS)
Phone : 82-31-250-3283
Email : [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
--
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] table in R

2005-02-10 Thread Petr Pikal
Hi

On 10 Feb 2005 at 18:10, Cuichang Zhao wrote:

> Hello, 
> I want to build some tables in my project using R, does R have some
> tables form that I can use? if i use the internal R table, how can
> initial a table before I use it?

How do you want to use a table???

> 
> I want to my tables to have some columns, for example:
> (trial, x, y, goal) I want to put these columns into my tables, for i
> want to put data into each entry one by one. I have no idea about how
> big the table would be, so will it possible to use R's internal table?

Do you mean build in data editor, which can be used for editing 
existing objects???

> 
> Also, can someone please recommand me a good book or a good website
> about R.

If you installed R you can find useful documentation in .../doc 
directory. I can also recommend Introductory statistics with R or 
Modern applied statistics with S.

And of course all stuff you can find on CRAN.

BTW, try to read the last lines of the email about ***posting 
guide*** and of course the posting guide itself.

Cheers
Petr



> 
> 
> Thank you so much.
> 
> C-Ming
> 
> Feb 10, 2005
> 
> 
> -
> 
> 
>  [[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] Subsetting using dimnames on S4 array-based class

2005-02-10 Thread Iago Mosqueira
Hello,

I am encountering some problems when overloading the "[" operator for a
new S4 class based on array. This is an example class definition:

setClass("foo",
representation("array"),
prototype(array(NA, dim=c(3,3)), 
dimnames=list(age=1:3, year=10:12))
)

And this the corresponding setMethod with print estatements to see what
is being passed:

setMethod("[", signature(x="foo"),
function(x, i="missing", j="missing", ..., drop="missing") {
print(paste("i:", i))
print(paste("j:", j))
 }
)


So I first create a new object and load it with some data:

> x <- new("foo")
> x[,] <- 1:9

And then apply subsetting without using the dimension names and see what
are the values of i and j inside the function:

> x[1:2,'10']
[1] "i: 1" "i: 2"
[1] "j: 10"


Both i and j hold exactly what was expected here. But if I use the
dimension names, the subsetting indices does not seem to be passed as I
expected:

> x[age=1:3, year=1:3]
[1] "i: missing"
[1] "j: missing"
> x[, year='10']
[1] "i: missing"
[1] "j: missing"

Subsetting with dimnames appears to work without trouble on an array,
which "foo" extends:

s<-array(1:9,dim=c(3,3),dimnames=list(age=1:3,year=1:3))
> s[1,2:3]
2 3 
4 7 
> s[age=1,year=2:3]
2 3 
4 7

Although dimnames seem to be in fact simply ignored:

> s[a=1,b=3]
[1] 7


System:
Linux Debian 3.0
R 2.0.0

Do I need to define my class differently for subsetting using dimnames
to work? Even if they are not really being checked, I would like to be
able to use subsetting in this way as it makes code more readable when
using arrays with many dimensions.

Many thanks,


Iago Mosqueira

__
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] importing minitab datasets

2005-02-10 Thread Petr Pikal
Hi Peter

On 11 Feb 2005 at 1:06, Peter Jaffe wrote:

> I'm having trouble using the read.mtp function in the foreign package
> to import datasets from minitab (.mtw) format. Specifically, each file
> I try to import fails to load any data beyond a header row stating the
> version of Minitab that saved the dataset. I get this error:
> 
> incomplete final line found by readtableHeader on 'income.mtw'
> 
> The dataset appears to be complete (ie, using the scan() function I
> can view the contents, and the file does not end after the header, but
> the formatting characters make it impossible to guess what the raw
> data elements are). I got the same result trying to read minitab files
> from two different sources. Any suggestions would be appreciated.
>

I did not do the transfer yet but quick look into help page:


file: 

character variable with the name of the file to read. The file must 
be in Minitab Portable Worksheet format. 
   ^^

so first you need to save a minitab file in correct format. If you 
did it it would work as expected -> it will give you a list.


Cheers
Petr


 
> Thanks,
> 
> Peter
> 
> __
> 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] Saving graphs in formats other than PDF?

2005-02-10 Thread Uwe Ligges
Jim and Chana Milks wrote:
I am running R 2.01 on Mac OS 10.3.7.  Whenever I save graphs, they are
saved as PDF files.  Are there any other file formats to which I could save
my graphs.  I would like to directly export my graphs to MS Word, if
possible.
Thank you in advance.
Sincerely,
Jim Milks
Graduate Student
Environmental Sciences Ph.D. Program
Wright State University
3640 Colonel Glenn Hwy
Dayton, OH 45435
__
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

See ?Devices.
Uwe Ligges
__
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