[R] Outputing dataframe or vector from within a user defined function

2005-12-20 Thread Andrew Cox
Hi,
I have written a user defined function that carries
out a monte carlo simulation and outputs various
stats. I would like to access and store the simulation
data (a two column local variable) from outside the
function I have written. How can I output the data
from the function as new variable(not simply print
it), accessible outside
the function? 

I am probably going to find that this is really
simple, yet I have not been able to find the answer in
(usual places, manuals, 2 x Books and mailing lists)

Many Thanks 
Andy Cox

__
R-help@stat.math.ethz.ch 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] glmmADMB: Generalized Linear Mixed Models using AD Model Builder

2005-12-20 Thread Berton Gunter
May I interject a comment?

 
 When data is generated from a specified model with reasonable 
 parameter 
 values, it should be possible to fit such a model successful, 
 or is this 
 me being stupid?

Let me take a turn at being stupid. Why should this be true? That is, why
should it be possible to easily fit a model that is generated ( i.e. using a
pseudo-random number generator) from a perfectly well-defined model? For
example, I can easily generate simple linear models contaminated with
outliers that are quite difficult to fit (e.g. via resistant fitting
methods). In nonlinear fitting, it is quite easy to generate data from
oevrparameterized models that are quite difficult to fit or whose fit is
very sensitive to initial conditions. Remember: the design (for the
covariates) at which you fit the data must support the parameterization.

The most dramatic examples are probably of simple nonlinear model systems
with no noise which produce chaotic results when parameters are in certain
ranges. These would be totally impossible to recover from the data.

So I repeat: just because you can generate data from a simple model, why
should it be easy to fit the data and recover the model? 

Cheers,

Bert Gunter
Genentech

__
R-help@stat.math.ethz.ch 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] Ranking factors given a weight

2005-12-20 Thread Albert Vilella
Hi all,

I'm trying to rank a couple of factors by a variable and a weight of
the variable in each occurrence (some samples are bigger than others).

input = data.frame(
  alfa = rnorm(5000),
  weight = rnorm(5000,-5,10),
  tag1 = sample(c(a,b,c,d),5000,replace=TRUE),
  tag2 = sample(c(i,j,k),5000,replace=TRUE)
  )

alfa are the observations, each of which has a weight, and tag1 and
tag2 are the factors.

The idea would be to have a ranking of tag1, tag2, and a combination
of both.

There must be a way to do that with ave() or sort() but I haven't
found how.

Thanks in advance,

Albert.

__
R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Rainer M Krug
Hi

I have problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) 
on SuSE 10. It installs fine, all dependances are OK (at least Yast does 
not complain) but when I try to run R, it gives the following error message:

symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: 
_gfortran_filename

and R quits.

blas version: 3.0-926

Any help appreciated,

Rainer

-- 
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Department of Conservation Ecology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:+27 - (0)83 9479 042

email:[EMAIL PROTECTED]
   [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] Outputing dataframe or vector from within a user defined function

2005-12-20 Thread Uwe Ligges
Andrew Cox wrote:

 Hi,
 I have written a user defined function that carries
 out a monte carlo simulation and outputs various
 stats. I would like to access and store the simulation
 data (a two column local variable) from outside the
 function I have written. How can I output the data
 from the function as new variable(not simply print
 it), accessible outside
 the function? 
 
 I am probably going to find that this is really
 simple, yet I have not been able to find the answer in
 (usual places, manuals, 2 x Books and mailing lists)

It's certainly in all books about R that I know as well as in the 
manuals. And you are using it all the time for other functions: assignments.

Simply speaking, the last value of a function is returned. You can also 
explicitly call return(). You have to assign the value to a new variable 
when you call the function. Example:

foo - function(){
   x - rnorm(10)
   y - x*5
   return(list(x=x, y=y))
}

result - foo()
result

Uwe Ligges



 Many Thanks 
 Andy Cox
 
 __
 R-help@stat.math.ethz.ch 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] Outputing dataframe or vector from within a user defined function

2005-12-20 Thread Petr Pikal
Hi
having function e.g.

mean.int-function(x,p=.95)
{x.na-na.omit(x)
mu-mean(x.na)
odch-sd(x.na)
l-length(x.na)
alfa-(1-p)/2
mu.d-mu-qt(1-alfa,l-1)*odch/sqrt(l)
mu.h-mu+qt(1-alfa,l-1)*odch/sqrt(l)
return(data.frame(mu.d,mu,mu.h))
}

result - mean.int(cbind(rnorm(10),rnorm(10)*2,rnorm(10)+2))

results in data frame result.

But I susspect that you use some cycle in your function. In that case 
you need index variable within for loop.

for (i in  {

var[i] - 

}

return(var)

HTH
Petr



On 20 Dec 2005 at 7:39, Andrew Cox wrote:

Date sent:  Tue, 20 Dec 2005 07:39:27 + (GMT)
From:   Andrew Cox [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] Outputing dataframe or vector from within a user 
defined
function

 Hi,
 I have written a user defined function that carries
 out a monte carlo simulation and outputs various
 stats. I would like to access and store the simulation
 data (a two column local variable) from outside the
 function I have written. How can I output the data
 from the function as new variable, accessible outside
 the function? 
 
 I am probably going to find that this is really
 simple, yet I have not been able to find the answer in
 (usual places, manuals, 2 x Books and mailing lists)
 
 Many Thanks 
 Andy Cox
 
 __
 R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Peter Dalgaard
Rainer M Krug [EMAIL PROTECTED] writes:

 Hi
 
 I have problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) 
 on SuSE 10. It installs fine, all dependances are OK (at least Yast does 
 not complain) but when I try to run R, it gives the following error message:
 
 symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: 
 _gfortran_filename
 
 and R quits.
 
 blas version: 3.0-926
 
 Any help appreciated,
 
 Rainer

I suspect you're missing

turmalin:~/rpm -qf `which gfortran`
gcc-fortran-4.0.2_20050901-3

 
 -- 
 --
 Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)
 
 Department of Conservation Ecology
 University of Stellenbosch
 Matieland 7602
 South Africa
 
 Tel:+27 - (0)72 808 2975 (w)
 Fax:+27 - (0)21 808 3304
 Cell:+27 - (0)83 9479 042
 
 email:[EMAIL PROTECTED]
[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
 

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Rainer M Krug
Nope - If I enter

  rpm -qf `which gfortran`

I get

gcc-fortran-4.0.2_20050901-3

Rainer


Peter Dalgaard wrote:
 Rainer M Krug [EMAIL PROTECTED] writes:
 
 Hi

 I have problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) 
 on SuSE 10. It installs fine, all dependances are OK (at least Yast does 
 not complain) but when I try to run R, it gives the following error message:

 symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: 
 _gfortran_filename

 and R quits.

 blas version: 3.0-926

 Any help appreciated,

 Rainer
 
 I suspect you're missing
 
 turmalin:~/rpm -qf `which gfortran`
 gcc-fortran-4.0.2_20050901-3
 
  
 -- 
 --
 Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

 Department of Conservation Ecology
 University of Stellenbosch
 Matieland 7602
 South Africa

 Tel:+27 - (0)72 808 2975 (w)
 Fax:+27 - (0)21 808 3304
 Cell:+27 - (0)83 9479 042

 email:[EMAIL PROTECTED]
[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

 

-- 
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Department of Conservation Ecology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:+27 - (0)83 9479 042

email:[EMAIL PROTECTED]
   [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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Detlef Steuer
On Tue, 20 Dec 2005 11:12:40 +0200
Rainer M Krug [EMAIL PROTECTED] wrote:

 Nope - If I enter
 
   rpm -qf `which gfortran`
 
 I get
 
 gcc-fortran-4.0.2_20050901-3
 
 Rainer
 
 
 Peter Dalgaard wrote:
  Rainer M Krug [EMAIL PROTECTED] writes:
  
  Hi
 
  I have problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) 
  on SuSE 10. It installs fine, all dependances are OK (at least Yast does 

I do not understand what you are trying to do:
rpm -i R-base-2.2.0-1.i586.rpm
then you install R-2.2.0 not R-2.1.1

So what do you mean with problems installing R-2.1.1 ?
Did you have old versions of R/blas/etc installed?

Anyway: Personally I never encountered such an error.

Detlef





  not complain) but when I try to run R, it gives the following error 
  message:
 
  symbol lookup error: /usr/lib/libblas.so.3: undefined symbol: 
  _gfortran_filename
 
  and R quits.
 
  blas version: 3.0-926
 
  Any help appreciated,
 
  Rainer
  
  I suspect you're missing
  
  turmalin:~/rpm -qf `which gfortran`
  gcc-fortran-4.0.2_20050901-3
  
   
  -- 
  --
  Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)
 
  Department of Conservation Ecology
  University of Stellenbosch
  Matieland 7602
  South Africa
 
  Tel:+27 - (0)72 808 2975 (w)
  Fax:+27 - (0)21 808 3304
  Cell:+27 - (0)83 9479 042
 
  email:[EMAIL PROTECTED]
 [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
 
  
 
 -- 
 --
 Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)
 
 Department of Conservation Ecology
 University of Stellenbosch
 Matieland 7602
 South Africa
 
 Tel:+27 - (0)72 808 2975 (w)
 Fax:+27 - (0)21 808 3304
 Cell:+27 - (0)83 9479 042
 
 email:[EMAIL PROTECTED]
[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-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Peter Dalgaard
Rainer M Krug [EMAIL PROTECTED] writes:

 Nope - If I enter
 
   rpm -qf `which gfortran`
 
 I get
 
 gcc-fortran-4.0.2_20050901-3
 
 Rainer


Hmm, where did the blas come in? I don't seem to have it on the SuSE
10 machine that I have access to (but it is running R-base-2.2.0-0).

 
 
 Peter Dalgaard wrote:
  Rainer M Krug [EMAIL PROTECTED] writes:
 
  Hi
 
  I have problems installing R 2.1.1. from rpm
  (R-base-2.2.0-1.i586.rpm) on SuSE 10. It installs fine, all
  dependances are OK (at least Yast does not complain) but when I try
  to run R, it gives the following error message:
 
  symbol lookup error: /usr/lib/libblas.so.3: undefined symbol:
  _gfortran_filename
 
  and R quits.
 
  blas version: 3.0-926
 
  Any help appreciated,
 
  Rainer
  I suspect you're missing
  turmalin:~/rpm -qf `which gfortran`
  gcc-fortran-4.0.2_20050901-3

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch 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 data

2005-12-20 Thread Marc Bernard
Dear All, I wonder how to compute the age from the date of birth and the date 
of examination. Suppose that have the following data:
   
  df - as.data.frame(rbind(c(1,10/08/1950,15/03/1998), 
c(1,10/08/1950,20/07/1998), c(1,10/08/1950,23/10/1998)))
   
  names(df) - c(ID, date_birth, date_exam)
   
  where:
  date_birth: is the date of birth
  date_exam: date of examination
   
  I used the following program to compute the value of the age  :
   
  difftime(strptime(as.character(df$date_exam), '%d/%m/%Y'), 
strptime(as.character(df$date_birth), '%d/%m/%Y'))/365.25
   
  which gives me as an output:
  
 Time differences of 47.59491, 47.94251, 48.20260 days
   
  theses values are actually the 3 ages (but 

  My questions are:
   
  1- Why in the output it says days instead of years)
   
  2- How can I obtain the output as a numeric vector, without the statement 
Time difference of . This is in order to use it in my calculations.
   
  3- Is there a way quicker and less redondant  to compute the age form the 
date_birth and date_exam?
   
  Thanks a lot,
   
  Bernard,
   


-

[[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] object length

2005-12-20 Thread linda.s
Why I got warning from the following code?
 assign(x, c(10, 5, 4, 2, 2))
 y - c(x, 0, x)
 y
 [1] 10  5  4  2  2  0 10  5  4  2  2
 v - 2*x + y + 1
Warning message:
longer object length
is not a multiple of shorter object length in: 2 * x + y
 v
 [1] 31 16 13  7  7 21 21 14  9  7 23

__
R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Detlef Steuer
On 20 Dec 2005 11:11:18 +0100
Peter Dalgaard [EMAIL PROTECTED] wrote:

 Rainer M Krug [EMAIL PROTECTED] writes:
 
  Nope - If I enter
  
rpm -qf `which gfortran`
  
  I get
  
  gcc-fortran-4.0.2_20050901-3
  
  Rainer
 
 
 Hmm, where did the blas come in? I don't seem to have it on the SuSE
 10 machine that I have access to (but it is running R-base-2.2.0-0).

I compiled it in in 2.2.0-1 . libblas is provided in the standard 
online-repository for opensuse, 
so it doesn´t hurt. (at least not more than gfortran i.e.)

Detlef

 
  
  
  Peter Dalgaard wrote:
   Rainer M Krug [EMAIL PROTECTED] writes:
  
   Hi
  
   I have problems installing R 2.1.1. from rpm
   (R-base-2.2.0-1.i586.rpm) on SuSE 10. It installs fine, all
   dependances are OK (at least Yast does not complain) but when I try
   to run R, it gives the following error message:
  
   symbol lookup error: /usr/lib/libblas.so.3: undefined symbol:
   _gfortran_filename
  
   and R quits.
  
   blas version: 3.0-926
  
   Any help appreciated,
  
   Rainer
   I suspect you're missing
   turmalin:~/rpm -qf `which gfortran`
   gcc-fortran-4.0.2_20050901-3
 
 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907
 
 __
 R-help@stat.math.ethz.ch 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] run line or selection

2005-12-20 Thread linda.s
I use a MAC machine to run R. I found there was no such a tool like
run line or selection in R 2.2.0 under Windows.
Does the tool hide somewhere?

__
R-help@stat.math.ethz.ch 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] Overlaying lattice plots

2005-12-20 Thread ernesto
Hillary, Richard M wrote:

 Morning chaps, I have a little question for your capable minds... Say
 I have an observed and predicted set of quants (in my case, length
 frequencies by year and age/length), is there a way to use lattice
 plots to plot the observed and predicted data together, panel by panel?
 Obrigado/gracias (thankyou in Galego is?...)
 Rich

Hi Richard,

If you want to plot both datasets on the same plot just make use of the
xyplot for FLQuants, something like

flqs - FLQuants(list(pred=pred.quant, res=res.quant))
xyplot(data~age, data=flqs)

now tune it the way you want and change the formula to fit your needs.

Regards

EJ

ps: I'm cc'ing this to the mailing lists, I find it usefull for others.

__
R-help@stat.math.ethz.ch 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] Overlaying lattice plots

2005-12-20 Thread Hillary, Richard M
Excellent, thanks man!
Rich 

-Original Message-
From: ernesto [mailto:[EMAIL PROTECTED] 
Sent: 20 December 2005 10:32
To: Hillary, Richard M; Iago Mosqueira; Mailing List R; R-devel
Subject: Re: Overlaying lattice plots

Hillary, Richard M wrote:

 Morning chaps, I have a little question for your capable minds... Say 
 I have an observed and predicted set of quants (in my case, length 
 frequencies by year and age/length), is there a way to use lattice 
 plots to plot the observed and predicted data together, panel by
panel?
 Obrigado/gracias (thankyou in Galego is?...) Rich

Hi Richard,

If you want to plot both datasets on the same plot just make use of the
xyplot for FLQuants, something like

flqs - FLQuants(list(pred=pred.quant, res=res.quant)) xyplot(data~age,
data=flqs)

now tune it the way you want and change the formula to fit your needs.

Regards

EJ

ps: I'm cc'ing this to the mailing lists, I find it usefull for others.

__
R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Rainer M Krug
I used the SuSE 10 CDs as installation sources and added afterwards 
OpenSuse sources and extra CDs for Suse 10 and OpenSuse.

By the way, I decided to compile it from source and it worked without 
problems - no errors.

I guess that one of the versions used in the compilation for the rpms is 
not compatible with a newer version.

Thanks for your help,

Rainer



Peter Dalgaard wrote:
 Rainer M Krug [EMAIL PROTECTED] writes:
 
 Nope - If I enter

   rpm -qf `which gfortran`

 I get

 gcc-fortran-4.0.2_20050901-3

 Rainer
 
 
 Hmm, where did the blas come in? I don't seem to have it on the SuSE
 10 machine that I have access to (but it is running R-base-2.2.0-0).
 
  
 Peter Dalgaard wrote:
 Rainer M Krug [EMAIL PROTECTED] writes:

 Hi

 I have problems installing R 2.1.1. from rpm
 (R-base-2.2.0-1.i586.rpm) on SuSE 10. It installs fine, all
 dependances are OK (at least Yast does not complain) but when I try
 to run R, it gives the following error message:

 symbol lookup error: /usr/lib/libblas.so.3: undefined symbol:
 _gfortran_filename

 and R quits.

 blas version: 3.0-926

 Any help appreciated,

 Rainer
 I suspect you're missing
 turmalin:~/rpm -qf `which gfortran`
 gcc-fortran-4.0.2_20050901-3
 

-- 
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Department of Conservation Ecology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:+27 - (0)83 9479 042

email:[EMAIL PROTECTED]
   [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] [Rd] Overlaying lattice plots - SORRY, WRONG MAILING LIST ADDRESS

2005-12-20 Thread ernesto
ernesto wrote:

Hillary, Richard M wrote:

  

Morning chaps, I have a little question for your capable minds... Say
I have an observed and predicted set of quants (in my case, length
frequencies by year and age/length), is there a way to use lattice
plots to plot the observed and predicted data together, panel by panel?
Obrigado/gracias (thankyou in Galego is?...)
Rich



Hi Richard,

If you want to plot both datasets on the same plot just make use of the
xyplot for FLQuants, something like

flqs - FLQuants(list(pred=pred.quant, res=res.quant))
xyplot(data~age, data=flqs)

now tune it the way you want and change the formula to fit your needs.

Regards

EJ

ps: I'm cc'ing this to the mailing lists, I find it usefull for others.
  


Hi,

Sorry for this message, wrong address. I wanted to send it to
FLR-mailing list.

Regards

EJ

__
R-help@stat.math.ethz.ch 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] Time data

2005-12-20 Thread Petr Pikal
Hi


On 20 Dec 2005 at 11:12, Marc Bernard wrote:

Date sent:  Tue, 20 Dec 2005 11:12:28 +0100 (CET)
From:   Marc Bernard [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] Time data

 Dear All, I wonder how to compute the age from the date of birth and
 the date of examination. Suppose that have the following data:
 
   df - as.data.frame(rbind(c(1,10/08/1950,15/03/1998),
   c(1,10/08/1950,20/07/1998), c(1,10/08/1950,23/10/1998)))
 
   names(df) - c(ID, date_birth, date_exam)
 
   where:
   date_birth: is the date of birth
   date_exam: date of examination
 
   I used the following program to compute the value of the age  :
 
   difftime(strptime(as.character(df$date_exam), '%d/%m/%Y'),
   strptime(as.character(df$date_birth), '%d/%m/%Y'))/365.25
 
   which gives me as an output:
 
  Time differences of 47.59491, 47.94251, 48.20260 days
 
   theses values are actually the 3 ages (but 
 
   My questions are:
 
   1- Why in the output it says days instead of years)

this is in attributes of an output and is not changed by calculations

 
   2- How can I obtain the output as a numeric vector, without the
   statement Time difference of . This is in order to use it in
   my calculations.

as.numeric(as.Date(df$date_exam)-as.Date(df$date_birth))/365

However you can use it in calculations without problem as I suppose 
that Time difference of results from print method of a difftime 
object.


 
   3- Is there a way quicker and less redondant  to compute the age
   form the date_birth and date_exam?

as.Date(df$date_exam)-as.Date(df$date_birth)

HTH
Petr


 
   Thanks a lot,
 
   Bernard,
 
 
 
 -
 
  [[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] Problems in batch mode

2005-12-20 Thread Tomas Goicoa

Dear R-users,

I am trying to run some simulations in batch mode.  In an older version 
of  the program, I used

rterm --vsize=100M  --nsize=5000K --restore --save input file output file,

however, in the new version R 2.2.0 , the  parameters vsize and nsize are 
ignored.

I can use the command memory.limit to increase memory, but I am not sure if 
this corresponds to vsize and nsize.

Does anyone know how can I set these quantities now?

__
R-help@stat.math.ethz.ch 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] object length

2005-12-20 Thread Uwe Ligges
linda.s wrote:
 Why I got warning from the following code?
 
assign(x, c(10, 5, 4, 2, 2))
y - c(x, 0, x)
y
 
  [1] 10  5  4  2  2  0 10  5  4  2  2
 
v - 2*x + y + 1

Read the Warning message and try to interpret it

If you still do not get the point:
   (length(x)*2+1) == length(y)

Uwe Ligges

 Warning message:
 longer object length
 is not a multiple of shorter object length in: 2 * x + y
 
v
 
  [1] 31 16 13  7  7 21 21 14  9  7 23
 
 __
 R-help@stat.math.ethz.ch 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] object length

2005-12-20 Thread Petr Pikal
Hi

On 20 Dec 2005 at 2:21, linda.s wrote:

Date sent:  Tue, 20 Dec 2005 02:21:34 -0800
From:   linda.s [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] object length

 Why I got warning from the following code?
  assign(x, c(10, 5, 4, 2, 2))
  y - c(x, 0, x)
  y
  [1] 10  5  4  2  2  0 10  5  4  2  2
  v - 2*x + y + 1
 Warning message:
 longer object length
 is not a multiple of shorter object length in: 2 * x + y
  v
  [1] 31 16 13  7  7 21 21 14  9  7 23

Because longer object length is not a multiple of shorter object 
length e.g.

x has length 5 and y has length 11 and they can be recycled during 
computation only fractionally. So the program computes the result but 
warns you about this. If you expected both vactors have same length 
there is time to look more closely to how they look like and how they 
were constructed.

HTH
Petr




 
 __
 R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm (R-base-2.2.0-1.i586.rpm) on SuSE 10

2005-12-20 Thread Detlef Steuer
On Tue, 20 Dec 2005 12:35:39 +0200
Rainer M Krug [EMAIL PROTECTED] wrote:

 I used the SuSE 10 CDs as installation sources and added afterwards 
 OpenSuse sources and extra CDs for Suse 10 and OpenSuse.

May be there is a difference between SuSE and OpenSuSE nowadays?!
I exclusively use OpenSuSE now and was under the impression those were
equivalent.

 
 By the way, I decided to compile it from source and it worked without 
 problems - no errors.

Nice to hear.

 
 I guess that one of the versions used in the compilation for the rpms is 
 not compatible with a newer version.



Happy R`ing
Detlef

 
 Thanks for your help,
 
 Rainer
 
 
 
 Peter Dalgaard wrote:
  Rainer M Krug [EMAIL PROTECTED] writes:
  
  Nope - If I enter
 
rpm -qf `which gfortran`
 
  I get
 
  gcc-fortran-4.0.2_20050901-3
 
  Rainer
  
  
  Hmm, where did the blas come in? I don't seem to have it on the SuSE
  10 machine that I have access to (but it is running R-base-2.2.0-0).
  
   
  Peter Dalgaard wrote:
  Rainer M Krug [EMAIL PROTECTED] writes:
 
  Hi
 
  I have problems installing R 2.1.1. from rpm
  (R-base-2.2.0-1.i586.rpm) on SuSE 10. It installs fine, all
  dependances are OK (at least Yast does not complain) but when I try
  to run R, it gives the following error message:
 
  symbol lookup error: /usr/lib/libblas.so.3: undefined symbol:
  _gfortran_filename
 
  and R quits.
 
  blas version: 3.0-926
 
  Any help appreciated,
 
  Rainer
  I suspect you're missing
  turmalin:~/rpm -qf `which gfortran`
  gcc-fortran-4.0.2_20050901-3
  
 
 -- 
 --
 Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)
 
 Department of Conservation Ecology
 University of Stellenbosch
 Matieland 7602
 South Africa
 
 Tel:+27 - (0)72 808 2975 (w)
 Fax:+27 - (0)21 808 3304
 Cell:+27 - (0)83 9479 042
 
 email:[EMAIL PROTECTED]
[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-help@stat.math.ethz.ch 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] Overlaying lattice plots

2005-12-20 Thread Hillary, Richard M
There seems to be a problem here, probably of my own making... 

flqs - FLQuants(list(observed=obs, fitted=fits))
xyplot(data~age,data=flqs)
Error in tmp[subset] : object is not subsettable
? 

-Original Message-
From: ernesto [mailto:[EMAIL PROTECTED] 
Sent: 20 December 2005 10:32
To: Hillary, Richard M; Iago Mosqueira; Mailing List R; R-devel
Subject: Re: Overlaying lattice plots

Hillary, Richard M wrote:

 Morning chaps, I have a little question for your capable minds... Say 
 I have an observed and predicted set of quants (in my case, length 
 frequencies by year and age/length), is there a way to use lattice 
 plots to plot the observed and predicted data together, panel by
panel?
 Obrigado/gracias (thankyou in Galego is?...) Rich

Hi Richard,

If you want to plot both datasets on the same plot just make use of the
xyplot for FLQuants, something like

flqs - FLQuants(list(pred=pred.quant, res=res.quant)) xyplot(data~age,
data=flqs)

now tune it the way you want and change the formula to fit your needs.

Regards

EJ

ps: I'm cc'ing this to the mailing lists, I find it usefull for others.

__
R-help@stat.math.ethz.ch 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] glmmADMB: Generalized Linear Mixed Models using AD Model Builder

2005-12-20 Thread Hans Julius Skaug
I agree that the model is not fitting the Lesaffre data well, but my point was
to show that glmmADMB is numerically stable. Numerical
stability is obviously a nice property, but becomes particularly important
when one wants to do parametric bootstrappin, which I think is needed
for these kinds of models to assess bias in parameter estimates.

glmmADMB produces the exact parameter values that maximizes the Laplace 
approximation
for this dataset. Another story is that the Laplace approximation
is inaccurate here, as can be shown by using other likelihood approximations. 


hans

Douglas Bates wrote:

Ah yes, that example.  It is also given as the 'toenail' data set in
the 'mlmus' package of data sets from the book Multilevel and
Longitudinal Modeling Using Stata by Sophia Rabe-Hesketh and Anders
Skrondal (Stata Press, 2005).

It is not surprising that it is difficult to fit such a model to these
data because the data do not look like they come from such a model. 
You did not include the estimates of the variance of the random
effects in your output.  It is very large and very poorly determined. 
If you check the distribution of the posterior modes of the random
effects (for linear mixed models these are called the BLUPs - Best
Linear Unbiased Predictors - and you could call them BLUPs here too
except for the fact that they are not linear and they are not unbiased
and there isn't a clear sense in which they are best) it is clearly
not a Gaussian distribution with mean zero.  I enclose a density plot.
 You can see that it is bimodal and the larger of the two peaks is for
a negative value.  These are the random effects for those subjects
that had no positive responses - 163 out of the 294 subjects.

 sum(with(lesaffre, tapply(y, subject, mean)) == 0)
[1] 163

There is no information to estimate the random effects for these
subjects other than make it as large and negative as possible.  It
is pointless to estimate the fixed effects for such a clearly
inappropriate model.
 lattice package.


__
R-help@stat.math.ethz.ch 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] object length

2005-12-20 Thread Jim Lemon
linda.s wrote:
 Why I got warning from the following code?
 
assign(x, c(10, 5, 4, 2, 2))
y - c(x, 0, x)
y
 
  [1] 10  5  4  2  2  0 10  5  4  2  2
 
v - 2*x + y + 1
 
 Warning message:
 longer object length
 is not a multiple of shorter object length in: 2 * x + y
 
v
 
  [1] 31 16 13  7  7 21 21 14  9  7 23
 
Because the y vector contains 11 elements and the x vector contains 5. 
The message is just to warn the user that the elements of the shorter 
vector will not be uniformly represented in the result.

Jim

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


[R] R 2.2.1 is released

2005-12-20 Thread Peter Dalgaard
I've rolled up R-2.2.1.tar.gz a short while ago. This is a maintenance
release containing mainly bugfixes.

See the full list of changes below.

You can get it from

http://cran.r-project.org/src/base/R-2/R-2.2.1.tar.gz

(give it some time to arrive there) or wait for it to be mirrored at a
CRAN site nearer to you. If you're *really* impatient,
http://www.biostat.ku.dk/~pd/R-release should work too. Binaries for
various platforms will appear in due course.
 
There is also a version split for floppies.

For the R Core Team

Peter Dalgaard

These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:

94d55d512a9ba36caa9b7df079bae19f  COPYING
fad9b3332be894bab9bc501572864b29  COPYING.LIB
de541086db1146c1595d5be1d94a1b94  FAQ
70447ae7f2c35233d3065b004aa4f331  INSTALL
2c832b91154f663c0f07930d5e2a3dee  NEWS
88bbd6781faedc788a1cbd434194480c  ONEWS
4f004de59e24a52d0f500063b4603bcb  OONEWS
42542290c6d1585af7ded330f811385c  R-2.2.1.tar.gz
a9126622c51bef60e3febb41b2e737e5  R-2.2.1.tar.gz-split.aa
e89b51f6dbc1ddffd646a3f1f203f4f1  R-2.2.1.tar.gz-split.ab
15d93b1b5c38b6178ddcf9485dbd8cf1  R-2.2.1.tar.gz-split.ac
282bbbdd00c0066b6042ce16844036be  R-2.2.1.tar.gz-split.ad
6d00347225140283e6c93f253cb7c180  R-2.2.1.tar.gz-split.ae
2441c58fc24a69dd5cc65517a0b5e285  R-2.2.1.tar.gz-split.af
4ddcd13639debd984e3664a6b0681bd4  R-2.2.1.tar.gz-split.ag
4a042d73ec00d7d46be1cc704063dc39  R-2.2.1.tar.gz-split.ah
0d5d54a78ab994bacb12a98bece1306f  R-2.2.1.tar.gz-split.ai
69b38c655e4c1b7c36cb0abaa4890253  R-2.2.1.tar.gz-split.aj
42542290c6d1585af7ded330f811385c  R-latest.tar.gz
56a780cdec835c5c598f8dfc0738f7f3  README
020479f381d5f9038dcb18708997f5da  RESOURCES

Here is the relevant part of the NEWS file:


USER-VISIBLE CHANGES

o   options(expressions) has been reduced to 1000: the limit
of 5000 introduced in 2.1.0 was liable to give crashes from C
stack overflow.


NEW FEATURES

o   Use of 'pch' (e.g. in points) in the symbol font 5 is now
interpreted in the single-byte encoding used by that font.
Similarly, strwidth now recognizes that font 5 has a different
encoding from that of the locale.  (These are likely to affect
the answer only in MBCS locales such as UTF-8.)

o   The URW font metrics have been updated to versions from late
2002 which cover more glyphs, including Cyrillic.

o   New postscript encodings for CP1250 (Windows East European),
ISO Latin-7 (8859-13, Latvian, Lithuanian and Maori), Cyrillic
(8859-5), KOI8-R, KOI8-U and CP1251.

o   configure has more support for the Intel and Portland Group
compilers on ix86 and x86_64 Linux.

o   R CMD INSTALL will clean up if interrupted (e.g. by ctrl-C from
the keyboard).

o   There is now a comprehensive French translation of the messages,
thanks to Philippe Grosjean.


DEPRECATED  DEFUNCT

o   The undocumented use of atan() with two arguments is deprecated:
instead use atan2() (as documented).

o   The 'vfont' argument of axis() and mtext() is deprecated
(it currently warns and does nothing).

o   The function mauchley.test() is deprecated (was a misspelling)
and replaced by mauchly.test()


BUG FIXES

o   The malloc's of AIX and OSF/1 which return NULL for size 0
are now catered for in src/main/regex.c.

o   Names of list elements which are missing are now printed as
$NA and not $NA (which is how the non-missing name NA is
printed).  (Brought up in discussion of PR#8161.)

o   help.start() was not linking R.css for use by its front page and
immediate links (2.2.0 only).

o   Indexing by character NA matched the name NA.

o   The arith-true test used random inputs and did not set the seed, so
it could fail very occasionally.

o   arima() with 'fixed' supplied and p=0 for the non-seasonal
part could give spurious warnings about 'some AR parameters
were fixed'.

o   summary.matrix() could give an infinite recursion on some
classed objects (e.g. those of class Surv).

o   The 255th character in an 8-bit character set was not handled
correctly as a letter on some platforms where C char is
signed: for example it was printed as \377 and not allowed in
variable names.  (Spotted by Alexey Shipunov in Russian
encodings.)

o   Conversion from POSIXct to POSIXlt is done more accurately
around the change of DST in years not supported by the OS
(pre-1970 on Windows and some others, and in the far past or
future).

o   chisq.test(cbind(1:0, c(7,16)), simulate.p = TRUE) gave wrong
P-values on some platforms. (PR#8224)

o   pdf() was not writing details of the encoding to the file
correctly.  (Spotted by Alexey Shipunov in Russian encodings.)

o   image() was failing with an error when plotting a 

[R] x axis

2005-12-20 Thread Michela Ballardini
Hello,
I write to know how can I modify the x axis : when I plot a survival object, R 
plots a graph with x values = 0, 10, 20, 30 while I want a graph with values 0, 
6, 12, 18, 24 in the x axis. How can I do this? In R 2.1.1 version there was 
time.inc in survplot, but in version R 2.2.0 there isn't it!

I am sorry for my english and I hope that you understand my problem.

Thank you 
Michela

**
Dr.ssa Michela Ballardini
Unità di Biostatistica e Sperimentazioni Cliniche
c/o Osp. Morgagni-Pierantoni - Pad. Valsalva
Via Forlanini, 34
47100 Forlì
Tel 0543-731836
Tel/Fax 0543-731612
**


[[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] Random effects with glm()

2005-12-20 Thread Juan Pablo Sánchez
Dear R users:
I am using the glm function in order to analysis data on fertility of rabbit 
females, the response variable are either 1, the female became pregnant, or 0, 
she does not. I am using the probit link function. Actually I have several 
measurement per female, thus it would be nice if  I can include a random 
permanent effect of female in the model. I order to take into account for the 
variance covariance estructure of the data. 
I supply the calculation in this way:
fert_probit-glm(fer ~ gae + ctipo  -1,  family = binomial(link=probit), data 
= FERTILIDAD)


Thus my question is: Do exit same option in the glm() function to allow for 
random effects?, similar to the random option in lme()

Thanks in advance
Juan Pablo.

__
R-help@stat.math.ethz.ch 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] Problems in batch mode

2005-12-20 Thread Prof Brian Ripley
Oh, please do your homework (in this case `An Introduction to R' and the 
NEWS file).

R 2.2.0 is not `new' (2.2.1 is), and those flags have been obselete for 
years (literally).

On Tue, 20 Dec 2005, Tomas Goicoa wrote:


 Dear R-users,

 I am trying to run some simulations in batch mode.  In an older version
 of  the program, I used

 rterm --vsize=100M  --nsize=5000K --restore --save input file output file,

 however, in the new version R 2.2.0 , the  parameters vsize and nsize are
 ignored.

 I can use the command memory.limit to increase memory, but I am not sure if
 this corresponds to vsize and nsize.

 Does anyone know how can I set these quantities now?

-- 
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] need help in nnet

2005-12-20 Thread madhurima bhattacharjee
Hello Everybody,

I would like to know how to interpret the result of nnet function of R.
My result looks like this:

# weights:  24
initial  value 6.533893
iter  10 value 4.616299
iter  20 value 4.616120
iter  30 value 4.616109
iter  30 value 4.616109
final  value 4.616109
converged
cres
true  1
   1 10
   2  3

Can anyone please help me asap?

Thanks and Regards,
Madhurima.

__
R-help@stat.math.ethz.ch 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] Time data

2005-12-20 Thread Gabor Grothendieck
On 12/20/05, Marc Bernard [EMAIL PROTECTED] wrote:
 Dear All, I wonder how to compute the age from the date of birth and the date 
 of examination. Suppose that have the following data:

  df - as.data.frame(rbind(c(1,10/08/1950,15/03/1998), 
 c(1,10/08/1950,20/07/1998), c(1,10/08/1950,23/10/1998)))

  names(df) - c(ID, date_birth, date_exam)

  where:
  date_birth: is the date of birth
  date_exam: date of examination

  I used the following program to compute the value of the age  :


First ensure that df stores its dates using Date class in the first
place.  If your data is stored in the correct representation then
everything becomes easier subsequently:

fmt - %d/%m/%Y
df[,2] - as.Date(df[,2], fmt)
df[,3] - as.Date(df[,3], fmt)

# converting them to numeric gives the number of days since
# the Epoch and one can just subtact those:

(as.numeric(df$date_exam) - as..numeric(df$date_birth)) / 365

R News 4/1 Help Desk article has more info on dates.



  difftime(strptime(as.character(df$date_exam), '%d/%m/%Y'), 
 strptime(as.character(df$date_birth), '%d/%m/%Y'))/365.25

  which gives me as an output:

  Time differences of 47.59491, 47.94251, 48.20260 days

  theses values are actually the 3 ages (but

  My questions are:

  1- Why in the output it says days instead of years)

  2- How can I obtain the output as a numeric vector, without the statement 
 Time difference of . This is in order to use it in my calculations.

  3- Is there a way quicker and less redondant  to compute the age form the 
 date_birth and date_exam?

  Thanks a lot,

  Bernard,



 -

[[alternative HTML version deleted]]

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


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


Re: [R] x axis

2005-12-20 Thread Marc Schwartz
On Tue, 2005-12-20 at 12:56 +0100, Michela Ballardini wrote:
 Hello,
 I write to know how can I modify the x axis : when I plot a survival
 object, R plots a graph with x values = 0, 10, 20, 30 while I want a
 graph with values 0, 6, 12, 18, 24 in the x axis. How can I do this?
 In R 2.1.1 version there was time.inc in survplot, but in version R
 2.2.0 there isn't it!
 
 I am sorry for my english and I hope that you understand my problem.
 
 Thank you 
 Michela


I suspect that you are confusing the arguments available for
plot.survfit() which is in the 'survival' package as part of the
standard R installation, with survplot() which is in Frank Harrell's
'Design' package, which needs to be installed from CRAN.

The former does not have a 'time.inc' argument, while the latter does
(and still does).

You probably need to install Design in your updated R installation,
since under Windows (from your e-mail headers), R is installed in
version specific directories. 

Then be sure to use library(Design) before using survplot().


Even with plot.survfit(), one can adjust the x axis labels by using
something like the following (an example from ?plot.survfit):

leukemia.surv - survfit(Surv(time, status) ~ x, data = aml)


# Now compare the default labels here:
plot(leukemia.surv, lty = 2:3)


# With these:

# Set 'xaxt = n' so the x axis is not drawn
plot(leukemia.surv, lty = 2:3, xaxt = n)

# Now draw x axis with labels every 6 months
# Make the font smaller to fit in this example
axis(1, at = seq(0, 172, 6), cex.axis = 0.5)


HTH,

Marc Schwartz

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


[R] Installing packages into updated R

2005-12-20 Thread Michael H. Prager
A minor inconvenience in updating an R installation is remembering which 
packages were installed previously.  Has anyone written a script to 
inspect a previous installation, then get  install the same packages 
into the new installation?

-- 

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

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


Re: [R] Installing packages into updated R

2005-12-20 Thread Gabor Grothendieck
In

  http://cran.r-project.org/contrib/extra/batchfiles/batchfiles_0.2-5.zip

are two Windows XP batch files:

  movedir.bat
  copydir.bat

which will move the packages (which is much faster and suitable
if you don't need the old version of R any more) or copy the packages (which
takes longer but preserves the old version).


On 12/20/05, Michael H. Prager [EMAIL PROTECTED] wrote:
 A minor inconvenience in updating an R installation is remembering which
 packages were installed previously.  Has anyone written a script to
 inspect a previous installation, then get  install the same packages
 into the new installation?

 --

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

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


__
R-help@stat.math.ethz.ch 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] from Colombia - help

2005-12-20 Thread andres felipe
  Hi, my name is Andres Felipe Barrientos, I'm a student of Statistic and don't 
speak in english. En mi trabajo de grado necesito implementar la funcion 
smooth.spline y necesito saber con que tipo de spline trabaja (b-splines o 
naturales). 
  Ademas me gustaria saber cual es la base que se usa para encontrar estos 
splines, por ejemplo, cosenos, senos, polinomios entre otros Otra pregunta 
que tengo consiste en saber cual es la relacion que sostiene la funcion 
smooth.spline y ns Agradeciendo la atencion prestada y esperando una 
respuesta desde la universidad del valle, quien le escribe. Andres Felipe



-
 1GB gratis, Antivirus y Antispam
 Correo Yahoo!, el mejor correo web del mundo
 Abrí tu cuenta aquí
[[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] glmmADMB: Generalized Linear Mixed Models using AD Model Builder

2005-12-20 Thread Roel de Jong
Of course it is generally possible to generate datasets for a perfectly 
well-defined model that are hard to fit, but in this particular case I 
feel it should be possible. In my observations, glmm.admb is far more 
numerically stable fitting GLMM's than other software I've seen. Further 
, I don't think the data I generated come from a model that is 
overparameterized, severely contaminated with outliers, has no noise, or 
is nonlinear. But I encourage anyone to run a simulation study with 
generated data they think are acceptable and compare the robustness of 
several methods. I leave it at this.

Best regards,
Roel de Jong

Berton Gunter wrote:
 May I interject a comment?
 
 
When data is generated from a specified model with reasonable 
parameter 
values, it should be possible to fit such a model successful, 
or is this 
me being stupid?
 
 
 Let me take a turn at being stupid. Why should this be true? That is, why
 should it be possible to easily fit a model that is generated ( i.e. using a
 pseudo-random number generator) from a perfectly well-defined model? For
 example, I can easily generate simple linear models contaminated with
 outliers that are quite difficult to fit (e.g. via resistant fitting
 methods). In nonlinear fitting, it is quite easy to generate data from
 oevrparameterized models that are quite difficult to fit or whose fit is
 very sensitive to initial conditions. Remember: the design (for the
 covariates) at which you fit the data must support the parameterization.
 
 The most dramatic examples are probably of simple nonlinear model systems
 with no noise which produce chaotic results when parameters are in certain
 ranges. These would be totally impossible to recover from the data.
 
 So I repeat: just because you can generate data from a simple model, why
 should it be easy to fit the data and recover the model? 
 
 Cheers,
 
 Bert Gunter
 Genentech
 


__
R-help@stat.math.ethz.ch 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 to find only one class and differennt class

2005-12-20 Thread Muhammad Subianto
Dear R users,
I have a problem, which I can not find a solution.
Probably someone could help me?
I have a result from my classification, like this

 credit.toy
[[1]]
 age married ownhouse income gender class
1  20-30  no   nolow   male  good
2  40-50  no  yes medium female  good

[[2]]
 age married ownhouse income gender class
1  20-30 yes  yes   high   male  poor
2  20-30  no  yes   high   male  good
3  20-30 yes   nolow female  poor
4  60-70 yes  yeslow female  poor
5  60-70  no  yes   high   male  poor

[[3]]
 age married ownhouse income gender class
1  30-40 yes   no   high   male  good
2  20-30  no  yes medium female  good

[[4]]
 age married ownhouse income gender class
1 50-60 yes  yeslow female  poor
2 40-50 yes   no medium   male  poor
3 20-30  no   no   high female  poor

[[5]]
 age married ownhouse income gender class
1 40-50  no  yeslow female  good
2 60-70  no  yes medium   male  poor
3 30-40 yes   no   high female  poor

[[6]]
 age married ownhouse income gender class
1 30-40  no   no medium female  good
2 50-60 yes  yes   high female  good
3 30-40 yes   no   high female  good

 credit.toy[[5]]$class
[1] good poor poor
Levels: good poor


How can I count there are only one class and differennt class.
I need the result something like
good class : 1,3,6
poor class : 4
good and poor class : 2,5

Thanks in advance.
Sincerely, Muhammad Subianto

__
R-help@stat.math.ethz.ch 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 packages into updated R

2005-12-20 Thread Uwe Ligges
Michael H. Prager wrote:
 A minor inconvenience in updating an R installation is remembering which 
 packages were installed previously.  Has anyone written a script to 
 inspect a previous installation, then get  install the same packages 
 into the new installation?

x - installed.packages()[,1]
install.packages(x)

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


Re: [R] Installing packages into updated R

2005-12-20 Thread Prof Brian Ripley
This is one reason we normally recommend that you install into a separate 
library.  Then update.packages(checkBuilt = TRUE) is all that is needed.
However,

 foo - installed.packages()
 as.vector(foo[is.na(foo[, Priority]), 1])

will give you a character vector which you can feed to install.packages(), 
so it's not complex to do manually.

On Tue, 20 Dec 2005, Michael H. Prager wrote:

 A minor inconvenience in updating an R installation is remembering which
 packages were installed previously.  Has anyone written a script to
 inspect a previous installation, then get  install the same packages
 into the new installation?

-- 
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] Help to find only one class and differennt class

2005-12-20 Thread jim holtman
try this:

set.seed(1)
# generate some test data
x.1 - data.frame(seg=sample(1:6,20,T), class=sample(c('good',
'poor'),20,T))
x.1
(x.sp - split(x.1, x.1$seg))
# test each segment for occurance of class.
lapply(x.sp, function(.seg){
if (all(.seg$class == 'good')) return('good')
if (all(.seg$class == 'poor')) return('poor')
return(good  poor)
})



On 12/20/05, Muhammad Subianto [EMAIL PROTECTED] wrote:

 Dear R users,
 I have a problem, which I can not find a solution.
 Probably someone could help me?
 I have a result from my classification, like this

  credit.toy
 [[1]]
 age married ownhouse income gender class
 1  20-30  no   nolow   male  good
 2  40-50  no  yes medium female  good

 [[2]]
 age married ownhouse income gender class
 1  20-30 yes  yes   high   male  poor
 2  20-30  no  yes   high   male  good
 3  20-30 yes   nolow female  poor
 4  60-70 yes  yeslow female  poor
 5  60-70  no  yes   high   male  poor

 [[3]]
 age married ownhouse income gender class
 1  30-40 yes   no   high   male  good
 2  20-30  no  yes medium female  good

 [[4]]
 age married ownhouse income gender class
 1 50-60 yes  yeslow female  poor
 2 40-50 yes   no medium   male  poor
 3 20-30  no   no   high female  poor

 [[5]]
 age married ownhouse income gender class
 1 40-50  no  yeslow female  good
 2 60-70  no  yes medium   male  poor
 3 30-40 yes   no   high female  poor

 [[6]]
 age married ownhouse income gender class
 1 30-40  no   no medium female  good
 2 50-60 yes  yes   high female  good
 3 30-40 yes   no   high female  good

  credit.toy[[5]]$class
 [1] good poor poor
 Levels: good poor
 

 How can I count there are only one class and differennt class.
 I need the result something like
 good class : 1,3,6
 poor class : 4
 good and poor class : 2,5

 Thanks in advance.
 Sincerely, Muhammad Subianto

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




--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

[[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] Installing packages into updated R

2005-12-20 Thread Henric Nilsson

On Ti, 2005-12-20, 16:11, Michael H. Prager skrev:

 A minor inconvenience in updating an R installation is remembering which
 packages were installed previously.  Has anyone written a script to
 inspect a previous installation, then get  install the same packages
 into the new installation?

If the previous installation is still alive, fire it up and

pS - packageStatus()
pkgs - pS$inst$Package[!pS$inst$Priority %in% c(base, recommended)]
save(pkgs, file = foo)

In the new installation,

load(foo)
install.packages(pkgs)


HTH
Henric

__
R-help@stat.math.ethz.ch 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] Extracting data from .zip file in WINDOWS version of package

2005-12-20 Thread Jain, Nitin
Hello,

I am building a R-package for Genetics analysis. The accepted data is in 
pedigree (.ped) file format.

To load the data (say CAMP.ped) from data directory, I have a function 
CAMP.R, which does the job.
The package builds successfully in Linux (.tar.gz) and the data loads 
successfully by data(CAMP).

However, when I build the package in WINDOWS, the data directory is zipped, and 
the command data(CAMP)
gives an error - 
Error in readGenes(gfile = CAMP.ped,)
Genotype file CAMP.ped does not exist.

While debugging data(CAMP), I found that only the file CAMP.R is extracted 
temporarily, and not the file 
CAMP.ped - which causes the error.

Linux version does not face this problem as the data directory is not zipped.

Could you please suggest a way around for this problem?

Thanks.

Best,
Nitin 
__
Nitin Jain, PhD
[EMAIL PROTECTED]
Non Clinical Statistics
Pfizer, Inc. (Groton, CT)
Bldg: 260, # 1451
Ph:  (860) 686-2526 (Office)
Fax: (860) 686-6170

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


[R] boot problem

2005-12-20 Thread david v
Hello,
This is the code that is giving me problems

library(boot)
data-read.table(test,header=FALSE,sep=\t,row.names=1)
data
  V2 V3 V4
A  5  8  9
B 12 54 89
C   65 89 23
D   32 69 44
E   21 84 97
F   33 59 71
G   16 45 93
H2 46 55
I   22 33 88

resample - function(x,index) {
sample(data,replace=TRUE)
}
dist-boot(data,resample,R=1000)
Erreur : nombre d'indices incorrect sur la matrice (french)
Error: number of indices wrong in the matrix (moreless)

Can anybody help???

__
R-help@stat.math.ethz.ch 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 with sapply, plot, lines

2005-12-20 Thread Uzuner, Tolga
Hi,

I am trying to plot multiple lines on a graph.

The function is particularly simple:

sigma-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2

which uses the variables atm, rr and str...

I define these as such:

atm-0.4
rr-0.2
str-0.1


and this plots fine:

plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))

Now, I want to plot the same function for different values of str, as follows:

sapply(seq(0,0.3,0.05),function(s) {str-s; 
lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

Hoping that sigma will lexically scope into str and that lines will appear on 
the same plot as the one I first drew above.

Instead, I just get this:
 sapply(seq(0,0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
[[1]]
NULL

[[2]]
NULL

[[3]]
NULL

[[4]]
NULL

[[5]]
NULL

[[6]]
NULL

[[7]]
NULL

and the plot does not change.

Any assistance appreciated.

Regards,
Tolga








This material is sales and trading commentary and does not constitute 
investment research.  Please follow the attached hyperlink to an important 
disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml



==
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

__
R-help@stat.math.ethz.ch 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] panel function

2005-12-20 Thread Martin Henry H. Stevens
R v. 2.2.0 on Mac OS 10.4.3
lattice v. 0.12-11

I am trying to add a horizontal panel mean line to a series of panels  
in a trellis plot (i.e. a horizontal line at the mean of  y for each  
individual panel). I have tried innumerable ways to do this,  
including the code below, but if it works at all, it merely puts a  
horizontal line in the last panel.

xyplot(diss ~ Nut-7|Size, data=dathdiss, pch=1, jitter.data=TRUE,  
panel=function(x,y,...){
panel.xyplot(x,y)
panel.abline(a=mean(y),b=0) #This results in the correct line in the  
last panel, but no other lines at all.
})

Any and all thoughts are appreciated.
Thank you kindly,
Hank

Dr. Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum

__
R-help@stat.math.ethz.ch 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] Problems installing R 2.1.1. from rpm

2005-12-20 Thread White, Charles E WRAIR-Wash DC
The rpm for R installed fine on my version of SuSE 10. This is probably 
overkill but from the 'selections' page in yast I enabled the c/c++ compiler 
and tools then I individually enabled blas and a couple of other things... I 
don't remember.
__
R-help@stat.math.ethz.ch 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] Extracting data from .zip file in WINDOWS version of pack age

2005-12-20 Thread Liaw, Andy
I guess one possible work-around is to put the .ped file under inst/data/ in
the source.  At installation, the file will be put into data/.  Untested,
though.

Andy


From: Jain, Nitin
 
 Hello,
 
 I am building a R-package for Genetics analysis. The accepted 
 data is in pedigree (.ped) file format.
 
 To load the data (say CAMP.ped) from data directory, I have 
 a function CAMP.R, which does the job.
 The package builds successfully in Linux (.tar.gz) and the 
 data loads successfully by data(CAMP).
 
 However, when I build the package in WINDOWS, the data 
 directory is zipped, and the command data(CAMP)
 gives an error - 
 Error in readGenes(gfile = CAMP.ped,)
 Genotype file CAMP.ped does not exist.
 
 While debugging data(CAMP), I found that only the file 
 CAMP.R is extracted temporarily, and not the file 
 CAMP.ped - which causes the error.
 
 Linux version does not face this problem as the data 
 directory is not zipped.
 
 Could you please suggest a way around for this problem?
 
 Thanks.
 
 Best,
 Nitin 
 __
 Nitin Jain, PhD
 [EMAIL PROTECTED]
 Non Clinical Statistics
 Pfizer, Inc. (Groton, CT)
 Bldg: 260, # 1451
 Ph:  (860) 686-2526 (Office)
 Fax: (860) 686-6170
 
 --
 LEGAL NOTICE\ Unless expressly stated otherwise, this 
 messag...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
R-help@stat.math.ethz.ch 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] Install Rmpi on Fedora with mpich2 installed.

2005-12-20 Thread Ye, Bin
Hi, everyone,

I want to install Rmpi on a cluster with Fedora linux. It already installed 
mpich2, but not lam-mpi. I installed R-2.2.0 on it already.

And I got error as below:

* Installing *source* package 'Rmpi' ...
Try to find mpi.h ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mpi.h usability... no
checking mpi.h presence... no
checking for mpi.h... no
Try to find mpi.h ...
Cannot find mpi head file
Please check if --with-mpi=/usr/local/mpich2/bin/ is right
ERROR: configuration failed for package 'Rmpi'
** Removing '/usr/local/R-2.2.0/library/Rmpi'

Somehow it can not find the mpi.h which is in usr/local/mpich2. Can anyone 
kindly give me some hint on what should be done? Will installing lam-mpi solve 
the problem? If so, should mpich2 be uninstalled first? Or just modify the path 
will do?

Thanks a lot!


Bin

__
R-help@stat.math.ethz.ch 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] panel function

2005-12-20 Thread Berton Gunter
You probably have missing values in your y data. Try:
...
panel.abline(h=mean(y,na.rm=TRUE))
...

-- 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 Martin 
 Henry H. Stevens
 Sent: Tuesday, December 20, 2005 10:30 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] panel function
 
 R v. 2.2.0 on Mac OS 10.4.3
 lattice v. 0.12-11
 
 I am trying to add a horizontal panel mean line to a series 
 of panels  
 in a trellis plot (i.e. a horizontal line at the mean of  y for each  
 individual panel). I have tried innumerable ways to do this,  
 including the code below, but if it works at all, it merely puts a  
 horizontal line in the last panel.
 
 xyplot(diss ~ Nut-7|Size, data=dathdiss, pch=1, jitter.data=TRUE,  
 panel=function(x,y,...){
   panel.xyplot(x,y)
   panel.abline(a=mean(y),b=0) #This results in the 
 correct line in the  
 last panel, but no other lines at all.
   })
 
 Any and all thoughts are appreciated.
 Thank you kindly,
 Hank
 
 Dr. Martin Henry H. Stevens, Assistant Professor
 338 Pearson Hall
 Botany Department
 Miami University
 Oxford, OH 45056
 
 Office: (513) 529-4206
 Lab: (513) 529-4262
 FAX: (513) 529-4243
 http://www.cas.muohio.edu/~stevenmh/
 http://www.muohio.edu/ecology/
 http://www.muohio.edu/botany/
 E Pluribus Unum
 
 __
 R-help@stat.math.ethz.ch 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] Extracting data from .zip file in WINDOWS version of package

2005-12-20 Thread Prof Brian Ripley
On Tue, 20 Dec 2005, Jain, Nitin wrote:

 I am building a R-package for Genetics analysis. The accepted data is in 
 pedigree (.ped) file format.

 To load the data (say CAMP.ped) from data directory, I have a function 
 CAMP.R, which does the job.
 The package builds successfully in Linux (.tar.gz) and the data loads 
 successfully by data(CAMP).

 However, when I build the package in WINDOWS, the data directory is zipped, 
 and the command data(CAMP)
 gives an error -
 Error in readGenes(gfile = CAMP.ped,)
 Genotype file CAMP.ped does not exist.

 While debugging data(CAMP), I found that only the file CAMP.R is 
 extracted temporarily, and not the file
 CAMP.ped - which causes the error.

 Linux version does not face this problem as the data directory is not zipped.

Well, not zipped by default: it can be zipped.

 Could you please suggest a way around for this problem?

You need to read the `Writing R Extensions' manual and set the appropriate 
option in the DESCRIPTION file.  Search for 'ZipData'

-- 
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] help with sapply, plot, lines

2005-12-20 Thread Uzuner, Tolga
Ah OK. That is probably it, though I can't see why.
 
In function sigma, I use a variable falled str, which would be bound in the 
environment to some value.
 
Then, in the sapply statment, I was hoping that by setting str to the values in 
the vector that is the first argument to sapply, I would get different plots 
each time I called lines afterwards with sigma. Do you see what I mean ?
 
This material is sales and trading commentary and does not constitute 
investment research. Please follow the attached hyperlink to an important 
disclaimer 
 http://www.csfb.com/legal_terms/disclaimer_europe.shtml 
http://www.csfb.com/legal_terms/disclaimer_europe.shtml  

-Original Message-
From: jim holtman [mailto:[EMAIL PROTECTED]
Sent: 20 December 2005 19:20
To: Uzuner, Tolga
Subject: Re: [R] help with sapply, plot, lines


you are plotting the same line as originally over and over again.  what do you 
want to do with the parameters that you are passing in.  There is no call to 
sigma in the sapply.  How do you want to vary the parameters in the plot? 


On 12/20/05, Uzuner, Tolga  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  
wrote: 

Hi,

I am trying to plot multiple lines on a graph.

The function is particularly simple:

sigma-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2

which uses the variables atm, rr and str...

I define these as such:

atm-0.4
rr-0.2
str-0.1


and this plots fine: 

plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))

Now, I want to plot the same function for different values of str, as follows:

sapply(seq(0,0.3,0.05),function(s) {str-s; lines(seq( 
0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

Hoping that sigma will lexically scope into str and that lines will appear on 
the same plot as the one I first drew above.

Instead, I just get this:
 sapply(seq(0, 0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
[[1]]
NULL

[[2]]
NULL

[[3]]
NULL

[[4]]
NULL

[[5]]
NULL

[[6]]
NULL

[[7]] 
NULL

and the plot does not change.

Any assistance appreciated.

Regards,
Tolga








This material is sales and trading commentary and does not constitute 
investment research.  Please follow the attached hyperlink to an important 
disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml 
http://www.csfb.com/legal_terms/disclaimer_europe.shtml 



==
Please access the attached hyperlink for an important electronic communications 
disclaimer:

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml  
http://www.csfb.com/legal_terms/disclaimer_external_email.shtml 

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





-- 
Jim Holtman
Cincinnati, OH 
+1 513 247 0281

What the problem you are trying to solve? 


==
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

==

[[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] help with sapply, plot, lines

2005-12-20 Thread Gabor Grothendieck
The following is as in your post but cleaned up slightly.
Note in particular that str is an R function and although its not
wrong to also use it as a variable we use Str below to make it
clearer:  Also we define a variable xx as shown.

   atm - 0.4
   rr - 0.2
   Str - 0.1
   sigma - function(lambda) atm-2*rr*(lambda-0.5)+16*Str*(lambda-0.5)^2
   xx - seq(0, 0.3, 0.05)
   plot(xx, sigma(xx))
   sapply(xx, function(Str) lines(xx, sigma(xx)))  # wrong!

Note that sigma is defined in the global environment so lexical
scope implies that that is where sigma will look for Str -- not
within the function defined in the sapply statement.

To correct this we could do one of the following:

1. pass Str explicitly:

   sigma2 - function(Str, lambda) atm-2*rr*(lambda-0.5)+16*Str*(lambda-0.5)^2
   plot(xx, sigma2(Str, xx))
   sapply(xx, function(Str, lambda) lines(xx, sigma2(Str, xx)), lambda = xx)

2. (a) define sigma within the sapply so its lexical scope is as
desired rather than the global environment:

plot(xx, sigma(xx)) # same sigma as defined at the top
sapply(xx, function(Str, lambda) {
sigma - function(lambda) # new local sigma
atm-2*rr*(lambda-0.5)+16*Str*(lambda-0.5)^2
lines(xx, sigma(xx))
})

(b) rather than write sigma out again we could make a copy of the
original one and reset its environment:

plot(xx, sigma(xx)) # same sigma as defined at the top
sapply(xx, function(Str, lambda) {
environment(sigma) - environment()
lines(xx, sigma(xx))
})

(c) instead of using environment we could express it slightly more
compactly using the proto package. A proto object is an environment
but any function component of a proto object defined in a proto
statement has its environment reset to that object:

   library(proto)
   plot(xx, sigma(xx))
   sapply(xx, function(Str) lines(xx, with(proto(sigma = sigma), sigma(xx


On 12/20/05, Uzuner, Tolga [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to plot multiple lines on a graph.

 The function is particularly simple:

 sigma-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2

 which uses the variables atm, rr and str...

 I define these as such:

 atm-0.4
 rr-0.2
 str-0.1


 and this plots fine:

 plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))

 Now, I want to plot the same function for different values of str, as follows:

 sapply(seq(0,0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

 Hoping that sigma will lexically scope into str and that lines will appear on 
 the same plot as the one I first drew above.

 Instead, I just get this:
  sapply(seq(0,0.3,0.05),function(s) {str-s; 
  lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
 [[1]]
 NULL

 [[2]]
 NULL

 [[3]]
 NULL

 [[4]]
 NULL

 [[5]]
 NULL

 [[6]]
 NULL

 [[7]]
 NULL

 and the plot does not change.

 Any assistance appreciated.

 Regards,
 Tolga








 This material is sales and trading commentary and does not constitute 
 investment research.  Please follow the attached hyperlink to an important 
 disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml



 ==
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:

 http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

 __
 R-help@stat.math.ethz.ch 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] panel function SOLVED

2005-12-20 Thread Martin Henry H. Stevens
Hi Bernard,
Your solution was exactly right. I could have sworn I tried also  
panel.abline(a=mean(y,na.rm=TRUE), b=0) and, although it works now, I  
must have done something wrong such that it did not work.
THANK YOU
On Dec 20, 2005, at 2:18 PM, Berton Gunter wrote:

 You probably have missing values in your y data. Try:
 ...
 panel.abline(h=mean(y,na.rm=TRUE))
 ...

 -- 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 Martin
 Henry H. Stevens
 Sent: Tuesday, December 20, 2005 10:30 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] panel function

 R v. 2.2.0 on Mac OS 10.4.3
 lattice v. 0.12-11

 I am trying to add a horizontal panel mean line to a series
 of panels
 in a trellis plot (i.e. a horizontal line at the mean of  y for each
 individual panel). I have tried innumerable ways to do this,
 including the code below, but if it works at all, it merely puts a
 horizontal line in the last panel.

 xyplot(diss ~ Nut-7|Size, data=dathdiss, pch=1, jitter.data=TRUE,
 panel=function(x,y,...){
  panel.xyplot(x,y)
  panel.abline(a=mean(y),b=0) #This results in the
 correct line in the
 last panel, but no other lines at all.
  })

 Any and all thoughts are appreciated.
 Thank you kindly,
 Hank

 Dr. Martin Henry H. Stevens, Assistant Professor
 338 Pearson Hall
 Botany Department
 Miami University
 Oxford, OH 45056

 Office: (513) 529-4206
 Lab: (513) 529-4262
 FAX: (513) 529-4243
 http://www.cas.muohio.edu/~stevenmh/
 http://www.muohio.edu/ecology/
 http://www.muohio.edu/botany/
 E Pluribus Unum

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



Dr. Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum

__
R-help@stat.math.ethz.ch 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] help with sapply, plot, lines

2005-12-20 Thread Uzuner, Tolga
Fantastic. Many thanks, this is great. All understood. I will go with the first 
recommendation (pass it in explicitly).
Regards,
Tolga

This material is sales and trading commentary and does not constitute 
investment research.  Please follow the attached hyperlink to an important 
disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml

-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: 20 December 2005 19:30
To: Uzuner, Tolga
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] help with sapply, plot, lines


The following is as in your post but cleaned up slightly.
Note in particular that str is an R function and although its not
wrong to also use it as a variable we use Str below to make it
clearer:  Also we define a variable xx as shown.

   atm - 0.4
   rr - 0.2
   Str - 0.1
   sigma - function(lambda) atm-2*rr*(lambda-0.5)+16*Str*(lambda-0.5)^2
   xx - seq(0, 0.3, 0.05)
   plot(xx, sigma(xx))
   sapply(xx, function(Str) lines(xx, sigma(xx)))  # wrong!

Note that sigma is defined in the global environment so lexical
scope implies that that is where sigma will look for Str -- not
within the function defined in the sapply statement.

To correct this we could do one of the following:

1. pass Str explicitly:

   sigma2 - function(Str, lambda) atm-2*rr*(lambda-0.5)+16*Str*(lambda-0.5)^2
   plot(xx, sigma2(Str, xx))
   sapply(xx, function(Str, lambda) lines(xx, sigma2(Str, xx)), lambda = xx)

2. (a) define sigma within the sapply so its lexical scope is as
desired rather than the global environment:

plot(xx, sigma(xx)) # same sigma as defined at the top
sapply(xx, function(Str, lambda) {
sigma - function(lambda) # new local sigma
atm-2*rr*(lambda-0.5)+16*Str*(lambda-0.5)^2
lines(xx, sigma(xx))
})

(b) rather than write sigma out again we could make a copy of the
original one and reset its environment:

plot(xx, sigma(xx)) # same sigma as defined at the top
sapply(xx, function(Str, lambda) {
environment(sigma) - environment()
lines(xx, sigma(xx))
})

(c) instead of using environment we could express it slightly more
compactly using the proto package. A proto object is an environment
but any function component of a proto object defined in a proto
statement has its environment reset to that object:

   library(proto)
   plot(xx, sigma(xx))
   sapply(xx, function(Str) lines(xx, with(proto(sigma = sigma), sigma(xx


On 12/20/05, Uzuner, Tolga [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to plot multiple lines on a graph.

 The function is particularly simple:

 sigma-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2

 which uses the variables atm, rr and str...

 I define these as such:

 atm-0.4
 rr-0.2
 str-0.1


 and this plots fine:

 plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))

 Now, I want to plot the same function for different values of str, as follows:

 sapply(seq(0,0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

 Hoping that sigma will lexically scope into str and that lines will appear on 
 the same plot as the one I first drew above.

 Instead, I just get this:
  sapply(seq(0,0.3,0.05),function(s) {str-s; 
  lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
 [[1]]
 NULL

 [[2]]
 NULL

 [[3]]
 NULL

 [[4]]
 NULL

 [[5]]
 NULL

 [[6]]
 NULL

 [[7]]
 NULL

 and the plot does not change.

 Any assistance appreciated.

 Regards,
 Tolga








 This material is sales and trading commentary and does not constitute 
 investment research.  Please follow the attached hyperlink to an important 
 disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml



 ==
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:

 http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

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


==
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

__
R-help@stat.math.ethz.ch 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] help with sapply, plot, lines

2005-12-20 Thread Berton Gunter
 Now, I want to plot the same function for different values of 
 str, as follows:
 
 sapply(seq(0,0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
 
 Hoping that sigma will lexically scope into str and that 
 lines will appear on the same plot as the one I first drew above.
 

Lexical scoping means that the free variable str in sigma is looked for in
the enclosing environment, not the parent environment. This is the
environment in which sigma was defined, not called. Hence str is constant in
your calls and you get identical results at each call. See the section 3.3.1
of the R FAQ. In your example, the straightforward solution is to pass str
as an argument of sigma.

-- 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 Uzuner, Tolga
 Sent: Tuesday, December 20, 2005 10:18 AM
 To: 'r-help@stat.math.ethz.ch'
 Subject: [R] help with sapply, plot, lines
 
 Hi,
 
 I am trying to plot multiple lines on a graph.
 
 The function is particularly simple:
 
 sigma-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2
 
 which uses the variables atm, rr and str...
 
 I define these as such:
 
 atm-0.4
 rr-0.2
 str-0.1
 
 
 and this plots fine:
 
 plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))
 
 Now, I want to plot the same function for different values of 
 str, as follows:
 
 sapply(seq(0,0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
 
 Hoping that sigma will lexically scope into str and that 
 lines will appear on the same plot as the one I first drew above.
 
 Instead, I just get this:
  sapply(seq(0,0.3,0.05),function(s) {str-s; 
 lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
 [[1]]
 NULL
 
 [[2]]
 NULL
 
 [[3]]
 NULL
 
 [[4]]
 NULL
 
 [[5]]
 NULL
 
 [[6]]
 NULL
 
 [[7]]
 NULL
 
 and the plot does not change.
 
 Any assistance appreciated.
 
 Regards,
 Tolga
 
 
 
 
 
 
 
 
 This material is sales and trading commentary and does not 
 constitute investment research.  Please follow the attached 
 hyperlink to an important disclaimer 
 http://www.csfb.com/legal_terms/disclaimer_europe.shtml
 
 
 
 ==
 
 Please access the attached hyperlink for an important 
 electronic communications disclaimer: 
 
 http://www.csfb.com/legal_terms/disclaimer_external_email.shtml
 
 __
 R-help@stat.math.ethz.ch 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] help with sapply, plot, lines

2005-12-20 Thread Gabor Grothendieck
On 12/20/05, Uzuner, Tolga [EMAIL PROTECTED] wrote:
 Ah OK. That is probably it, though I can't see why.

 In function sigma, I use a variable falled str, which would be bound in the 
 environment to some value.


The environment into which sigma looks for str is the environment
where sigma was defined, i.e. the global environment, not the environment
where sigma was called from.  That's what lexical scoping means.
The alternative, in which sigma would look into the environment from
which it is called would be dynamic scoping but that's not the way
R works.

 Then, in the sapply statment, I was hoping that by setting str to the values 
 in the vector that is the first argument to sapply, I would get different 
 plots each time I called lines afterwards with sigma. Do you see what I mean ?

 This material is sales and trading commentary and does not constitute 
 investment research. Please follow the attached hyperlink to an important 
 disclaimer
  http://www.csfb.com/legal_terms/disclaimer_europe.shtml 
 http://www.csfb.com/legal_terms/disclaimer_europe.shtml 

 -Original Message-
 From: jim holtman [mailto:[EMAIL PROTECTED]
 Sent: 20 December 2005 19:20
 To: Uzuner, Tolga
 Subject: Re: [R] help with sapply, plot, lines


 you are plotting the same line as originally over and over again.  what do 
 you want to do with the parameters that you are passing in.  There is no call 
 to sigma in the sapply.  How do you want to vary the parameters in the plot?


 On 12/20/05, Uzuner, Tolga  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  
 wrote:

 Hi,

 I am trying to plot multiple lines on a graph.

 The function is particularly simple:

 sigma-function(lambda) atm-2*rr*(lambda-0.5)+16*str*(lambda-0.5)^2

 which uses the variables atm, rr and str...

 I define these as such:

 atm-0.4
 rr-0.2
 str-0.1


 and this plots fine:

 plot(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)),ylim=c(0,1))

 Now, I want to plot the same function for different values of str, as follows:

 sapply(seq(0,0.3,0.05),function(s) {str-s; lines(seq( 
 0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})

 Hoping that sigma will lexically scope into str and that lines will appear on 
 the same plot as the one I first drew above.

 Instead, I just get this:
  sapply(seq(0, 0.3,0.05),function(s) {str-s; 
  lines(seq(0.01,0.99,0.01),sigma(seq(0.01,0.99,0.01)))})
 [[1]]
 NULL

 [[2]]
 NULL

 [[3]]
 NULL

 [[4]]
 NULL

 [[5]]
 NULL

 [[6]]
 NULL

 [[7]]
 NULL

 and the plot does not change.

 Any assistance appreciated.

 Regards,
 Tolga








 This material is sales and trading commentary and does not constitute 
 investment research.  Please follow the attached hyperlink to an important 
 disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml 
 http://www.csfb.com/legal_terms/disclaimer_europe.shtml



 ==
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:

 http://www.csfb.com/legal_terms/disclaimer_external_email.shtml  
 http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

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





 --
 Jim Holtman
 Cincinnati, OH
 +1 513 247 0281

 What the problem you are trying to solve?


 ==
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:

 http://www.csfb.com/legal_terms/disclaimer_external_email.shtml

 ==

[[alternative HTML version deleted]]

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


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


Re: [R] Install Rmpi on Fedora with mpich2 installed.

2005-12-20 Thread Martin Morgan
No direct experience with mpich2 on Fedora, but I think you can use

./configure --with-mpi=/usr/local/mpich2

from within the unpacked Rmpi tarball, or

R CMD INSTALL Rmpi_... --configure-args=--with-mpi=/usr/local/mpich2

from the command line. ... is the tab-completion to the tarball, and
/usr/local/mpich2 should be a path such that mpi.h is in
/usr/local/mpichs/include/mpi.h. Some insight is in the configure.in
file of Rmpi.

Hope that helps! Sorry for the repost, Bin, meant this originally to
reply to the newsgroup.

Martin

Ye, Bin [EMAIL PROTECTED] writes:

 Hi, everyone,

 I want to install Rmpi on a cluster with Fedora linux. It already installed 
 mpich2, but not lam-mpi. I installed R-2.2.0 on it already.

 And I got error as below:

 * Installing *source* package 'Rmpi' ...
 Try to find mpi.h ...
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ANSI C... none needed
 checking how to run the C preprocessor... gcc -E
 checking for egrep... grep -E
 checking for ANSI C header files... yes
 checking for sys/types.h... yes
 checking for sys/stat.h... yes
 checking for stdlib.h... yes
 checking for string.h... yes
 checking for memory.h... yes
 checking for strings.h... yes
 checking for inttypes.h... yes
 checking for stdint.h... yes
 checking for unistd.h... yes
 checking mpi.h usability... no
 checking mpi.h presence... no
 checking for mpi.h... no
 Try to find mpi.h ...
 Cannot find mpi head file
 Please check if --with-mpi=/usr/local/mpich2/bin/ is right
 ERROR: configuration failed for package 'Rmpi'
 ** Removing '/usr/local/R-2.2.0/library/Rmpi'

 Somehow it can not find the mpi.h which is in usr/local/mpich2. Can anyone 
 kindly give me some hint on what should be done? Will installing lam-mpi 
 solve the problem? If so, should mpich2 be uninstalled first? Or just modify 
 the path will do?

 Thanks a lot!


 Bin

 __
 R-help@stat.math.ethz.ch 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] Wilcoxon Mann-Whitney Rank Sum Test in R

2005-12-20 Thread Bob Green


An earlier post had posed the question: Does anybody know what is relation 
between 'T' value calculated by 'wilcox_test' function (coin package) and 
more common 'W' value?

I found the question interesting and ran the commands in R and SPSS. The W 
reported by R did not seem to correspond to either   Mann-Whitney U, 
Wilcoxon W or the Z which I have more commonly used. Correction for ties 
may have affected my results.

Can anyone else explain what the reported W is and the relation to the 
reported T?

regards

bob

__
R-help@stat.math.ethz.ch 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] Extracting data from .zip file in WINDOWS version of package

2005-12-20 Thread Jain, Nitin
Dear Andy and Prof. Ripley,

Thank you very much for the suggestions. Tried the ZipData option, and it 
solved my problem. 
I think Andy's suggestion should also work, but haven't tried it yet.

I appreciate such a speedy response.

Best regards,
Nitin

__
Nitin Jain, PhD
[EMAIL PROTECTED]
Non Clinical Statistics
Pfizer, Inc. (Groton, CT)
Bldg: 260, # 1451
Ph:  (860) 686-2526 (Office)
Fax: (860) 686-6170



-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 20, 2005 2:15 PM
To: Jain, Nitin
Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED]
Subject: Re: [R] Extracting data from .zip file in WINDOWS version of
package


On Tue, 20 Dec 2005, Jain, Nitin wrote:

 I am building a R-package for Genetics analysis. The accepted data is in 
 pedigree (.ped) file format.

 To load the data (say CAMP.ped) from data directory, I have a function 
 CAMP.R, which does the job.
 The package builds successfully in Linux (.tar.gz) and the data loads 
 successfully by data(CAMP).

 However, when I build the package in WINDOWS, the data directory is zipped, 
 and the command data(CAMP)
 gives an error -
 Error in readGenes(gfile = CAMP.ped,)
 Genotype file CAMP.ped does not exist.

 While debugging data(CAMP), I found that only the file CAMP.R is 
 extracted temporarily, and not the file
 CAMP.ped - which causes the error.

 Linux version does not face this problem as the data directory is not zipped.

Well, not zipped by default: it can be zipped.

 Could you please suggest a way around for this problem?

You need to read the `Writing R Extensions' manual and set the appropriate 
option in the DESCRIPTION file.  Search for 'ZipData'

-- 
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
--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


Re: [R] Install Rmpi on Fedora with mpich2 installed.

2005-12-20 Thread Ye, Bin
Thank you very much, Martin! I've tried that already, but it still can't find 
the mpi.h file.

Any other suggestions?



Bin 


-Original Message-
From: Martin Morgan [mailto:[EMAIL PROTECTED]
Sent: Tue 12/20/2005 2:58 PM
To: Ye, Bin
Subject: Re: [R] Install Rmpi on Fedora with mpich2 installed.
 
Hi Bin,

I don't have direct experience installing Rmpi on mpich2, but you can
specify the location of the mpi.h files with commands like

./configure --with-mpi=/usr/local/mpich2

when in the unpacked Rmpi packate, or

R CMD INSTALL Rmpi_... --configure-args=--with-mpi=/usr/local/mpich2

when installing the package from the command line.  The ... are the
results of tab completion to the Rmpi tarball, and the path
/usr/local/mpich2 should lead to a direcotry hierarchy such that mpi.h
will be found in something like /usr/local/mpich2/include/mpi.h (some
insight into what is going on is in the configure.in file).

Hope that helps!

Martin

Ye, Bin [EMAIL PROTECTED] writes:

 Hi, everyone,

 I want to install Rmpi on a cluster with Fedora linux. It already installed 
 mpich2, but not lam-mpi. I installed R-2.2.0 on it already.

 And I got error as below:

 * Installing *source* package 'Rmpi' ...
 Try to find mpi.h ...
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ANSI C... none needed
 checking how to run the C preprocessor... gcc -E
 checking for egrep... grep -E
 checking for ANSI C header files... yes
 checking for sys/types.h... yes
 checking for sys/stat.h... yes
 checking for stdlib.h... yes
 checking for string.h... yes
 checking for memory.h... yes
 checking for strings.h... yes
 checking for inttypes.h... yes
 checking for stdint.h... yes
 checking for unistd.h... yes
 checking mpi.h usability... no
 checking mpi.h presence... no
 checking for mpi.h... no
 Try to find mpi.h ...
 Cannot find mpi head file
 Please check if --with-mpi=/usr/local/mpich2/bin/ is right
 ERROR: configuration failed for package 'Rmpi'
 ** Removing '/usr/local/R-2.2.0/library/Rmpi'

 Somehow it can not find the mpi.h which is in usr/local/mpich2. Can anyone 
 kindly give me some hint on what should be done? Will installing lam-mpi 
 solve the problem? If so, should mpich2 be uninstalled first? Or just modify 
 the path will do?

 Thanks a lot!


 Bin

 __
 R-help@stat.math.ethz.ch 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] need 95% confidence interval bands on cubic extrapolation

2005-12-20 Thread James Salsman
Dear R experts:

I need to get this plot, but also with 95% confidence interval bands:

   hour - c(1, 2, 3, 4, 5, 6)
   millivolts - c(3.5, 5, 7.5, 13, 40, 58)

   plot(hour, millivolts, xlim=c(1,10), ylim=c(0,1000))

   pm - lm(millivolts ~ poly(hour, 3))

   curve(predict(pm, data.frame(hour=x)), add=TRUE)

How can the 95% confidence interval band curves be plotted too?

Sincerely,
James Salsman

P.S.  I know I should be using data frames instead of parallel lists.
This is just a simple example.

__
R-help@stat.math.ethz.ch 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] Two problems compiling my shared library...

2005-12-20 Thread Kort, Eric
Since requests keep trickling in, I have finally gotten around to
polishing my rtiff package for R.  This package will read TIFF images
into a pixmap for subsequent processing.

However, I am encountering a couple problems with compiling the shared
library.

1. On windows (R 2.2.0): R CMD INSTALL successfully compiles a dll, but
the dll has no entry points (as revealed by nm rtiff.dll), leading to C
entry point ... not in load table errors when I try to use the library.
Here is how R CMD INSTALL built the dll:

---8--
MkRules:143: warning: ignoring old commands for target `.c.o'
making rtiff.d from rtiff.c
g++   -Ic:/usr/include -Wall -O2   -c rtiff.c -o rtiff.o
rtiff.c: In function `void reduce(int*, int*, int*, int*, double*)':
rtiff.c:138: warning: converting to `int' from `double'
rtiff.c:139: warning: converting to `int' from `double'
ar cr rtiff.a rtiff.o
ranlib rtiff.a
windres --include-dir c:/usr/include  -i rtiff_res.rc -o rtiff_res.o
gcc  --shared -s  -o rtiff.dll rtiff.def rtiff.a rtiff_res.o
-Lc:/usr/src/gnuwin32  -ltiff  -lg2c -lR
  ... DLL made
---8--

However, if I simply do the following:

gcc -shared -o rtiff.dll rtiff.c -ltiff

I get a functional shared library.

Any clues as to why R CMD INSTALL is resulting in an entry-pointless
dll?  (And couldn't the shared library compilation be greatly simplified
as I have demonstrated above?)

2. On (ubuntu) Linux (R 2.1.0):  R CMD INSTALL results in an rtiff.so
that crashes with a segmentation fault.  Again, gcc -shared -o rtiff.so
rtiff.c -ltiff results in a function shared library.  

Here, I have traced the problem to the -O2 flag with which R was
compiled.  If I hand compile with the -O2 flag, I get the segmentation
fault back.  A search of the internet suggests this is likely a GCC bug,
which perhaps I could patch, but I don't want to expect potential users
of my library to have to patch their GCC.

So...can I eliminate the -O2 option via Makevars somehow, or do I need
my own custom Makefile to get around this?

Thank you,

Eric
This email message, including any attachments, is for the so...{{dropped}}

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


Re: [R] partially linear models

2005-12-20 Thread Liaw, Andy
From: Peter Dalgaard
 
 Liaw, Andy [EMAIL PROTECTED] writes:
 
  This doesn't look like an R question, as I know of no pre-packaged
  functionality publicly available that can fit the model 
 that Elizabeth
  described, and it doesn't seem like she's particularly 
 interested in an
  R-based answer, either.
  
  My gut feeling is that if there is a test of significance 
 for beta in such a
  model, it probably shouldn't depend upon how f() is fitted, 
 wavelets or
  otherwise.  I.e., any test for the linear component in a 
 partially linear
  model ought to do just fine.  The main difference here, 
 from a fully linear
  model, is that one no longer can estimate E(y) without 
 bias, even with the
  assumption that the model is correct.  What gets messier still is if
  data-dependent smoothing/de-noising is done in estimating 
 f(), as that opens
  up a whole bucket of nasty creatures.
  
  I could be off, though, so take this with a truck-load of NaCl...
 
 Isn't it just a gam() model (package mgcv), if you replace the
 wavelets with splines?

I believe so.
 
 I haven't messed with this for a decade, but I seem to recall that
 there's a result to the effect that you need to undersmooth f slightly
 to get optimal inference for the beta. Perhaps look in Green 
 Silverman for the reference. 

A quote I heard from Prof. David Ruppert:  There are lies, damned lies, and
then big O notations.

I presume the need to undersmooth is to reduce the bias of the `smooth'.
The problem is, by how much should one undersmooth, so the bias would go
from O(k*n^-4) to O(k*n^-5) (I'm just making this up, but you get the idea)?

Cheers,
Andy
 
  
  Andy
  
  From: Spencer Graves
   
   I have seen no replies to this post, and I don't know 
   that I can 
   help, either.  However, I wonder if you tried 
 RSiteSearch with your 
   favorite key words and phrases?  For example, I just got 
 107 hits for 
   'RSiteSearch(wavelets)'.  I wonder if any of them might 
 help you.
   
   If you'd like further help from this list, please 
   submit another 
   post.  However, before you do, I suggest you read the 
 posting guide! 
   www.R-project.org/posting-guide.html.  Anecdotal 
 evidence suggests 
   that posts more consistent with the guide tend to receive 
   quicker, more 
   useful replies.
   
   Best Wishes,
   spencer graves
   
   Elizabeth Lawson wrote:
   
Hey,
   
   I am estiamting a partially linear model 
   y=X\beta+f(\theta) where the f(\theta) is estiamted using 
 wavelets.
   
  Has anyone heard of methods to test if the betas are 
   significant or to address model fit?
   
  Thanks for any thoughts or comments.
   
  Elizabeth Lawson

__



[[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
   
   -- 
   Spencer 
   Graves, PhD
   Senior Development Engineer
   PDF Solutions, Inc.
   333 West San Carlos Street Suite 700
   San Jose, CA 95110, USA
   
   [EMAIL PROTECTED]
   www.pdf.com http://www.pdf.com
   Tel:  408-938-4420
   Fax: 408-280-7915
   
   __
   R-help@stat.math.ethz.ch 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
  
 
 -- 
O__  
  Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  
 (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: 
 (+45) 35327907
 


__
R-help@stat.math.ethz.ch 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] need 95% confidence interval bands on cubic extrapolation

2005-12-20 Thread Liaw, Andy
Look at the interval option in ?predict.lm.

Andy

From: James Salsman
 
 Dear R experts:
 
 I need to get this plot, but also with 95% confidence interval bands:
 
hour - c(1, 2, 3, 4, 5, 6)
millivolts - c(3.5, 5, 7.5, 13, 40, 58)
 
plot(hour, millivolts, xlim=c(1,10), ylim=c(0,1000))
 
pm - lm(millivolts ~ poly(hour, 3))
 
curve(predict(pm, data.frame(hour=x)), add=TRUE)
 
 How can the 95% confidence interval band curves be plotted too?
 
 Sincerely,
 James Salsman
 
 P.S.  I know I should be using data frames instead of parallel lists.
 This is just a simple example.
 
 __
 R-help@stat.math.ethz.ch 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] nls problem

2005-12-20 Thread Weijie Cai
Hi list,

I tried to use nls to do some nonlinear least square fitting on my data with 
340 observations and 10 variables, but as I called nls() function, I got 
this error message:
Error in qr.qty(QR, resid) : 'qr' and 'y' must have the same number of rows
Then I traced back a little bit into nls() function, the error seemed to 
happen when calling nlsiter() internal function, but I did not find any clue 
calling qr.qty() function in nls.c. I searched around mailing list, there 
were some posts about this message but none of them were clearly solved. I 
wonder if anybody solved this problem? (Bate's example worked, though)

Thanks

_
On the road to retirement? Check out MSN Life Events for advice on how to

__
R-help@stat.math.ethz.ch 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] Wilcoxon Mann-Whitney Rank Sum Test in R

2005-12-20 Thread Peter Dalgaard
Bob Green [EMAIL PROTECTED] writes:

 An earlier post had posed the question: Does anybody know what is relation 
 between 'T' value calculated by 'wilcox_test' function (coin package) and 
 more common 'W' value?
 
 I found the question interesting and ran the commands in R and SPSS. The W 
 reported by R did not seem to correspond to either   Mann-Whitney U, 
 Wilcoxon W or the Z which I have more commonly used. Correction for ties 
 may have affected my results.
 
 Can anyone else explain what the reported W is and the relation to the 
 reported T?

Well, it's open source... You could just go check.

W is the sum of the ranks in the first group, minus the minimum value
it can attain, namely sum(1:n1) == n1*(n1+1)/2. In the tied cases, the
actual minimum could be larger.

The T would seem to be asymptotically normal 

 wilcox_test(pd ~ age, data = water_transfer,distribution=asymp)

Asymptotic Wilcoxon Mann-Whitney Rank Sum Test

data:  pd by groups 12-26 Weeks, At term
T = -1.2247, p-value = 0.2207
alternative hypothesis: true mu is not equal to 0

 pnorm(-1.2247)*2
[1] 0.2206883

so a good guess at its definition is that it is obtained from W or one
of the others by subtracting the mean and dividing with the SD.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch 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] need 95% confidence interval bands on cubic extrapolation

2005-12-20 Thread Marc Schwartz (via MN)
On Tue, 2005-12-20 at 13:04 -0800, James Salsman wrote:
 Dear R experts:
 
 I need to get this plot, but also with 95% confidence interval bands:
 
hour - c(1, 2, 3, 4, 5, 6)
millivolts - c(3.5, 5, 7.5, 13, 40, 58)
 
plot(hour, millivolts, xlim=c(1,10), ylim=c(0,1000))
 
pm - lm(millivolts ~ poly(hour, 3))
 
curve(predict(pm, data.frame(hour=x)), add=TRUE)
 
 How can the 95% confidence interval band curves be plotted too?
 
 Sincerely,
 James Salsman
 
 P.S.  I know I should be using data frames instead of parallel lists.
 This is just a simple example.

There is an example in ?predict.lm.

Given your data, something like the following will work:

hour - c(1, 2, 3, 4, 5, 6)
millivolts - c(3.5, 5, 7.5, 13, 40, 58)

pm - lm(millivolts ~ poly(hour, 3))

# Now create a new dataset with an interval
# of hours that fits your data above
# This is then used in predict.lm() below
# Smaller increments will create smoother lines in the plot
new - data.frame(hour = seq(1, 6, 0.5))


# Use the new data and generate confidence intervals
# based upon the model
clim - predict(pm, new, interval = confidence)


 clim
 fitlwr  upr
1   4.400794 -17.659582 26.46117
2   2.879712 -12.954245 18.71367
3   2.817460 -14.317443 19.95236
4   4.252232 -12.822969 21.32743
5   7.22  -8.051125 22.49557
6  11.765625  -2.374270 25.90552
7  17.920635   2.647288 33.19398
8  25.725446   8.650246 42.80065
9  35.218254  18.083351 52.35316
10 46.437252  30.603295 62.27121
11 59.420635  37.360259 81.48101


# Now use matplot to draw the fitted line (black)
# and the CI's (red)
matplot(new$hour, clim,
lty = c(1, 2, 2), 
col = c(black, red, red),
type = l, ylab = predicted y)


See ?predict.lm and ?matplot for more information.

HTH,

Marc Schwartz

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


Re: [R] partially linear models

2005-12-20 Thread Peter Dalgaard
Liaw, Andy [EMAIL PROTECTED] writes:

 From: Peter Dalgaard
  
  Liaw, Andy [EMAIL PROTECTED] writes:
  
   This doesn't look like an R question, as I know of no pre-packaged
   functionality publicly available that can fit the model 
  that Elizabeth
   described, and it doesn't seem like she's particularly 
  interested in an
   R-based answer, either.
   
   My gut feeling is that if there is a test of significance 
  for beta in such a
   model, it probably shouldn't depend upon how f() is fitted, 
  wavelets or
   otherwise.  I.e., any test for the linear component in a 
  partially linear
   model ought to do just fine.  The main difference here, 
  from a fully linear
   model, is that one no longer can estimate E(y) without 
  bias, even with the
   assumption that the model is correct.  What gets messier still is if
   data-dependent smoothing/de-noising is done in estimating 
  f(), as that opens
   up a whole bucket of nasty creatures.
   
   I could be off, though, so take this with a truck-load of NaCl...
  
  Isn't it just a gam() model (package mgcv), if you replace the
  wavelets with splines?
 
 I believe so.
  
  I haven't messed with this for a decade, but I seem to recall that
  there's a result to the effect that you need to undersmooth f slightly
  to get optimal inference for the beta. Perhaps look in Green 
  Silverman for the reference. 
 
 A quote I heard from Prof. David Ruppert:  There are lies, damned lies, and
 then big O notations.
 
 I presume the need to undersmooth is to reduce the bias of the `smooth'.
 The problem is, by how much should one undersmooth, so the bias would go
 from O(k*n^-4) to O(k*n^-5) (I'm just making this up, but you get the idea)?
 
 Cheers,
 Andy

More like sacrificing the optimal O(n^-(2/5)) (?) convergence on the
smooth part so that the bias is reduced below O(n^-(1/2)) at the
expense of a bigger variance term in the MSE. The whole thing is
controlled by having the bandwidth of the smoother shrink as O(n^-q)
where q is, er, something...

And of course the big lie is that there are some unknown multipliers
that depend on the f that you are trying to estimate.
  
   
   Andy
   
   From: Spencer Graves

  I have seen no replies to this post, and I don't know 
that I can 
help, either.  However, I wonder if you tried 
  RSiteSearch with your 
favorite key words and phrases?  For example, I just got 
  107 hits for 
'RSiteSearch(wavelets)'.  I wonder if any of them might 
  help you.

  If you'd like further help from this list, please 
submit another 
post.  However, before you do, I suggest you read the 
  posting guide! 
www.R-project.org/posting-guide.html.  Anecdotal 
  evidence suggests 
that posts more consistent with the guide tend to receive 
quicker, more 
useful replies.

  Best Wishes,
  spencer graves

Elizabeth Lawson wrote:

 Hey,

I am estiamting a partially linear model 
y=X\beta+f(\theta) where the f(\theta) is estiamted using 
  wavelets.

   Has anyone heard of methods to test if the betas are 
significant or to address model fit?

   Thanks for any thoughts or comments.

   Elizabeth Lawson
 
 __
 
 
 
   [[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

-- 
Spencer 
Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch 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
   
  
  -- 
 O__  
   Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
   (*) \(*) -- University of Copenhagen   Denmark  Ph:  
  (+45) 35327918
  ~~ - ([EMAIL PROTECTED])  FAX: 
  (+45) 35327907
  
  
 
 
 --
 Notice:  This e-mail message, together with any attachment...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list

[R] Help with ca.jo and cajools (Johansen's Cointegration)

2005-12-20 Thread Chilton, Alexander B [MSD]
I am trying to run a conintegration analysis. I am a former user of S-Plus and 
understand the output of the coint and VECM output, but I am having trouble 
understanding the equivalent output in R.

Here is what I ran

 coint=ca.jo(data,constant=T,K=2,spec=longrun)
 summary(coint)

The first portion of the output that I did not understand

  [,1]  [,2]  [,3]
y11.00  1.00  1.00
y2   -1.114734 -2.461872 -2.216456
constant  1.364641  7.473149  7.331977


From this i think that y1 - 1.143*y2 + 1.36 ~ I(0)

What i don't understand is where columns [,2] and [,3] come into play. Now i 
run the following:

 cajools(coint)


Call:
lm(formula = [EMAIL PROTECTED] ~ [EMAIL PROTECTED] + [EMAIL PROTECTED] - 1)

Coefficients:
   [,1]   [,2] 
[EMAIL PROTECTED]   0.028114   0.065968
[EMAIL PROTECTED]   0.371630   0.183797
[EMAIL PROTECTED] -0.011724  -0.002647
[EMAIL PROTECTED]  0.012282   0.001827
[EMAIL PROTECTED]   -0.012430   0.001482


My understanding is that the specification of the VECM was as follows (with 
K=2):

deltay1 = c1 + a1*(y1_t-1-b2*y2_t-1)+ phi11*lag(deltay1_t-1) + 
phi12*deltay2_t-1+e1

deltay2 = c2 + a2*(y1_t-1-b2*y2_t-1)+ phi21*lag(deltay1_t-1) + 
phi22*deltay2_t-1+e2


My guess is that Z11 and Z12 correspond to the above phis. That c1 and c1 
correspond to ZK. That b2 is -1.11 from the step before? The rest, ZKy1 and 
ZKy2 I can't place. Please help,

Alex

__
R-help@stat.math.ethz.ch 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 MAANOVA functions

2005-12-20 Thread Heather Maughan
Dear R-users:

I am using the package MAANOVA to analyze microarray data and have
encountered problems when trying to plot data.  I have tried emailing a
MAANOVA discussion group, as well as the author of the package, and have not
yet received a response so I am hoping that someone on this listserv can be
of assistance.  

There are several functions in MAANOVA (riplot, resiplot) which call the
plot function.  For some unknown reason, when I use these functions, it
appears that xlim has not been specified and I get an error (see below).
However, when reading the code for each function, a command for how to
calculate xlim has been specified but for some reason it does not get
done.  Does anyone have experience using MAANOVA commands and is willing to
help?

Here is an example of the error I get.  It is identical also for the
resiplot command:

 riplot(spore)
Error in plot.window(xlim, ylim, log, asp, ...) :
need finite 'xlim' values

Many thanks,
Heather
--

__
R-help@stat.math.ethz.ch 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] Wilcoxon Mann-Whitney Rank Sum Test in R

2005-12-20 Thread P Ehlers


Peter Dalgaard wrote:
 Bob Green [EMAIL PROTECTED] writes:
 
 
An earlier post had posed the question: Does anybody know what is relation 
between 'T' value calculated by 'wilcox_test' function (coin package) and 
more common 'W' value?

I found the question interesting and ran the commands in R and SPSS. The W 
reported by R did not seem to correspond to either   Mann-Whitney U, 
Wilcoxon W or the Z which I have more commonly used. Correction for ties 
may have affected my results.

Can anyone else explain what the reported W is and the relation to the 
reported T?
 
 
 Well, it's open source... You could just go check.
 
 W is the sum of the ranks in the first group, minus the minimum value
 it can attain, namely sum(1:n1) == n1*(n1+1)/2. In the tied cases, the
 actual minimum could be larger.
 
 The T would seem to be asymptotically normal 
 
 
wilcox_test(pd ~ age, data = water_transfer,distribution=asymp)
 
 
 Asymptotic Wilcoxon Mann-Whitney Rank Sum Test
 
 data:  pd by groups 12-26 Weeks, At term
 T = -1.2247, p-value = 0.2207
 alternative hypothesis: true mu is not equal to 0
 
 
pnorm(-1.2247)*2
 
 [1] 0.2206883
 
 so a good guess at its definition is that it is obtained from W or one
 of the others by subtracting the mean and dividing with the SD.
 

With the SD adjusted for ties, of course. (See, e.g., Conover's book.)

Peter Ehlers
University of Calgary

__
R-help@stat.math.ethz.ch 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] Linux command

2005-12-20 Thread Pierre Kleiber
In LINUX and other unixes you can also put your R commands in a so-called here 
file, which resides within the script file that calls R; so you don't need two 
separate files.  Taking Marc Schwartz' example, you could have make the 
following script file (call it say tsst):

#!/bin/sh
R --slave --vanilla 
  # Example from ?lm
  ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
  trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
  group - gl(2,10,20, labels=c(Ctl,Trt))
  weight - c(ctl, trt)
  anova(lm.D9 - lm(weight ~ group))


Then do:
chmod +x tsst
./tsst

The here file is the part between  and .  Also, arguments to the 
script are interpretable within the here file.  So for example:

#!/bin/sh
R --slave --vanilla YYY
  tt - scan($1)
  print(mean(tt))
YYY

would read data from a file given as an argument in calling the script.


Cheers, Pierre

Marc Schwartz offered the following remark on 12/19/05 14:43...
 On Tue, 2005-12-20 at 02:14 +0200, Tommi Viitanen wrote:
 
I wonder if it's possible to run R-functions or other commands 
automatically by some shell-script in Linux shell.

I thought that something like
$ R mean(c(1,2))
$ R xy.Rdata
would work, but I havent found the right way.
 
 
 There is some documentation in 'An Introduction to R', Appendix B
 Invoking R which is available with the R installation and/or from the
 main R web site under Documentation. There is also help available via
 'man R' from the Linux console.
 
 If you are just passing your first line to R, you can do something like
 this:
 
 $ echo mean(c(1,2)) | R --slave --vanilla
 [1] 1.5
 
 
 This echos the R command string and pipes it as stdin to R.
 
 The additional arguments make the interaction with R more streamlined
 and are documented in the aforementioned references.
 
 You can also pass a text file containing more complex R commands:
 
 R --slave --vanilla  RCommandFile.txt
 
 
 If I have the following in the file:
 
 # Example from ?lm
 ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
 trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
 group - gl(2,10,20, labels=c(Ctl,Trt))
 weight - c(ctl, trt)
 anova(lm.D9 - lm(weight ~ group))
 
 
 I can then do:
 
 $ R --slave --vanilla  RCommandFile.txt
 Analysis of Variance Table
 
 Response: weight
   Df Sum Sq Mean Sq F value Pr(F)
 group  1 0.6882  0.6882  1.4191  0.249
 Residuals 18 8.7293  0.4850
 
 
 And you can of course re-direct the output:
 
 R --slave --vanilla  RCommandFile.txt  Outfile.txt
 
 
 HTH,
 
 Marc Schwartz
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
-
Pierre Kleiber, Ph.D   Email: [EMAIL PROTECTED]
Fishery BiologistTel: 808 983-5399 / (hm)808 737-7544
NOAA Fisheries Service - Honolulu LaboratoryFax: 808 983-2902
2570 Dole St., Honolulu, HI 96822-2396
-
  God could have told Moses about galaxies and mitochondria and
   all.  But behold... It was good enough for government work.

__
R-help@stat.math.ethz.ch 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] Newbie - Summarize function

2005-12-20 Thread Andrew . Haywood
Dear R Users,

I have searched through the archives but I am still struggling to find a 
way to process the below dataset. I have a dataset that has stratum and 
plot identifier. Within each plot there is variable (Top) stating the 
number of measurments that should be used to to calculate the mean to the 
largest top elements within one of the vectors (X). I would like to 
process this summary statistic by groups. At this stage I have been trying 
to use the summarize function within the Hmisc library but I am getting 
the following error Error in eval(expr, envir, enclos) : numeric 'envir' 
arg not of length one In addition: Warning message: no finite arguments to 
max; returning -Inf.

Any suggetsions on how I can fix this would be greatly appreciated.

Kind regards

Andrew

test - read.table(test.csv, header=TRUE, sep=,)
#function to calculate mean of top elements within a plot
 g-function(y) {
+ top_no -max(y$top)
+ weight - with(y,as.numeric(x=x[order(x,decreasing=TRUE)[top_no]]))
+ wtd.mean(y$x,weight)
+ }
 g(test)
[1] 172.6667
#call to summarize function - use function g and summarise by stratum plot
 test.2 - with(test,summarize(test$x,llist(test$Stratum,test$plot),g))
Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one
In addition: Warning message:
no finite arguments to max; returning -Inf 

traceback() 
9: eval(substitute(expr), data, enclos = parent.frame())
8: with.default(y, as.numeric(x = x[order(x, decreasing = 
TRUE)[top_no]]))
7: with(y, as.numeric(x = x[order(x, decreasing = TRUE)[top_no]]))
6: FUN(X, ...)
5: summarize(test$x, llist(test$Stratum, test$plot), g)
4: eval(expr, envir, enclos)
3: eval(substitute(expr), data, enclos = parent.frame())
2: with.default(test, summarize(test$x, llist(test$Stratum, test$plot), 
   g))
1: with(test, summarize(test$x, llist(test$Stratum, test$plot), 
   g))

The version im running on is 

$platform
[1] i386-pc-mingw32

$arch
[1] i386

$os
[1] mingw32

$system
[1] i386, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 2.0

$year
[1] 2005

$month
[1] 10

$day
[1] 06

$svn rev
[1] 35749

$language
[1] R

 


Stratum plot idtop x
1   1   1   2   12
1   1   2   2   41
1   1   3   2   12
1   1   4   2   43
1   1   5   2   12
1   1   6   2   14
1   1   7   2   43
1   1   8   2   12
1   2   1   4   42
1   2   2   4   12
1   2   3   4   432
1   2   4   4   12
1   2   5   4   12
1   2   6   4   14
1   2   7   4   41
1   2   8   4   1
2   1   1   2   12
2   1   2   2   41
2   1   3   2   12
2   1   4   2   43
2   1   5   2   12
2   1   6   2   14
2   1   7   2   43
2   1   8   2   12
2   2   1   3   42
2   2   2   3   12
2   2   3   3   432
2   2   4   3   12
2   2   5   3   12
2   2   6   3   14
2   2   7   3   41
2   2   8   3   1





[[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] How do I edit the x-axis on a time series plot?

2005-12-20 Thread Philip Turk
I am merely trying to reproduce Figure 1.2 of Chris Chatfield's 6th 
edition of his The Analysis of Time Series: An Introduction (page 2). 
The S-PLUS code is on pages 305-306. I am almost there but I am having a 
heck of a time trying to modify and change the x-axis per the book. The 
book shows the x-axis with 10 tick marks, correctly positioned, and 
labeled Jan 53, ..., Jan 62. I have not provided the data for the 
sake of brevity although it is readily available at 
http://www.bath.ac.uk/~mascc/Recife.TS

Can anyone help?

recife - as.vector(t(recife))
RecfS - ts(recife, start = c(1953,1), frequency = 12) 
plot(RecfS, ylab = “Temperature (deg C)”, xlab = “Year”, main = “Average 
air temperature (deg C) at Recife, Brazil, in successive months from 
1953 to 1962”, adj = 0.5)

Thanks,

Philip Turk


__
R-help@stat.math.ethz.ch 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] nnet

2005-12-20 Thread madhurima bhattacharjee
Hello Everybody,

I would like to know how to interpret the result of nnet function of R.
My result looks like this:

# weights:  24
initial  value 6.533893
iter  10 value 4.616299
iter  20 value 4.616120
iter  30 value 4.616109
iter  30 value 4.616109
final  value 4.616109
converged
cres
true  1
   1 10
   2  3

Can anyone please help me asap?

Thanks and Regards,
Madhurima.

__
R-help@stat.math.ethz.ch 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] Wilcoxon Mann-Whitney Rank Sum Test in R

2005-12-20 Thread Peter Dalgaard
P Ehlers [EMAIL PROTECTED] writes:

  so a good guess at its definition is that it is obtained from W or one
  of the others by subtracting the mean and dividing with the SD.
  
 
 With the SD adjusted for ties, of course. (See, e.g., Conover's book.)

...which is actually the exact SD, conditional on the set of tied
ranks, not just a correction term. See my discussion with Torsten a
month or so ago.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch 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 MAANOVA functions

2005-12-20 Thread Prof Brian Ripley
The key word is 'finite'.

You have either infinite or missing values on 'xlim' being based to the 
plotting functions.  The message does not say that 'xlim' does not exist, 
rather than it has incorrect values.

On Tue, 20 Dec 2005, Heather Maughan wrote:

 Dear R-users:

 I am using the package MAANOVA to analyze microarray data and have
 encountered problems when trying to plot data.  I have tried emailing a
 MAANOVA discussion group, as well as the author of the package, and have not
 yet received a response so I am hoping that someone on this listserv can be
 of assistance.

 There are several functions in MAANOVA (riplot, resiplot) which call the
 plot function.  For some unknown reason, when I use these functions, it
 appears that xlim has not been specified and I get an error (see below).
 However, when reading the code for each function, a command for how to
 calculate xlim has been specified but for some reason it does not get
 done.  Does anyone have experience using MAANOVA commands and is willing to
 help?

 Here is an example of the error I get.  It is identical also for the
 resiplot command:

 riplot(spore)
 Error in plot.window(xlim, ylim, log, asp, ...) :
need finite 'xlim' values

 Many thanks,
 Heather
 --

 __
 R-help@stat.math.ethz.ch 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] nls problem

2005-12-20 Thread Prof Brian Ripley
On Tue, 20 Dec 2005, Weijie Cai wrote:

 Hi list,

 I tried to use nls to do some nonlinear least square fitting on my data with
 340 observations and 10 variables, but as I called nls() function, I got
 this error message:
 Error in qr.qty(QR, resid) : 'qr' and 'y' must have the same number of rows
 Then I traced back a little bit into nls() function, the error seemed to
 happen when calling nlsiter() internal function, but I did not find any clue
 calling qr.qty() function in nls.c. I searched around mailing list, there
 were some posts about this message but none of them were clearly solved. I
 wonder if anybody solved this problem? (Bate's example worked, though)

Please don't quess.  qr.qty(QR, resid) appears in nlsModel, and 
traceback() would tell you where the error can from.

If you study the posting guide you should be able to come up with a 
report we can help you with, e.g. by giving a reproducible example, giving 
your R version 

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