Re: [R] R-Logo in \LaTeX

2008-03-07 Thread Gabor Csardi
On Thu, Mar 06, 2008 at 06:54:41PM -0500, Charilaos Skiadas wrote:
 On Mar 6, 2008, at 1:49 PM, Mag. Ferri Leberl wrote:
 
  Dear everybody!
  Is there a command in \LaTeX to display the R-Logo or has anybody  
  made it up?
  Thank you in advance.
 
 Isn't it just an image? Hence you would include it like one usually  
 includes images. Or do you mean something else?

Yes, it is an image, but it would be nice to have it in a vector-based 
format like EPS or SVG. Anyway, here are some versions (=different sizes):
http://developer.r-project.org/Logo/

Gabor

  Yours, sincerely
  Mag. Ferri Leberl
 
 Haris Skiadas
 Department of Mathematics and Computer Science
 Hanover College
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]UNIL DGM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] build options for R

2008-03-07 Thread Prof Brian Ripley
If you are calling libR.so, it is an option set when you initialize R.
See Rf_initEmbeddedR in 'Writing R Extensions' and the examples in the 
tests/Embedded directory in the sources.

BTW, discussion of embedded R is definitely off topic for R-help: use 
the R-devel list.

On Thu, 6 Mar 2008, Scott Zentz wrote:

 Hello Everyone,

Recently I was given a Java servlet based web calculator that will
 call R (libR.so to be exact) but I am having trouble trying to disable R
 from requiring --save, --no-save or --vanilla... Is there any way to
 build R on linux and disable R from asking --save, --no-save or --vanilla??

 Thanks!

 -scz

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] parameters for lbfgsb (function for optimization)

2008-03-07 Thread Bill.Venables
Whoa!  If you want to optimise in R, you need to write an R function to
define your objective.  If that function is already written in C, as
appears to be the case, you need to write an interfact to make it
available to R.  This is not exactly something novices would take on
lightly.

If you wish to optimise directly in C, then you should look for software
support to do it that was intended for the purpose.  The R source code
is not like that.  You can use it if you want, but you must expect it to
be difficult and very puzzling, since it is not intended to be
free-standing, but part of a large, complex system.

Best of luck. 


Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile: +61 4 8819 4402
Home Phone: +61 7 3286 7700
mailto:[EMAIL PROTECTED]
http://www.cmis.csiro.au/bill.venables/ 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Kyeongmi Cheon
Sent: Friday, 7 March 2008 3:06 PM
To: r-help@r-project.org
Subject: [R] parameters for lbfgsb (function for optimization)

Can anyone help me with lbfgsb (function for optimization)?

It takes the following parameters:

void lbfgsb (int n, int lmm, double *x, double *lower,
double *upper, int *nbd, double *Fmin, optimfn fn,
optimgr gr, int *fail, void *ex, double factr,
double pgtol, int *fncount, int *grcount,
int maxit, char *msg, int trace, int nREPORT);

What do I put for parameter ex (11th parameter)? I looked at optim.c
codes
at R sites and it's a structure that has bunch of objects such as SEXP
R_fcall,  SEXP R_gcall, SEXP R_env, double* ndeps, etc. I cannot figure
out
what it is about.
How about fncount, rcount? R-ext.pdf or R help does not explain it in
detail. Any comments would help. Thank you.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Puzzling coefficients for linear fitting to polynom

2008-03-07 Thread Firas Swidan, PhD
Hi,

I can not comprehend the linear fitting results of polynoms. For
example, given the following data (representing y = x^2):

 x - 1:3
 y - c(1, 4, 9)

performing a linear fit

 f - lm(y ~ poly(x, 2))

gives weird coefficients:

 coefficients(f)
(Intercept) poly(x, 2)1 poly(x, 2)2 
  4.667   5.6568542   0.8164966 

However the fitted() result makes sense:

 fitted(f)
1 2 3 
1 4 9 

This is very confusing. How should one understand the result of
coefficients()?

Thanks for any tips,
Firas.

-- 
Firas Swidan, PhD
Founder and CEO
Olymons: Blessing Machines with Vision (TM)
http://www.olymons.com
P.O.Box 8125
Nazareth 16480
Israel
Cell: +.972.(0)54.733.1788

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Puzzling coefficients for linear fitting to polynom

2008-03-07 Thread Dimitris Rizopoulos
poly() computes by default orthogonal polynomials; check the online 
help file for poly() for more info. Probably you want to use the 'raw' 
argument in this example, i.e.,

x - 1:3
y - c(1, 4, 9)
lm(y ~ poly(x, 2, raw = TRUE))


I hope this helps.

Best,
Dimitris


Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven

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


- Original Message - 
From: Firas Swidan, PhD [EMAIL PROTECTED]
To: r-help@r-project.org
Sent: Friday, March 07, 2008 9:16 AM
Subject: [R] Puzzling coefficients for linear fitting to polynom


 Hi,

 I can not comprehend the linear fitting results of polynoms. For
 example, given the following data (representing y = x^2):

 x - 1:3
 y - c(1, 4, 9)

 performing a linear fit

 f - lm(y ~ poly(x, 2))

 gives weird coefficients:

 coefficients(f)
 (Intercept) poly(x, 2)1 poly(x, 2)2
  4.667   5.6568542   0.8164966

 However the fitted() result makes sense:

 fitted(f)
 1 2 3
 1 4 9

 This is very confusing. How should one understand the result of
 coefficients()?

 Thanks for any tips,
 Firas.

 -- 
 Firas Swidan, PhD
 Founder and CEO
 Olymons: Blessing Machines with Vision (TM)
 http://www.olymons.com
 P.O.Box 8125
 Nazareth 16480
 Israel
 Cell: +.972.(0)54.733.1788

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Puzzling coefficients for linear fitting to polynom

2008-03-07 Thread Bill.Venables
It does help if you read the help information for poly.

 ?poly
 x - 1:3
 y - c(1, 4, 9)
 f - lm(y ~ poly(x, 2, raw = TRUE))  ## note raw = TRUE
 coef(f)
 (Intercept) poly(x, 2, raw = TRUE)1 poly(x, 2, raw = TRUE)2 
   0   0   1 
  

You were assuming a power basis for the polynomial, 1, x, x^2.  If you
want to use that you must declare that using raw = TRUE.  The default is
to use an orthogonal polynomial basis, and you can expect the
coefficients relative to that to be, well, puzzling.

Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile: +61 4 8819 4402
Home Phone: +61 7 3286 7700
mailto:[EMAIL PROTECTED]
http://www.cmis.csiro.au/bill.venables/ 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Firas Swidan, PhD
Sent: Friday, 7 March 2008 6:16 PM
To: r-help@r-project.org
Subject: [R] Puzzling coefficients for linear fitting to polynom

Hi,

I can not comprehend the linear fitting results of polynoms. For
example, given the following data (representing y = x^2):

 x - 1:3
 y - c(1, 4, 9)

performing a linear fit

 f - lm(y ~ poly(x, 2))

gives weird coefficients:

 coefficients(f)
(Intercept) poly(x, 2)1 poly(x, 2)2 
  4.667   5.6568542   0.8164966 

However the fitted() result makes sense:

 fitted(f)
1 2 3 
1 4 9 

This is very confusing. How should one understand the result of
coefficients()?

Thanks for any tips,
Firas.

-- 
Firas Swidan, PhD
Founder and CEO
Olymons: Blessing Machines with Vision (TM)
http://www.olymons.com
P.O.Box 8125
Nazareth 16480
Israel
Cell: +.972.(0)54.733.1788

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Re action Time and Time Series Analysis

2008-03-07 Thread nathan3073

Dear,
I need to analyse reaction time.

The general idea might be described as this: There are 8x8 circles. My
program light a circle at one time. The subject then click the lighted
circled as fast as possible. After the correct circle is clicked, then the
next circle will be lighted for the subject to click on, and so on.

My questions are:
1. May I use Time Series Analysis? I read that Time Series may be used only
for data with regular measurement interval. Can my experiment be considered
as regularly measured?


Let's assume there are 30 subjects. Each has 330 measured reaction time. I
then plot the response time as time series.
2. I need to know if the plots can be classified to groups with different
characteristic. That is, I want to check whether there is model (or models)
my plots follow. I've read about ARIMA or somekind of model fitting but have
no idea about the general concept. Would someone give me some insight?? How
to do that with R-Language?


Just for additional request, might I know some paper that use time series
for analyzing reaction time? I've searched with Google for nearly 2 hours
but most of the paper I'm looking for are not free. I would appreciate if I
could get real case study.

Thank you for the help.

regards,
Nathanael Gratias
indonesia
-- 
View this message in context: 
http://www.nabble.com/Reaction-Time-and-Time-Series-Analysis-tp15891094p15891094.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Puzzling coefficients for linear fitting to polynom

2008-03-07 Thread Ted Harding
On 07-Mar-08 08:16:06, Firas Swidan, PhD wrote:
 Hi,
 I can not comprehend the linear fitting results of polynoms.
 For example, given the following data (representing y = x^2):
 
 x - 1:3
 y - c(1, 4, 9)
 
 performing a linear fit
 
 f - lm(y ~ poly(x, 2))
 
 gives weird coefficients:
 
 coefficients(f)
 (Intercept) poly(x, 2)1 poly(x, 2)2 
   4.667   5.6568542   0.8164966 
 
 However the fitted() result makes sense:
 
 fitted(f)
 1 2 3 
 1 4 9 
 
 This is very confusing. How should one understand the result of
 coefficients()?
 
 Thanks for any tips,
 Firas.

Have a look at the values returned by poly(x,2).
The coefficients you are getting are the results of fitting

  y = a + b1*poly(x,2)[,1] + b2*poly(x,2)[,2]

where

  poly(x, 2)[,1]
# [1] -7.071068e-01 -9.073264e-17  7.071068e-01
  poly(x, 2)[,2]
# [1]  0.4082483 -0.8164966  0.4082483

which is probably not what you may have thought you were doing!

It is certainly not the same as fitting

  y = a + b1*x + b2*(x^2)

though of course the fitted values will be the same.

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 07-Mar-08   Time: 08:40:46
-- XFMail --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Puzzling coefficients for linear fitting to polynom

2008-03-07 Thread Firas Swidan, PhD
Thanks for the clarifications. It seems the confusion resulted from
making one assumption more than necessary regarding the behavior of
poly().

Best wishes,
Firas.

On Fri, 2008-03-07 at 18:33 +1000, [EMAIL PROTECTED] wrote:
 It does help if you read the help information for poly.
 
  ?poly
  x - 1:3
  y - c(1, 4, 9)
  f - lm(y ~ poly(x, 2, raw = TRUE))  ## note raw = TRUE
  coef(f)
  (Intercept) poly(x, 2, raw = TRUE)1 poly(x, 2, raw = TRUE)2 
0   0   1 
   
 
 You were assuming a power basis for the polynomial, 1, x, x^2.  If you
 want to use that you must declare that using raw = TRUE.  The default is
 to use an orthogonal polynomial basis, and you can expect the
 coefficients relative to that to be, well, puzzling.
 
 Bill Venables
 CSIRO Laboratories
 PO Box 120, Cleveland, 4163
 AUSTRALIA
 Office Phone (email preferred): +61 7 3826 7251
 Fax (if absolutely necessary):  +61 7 3826 7304
 Mobile: +61 4 8819 4402
 Home Phone: +61 7 3286 7700
 mailto:[EMAIL PROTECTED]
 http://www.cmis.csiro.au/bill.venables/ 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Firas Swidan, PhD
 Sent: Friday, 7 March 2008 6:16 PM
 To: r-help@r-project.org
 Subject: [R] Puzzling coefficients for linear fitting to polynom
 
 Hi,
 
 I can not comprehend the linear fitting results of polynoms. For
 example, given the following data (representing y = x^2):
 
  x - 1:3
  y - c(1, 4, 9)
 
 performing a linear fit
 
  f - lm(y ~ poly(x, 2))
 
 gives weird coefficients:
 
  coefficients(f)
 (Intercept) poly(x, 2)1 poly(x, 2)2 
   4.667   5.6568542   0.8164966 
 
 However the fitted() result makes sense:
 
  fitted(f)
 1 2 3 
 1 4 9 
 
 This is very confusing. How should one understand the result of
 coefficients()?
 
 Thanks for any tips,
 Firas.
 
-- 
Firas Swidan, PhD
Founder and CEO
Olymons: Blessing Machines with Vision (TM)
http://www.olymons.com
P.O.Box 8125
Nazareth 16480
Israel
Cell: +.972.(0)54.733.1788

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Puzzling coefficients for linear fitting to polynom

2008-03-07 Thread Firas Swidan, PhD
Hi,

I can not comprehend the linear fitting results of polynoms. For
example, given the following data (representing y = x^2):

 x - 1:3
 y - c(1, 4, 9)

performing a linear fit

 f - lm(y ~ poly(x, 2))

gives weird coefficients:

 coefficients(f)
(Intercept) poly(x, 2)1 poly(x, 2)2 
  4.667   5.6568542   0.8164966 

However the fitted() result makes sense:

 fitted(f)
1 2 3 
1 4 9 

This is very confusing. How should one understand the result of
coefficients()?

Thanks for any tips,
Firas.

-- 
Firas Swidan, PhD
Founder and CEO
Olymons: Blessing Machines with Vision (TM)
http://www.olymons.com
P.O.Box 8125
Nazareth 16480
Israel
Cell: +.972.(0)54.733.1788

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re action Time and Time Series Analysis

2008-03-07 Thread Ingmar Visser
Nathanael,

On 7 Mar 2008, at 09:40, nathan3073 wrote:


 Dear,
 I need to analyse reaction time.

 The general idea might be described as this: There are 8x8 circles. My
 program light a circle at one time. The subject then click the lighted
 circled as fast as possible. After the correct circle is clicked,  
 then the
 next circle will be lighted for the subject to click on, and so on.

 My questions are:
 1. May I use Time Series Analysis? I read that Time Series may be  
 used only
 for data with regular measurement interval. Can my experiment be  
 considered
 as regularly measured?

Is the precise timing of new responses expected to influence the RTs?  
If so, the answer
is probably no.

 Let's assume there are 30 subjects. Each has 330 measured reaction  
 time. I
 then plot the response time as time series.
 2. I need to know if the plots can be classified to groups with  
 different
 characteristic.

This sounds like you need some kind of cluster or mixture analysis,  
however 

 That is, I want to check whether there is model (or models)
 my plots follow. I've read about ARIMA or somekind of model fitting  
 but have
 no idea about the general concept. Would someone give me some  
 insight?? How
 to do that with R-Language?

... whether you can do this depends on your specific hypotheses.

Possibly a simple linear model answers most of your questions.

Best, Ingmar

 Just for additional request, might I know some paper that use time  
 series
 for analyzing reaction time? I've searched with Google for nearly 2  
 hours
 but most of the paper I'm looking for are not free. I would  
 appreciate if I
 could get real case study.

 Thank you for the help.

 regards,
 Nathanael Gratias
 indonesia
 -- 
 View this message in context: http://www.nabble.com/Reaction-Time- 
 and-Time-Series-Analysis-tp15891094p15891094.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

Ingmar Visser
Department of Psychology, University of Amsterdam
Roetersstraat 15
1018 WB Amsterdam
The Netherlands
t: +31-20-5256723



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Rpart and bagging - how is it done?

2008-03-07 Thread Prof Brian Ripley
I believe that the procedure you describe at the end (resampling the 
cases) is the original interpretation of bagging, and that using weighting 
is equivalent when a procedure uses case weights.

If you are getting different results when replicating cases and when using 
weights then rpart is not using its weights strictly as case weights and 
it would be preferable to replicate cases.  But I am getting identical 
predictions by the two routes:

ind - sample(1:81, replace=TRUE)
rpart(Kyphosis ~ Age + Number + Start, data=kyphosis[ind,], xval=0)
rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,
   weights=tabulate(ind, nbins=81), xval=0)

My memory is that rpart uses unweighted numbers for its control params 
(unlike tree) and hence is not strictly using case weights.  I believe you 
can avoid that by setting the control params to their minimum and relying 
on pruning.

BTW, it is inaccurate to call these trees 'non-pruned' -- the default
setting of cp is still (potentially) doing quite a lot of pruning.

Torsten Hothorn can explain why he chose to do what he did.  There's a 
small (but only small) computational advantage in using case weights, but 
the tricky issue for me is how precisely tree growth is stopped, and I 
don't think that rpart at its default settings is mimicing what Breiman 
was doing (he would have been growing much larger trees).


On Thu, 6 Mar 2008, [EMAIL PROTECTED] wrote:


 Hi there.

 I was wondering if somebody knows how to perform a bagging procedure on a
 classification tree without running the classifier with weights.

 Let me first explain why I need this and then give some details of what I
 have found out so far.

 I am thinking about implementing the bagging procedure in Matlab.  Matlab
 has a simple classification tree function (in their Statistics toolbox) but
 it does not accept weights.  A modification of the Matlab procedure to
 accommodate weights would be very complicated.

 The rpart function in R accepts weights.  This seems to allow for a rather
 simple implementation of bagging.  In fact Everitt and Hothorn in chapter 8
 of A Handbook of Statistical Analyses Using R describe such a procedure.
 The procedure consists in generating several samples with replacement from
 the original data set.  This data set has N rows.  The implementation
 described in the book first fits a non-pruned tree to the original data
 set.  Then it generates several (say, 25) multinomial samples of size N
 with probabilities 1/N.  Then, each sample is used in turn as the weight
 vector to update the original tree fit.  Finally, all the updated trees are
 combined to produce consensus class predictions.

 Now, a typical realization of a multinomial sample consists of small
 integers and several 0's.  I thought that the way that weighting worked was
 this:  the observations with weights equal to 0 are omitted and the
 observations with weights  1 are essentially replicated according to the
 weight.  So I thought that instead of running the rpart procedure with
 weights, say, starting with (1, 0, 2, 0, 1, ... etc.)  I could simply
 generate a sample data set by retaining row 1, omitting row 2, replicating
 row 3 twice, omitting row 4, retaining row 5, etc.  However, this does not
 seem to work as I expected.  Instead of getting identical trees (from
 running weighted rpart on the original data set and running rpart on the
 sample data set described above with no weighting) I get trees that are
 completely different (different threshold values and different order of
 variables entering the splits).  Moreover,  the predictions from these
 trees can be different so the misclassification rates usually differ.

 This finally brings me to my question - is there a way to mimic the
 workings of the weighting in rpart by, for example, modification of the
 data set or, perhaps, some other means.

 Thanks in advance for your time,

 Andy

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

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interesting remarks about R back in 1999

2008-03-07 Thread francogrex

Hi, yes it's true Mathematica is too expensive (I think one of the most
expensive out there), but yacas has a lng way to go before becoming
mathematica. I agree mathematica is not really for data analysis but I think
it's to help researchers and inventors invent new ideas, understand concepts
etc... However for that there is a cheaper alternative made out of three
components: a pen, a paper and a human brain. The Rlink was available for
free at some point; now it's not even there anymore!


Spencer Graves wrote:
 
   Many people love Mathematica, but it's strength is symbolic 
 mathematics, not data analysis. ..(snipped) 
 ...(snipped) Today, if I wanted symbolic mathematics, I might try Yacas 
 (http://yacas.sourceforge.net/homepage.html -- and the Ryacas package).  
 Mathematica is probably superior to Yacas, but I'd have to be convinced 
 that the difference was sufficient to justify the extra
 expense...(snipped)
 

-- 
View this message in context: 
http://www.nabble.com/Interesting-remarks-about-R-back-in-1999-tp15882515p15891088.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with 'memory not mapped'

2008-03-07 Thread jgarcia
Hi,
I'm no expert programmer at all;
I'm running an R script (mariam1_2.R). This scripts calls another
script, which contains an R function, which .Call some C code.
It runs several times without any problem, but sometimes I get the error:
---
 *** caught segfault ***
address 0x1c404ec8, cause 'memory not mapped'

Traceback:
 1: .Call(rrfunc, as.double(dx), as.integer(nrows), as.integer(ncols),
as.double(deltadt), as.character(binmaps), as.integer(ldd),
as.double(downst),as.integer(outl), as.double(maxinte), as.double(nmn))
 2: rrfuncR(dx, nrows, ncols, delta.t,binmaps.pathed,ldd,downst,
out.index,interc,n.man)
 3: eval.with.vis(expr, envir, enclos)
 4: eval.with.vis(ei, envir)
 5: source(rrprogv1_2.R)
 6: eval.with.vis(expr, envir, enclos)
 7: eval.with.vis(ei, envir)
 8: source(mariam1_2.R)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:
---
I've seen something related in the documentation, but it is not easy to
understand it for me. I'm trying to perform a Monte Carlo analysis that
calls the function iteratively. My question is why sometimes I can call
forty or fifty times the function without any problem, and other times it
crashes at the first, second or 6th time. Can you give me any advice?

Thanks and best regards,
Javier

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] using xyplot with groups and panel.linejoin

2008-03-07 Thread k . m . csillery

Dear All,

I am using xyplot() with many groups like this:

statselect - levels(dat$stat)
xyplot(relmse~T|lambda, groups=stat, data=dat,
   panel = panel.superpose,
   key=simpleKey(statselect, lines=T))

However, I want lines not scatterplots and if I set
panel.groups=panel.linejoin that connects the lines according to the
relmse and not according the consecutive values of T. Is there a short
solution to this very simple problem, which doesn't require custom made
panel function?

Thanks in advance,

Kati

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with 'memory not mapped'

2008-03-07 Thread Ramon Diaz-Uriarte
Dear Javier,

From your description, it seems you are not the author of the C
function rrfunc, which is where the problem is probably located (the
segmentation fault is most likely a pointer related problem where the
C code is trying to do something with memory it should not be trying
to do). Depending on the exact settings of your simulation, the state
of your machine, etc
the problem will show up at one point or another. I'd get in touch
with the author of the C code and let her/him know that there is a
problem in it. Most of these are very quickly located using valgrind.
Search on the archives and the manual (Writing R extensions) but a
call such as

R -d valgrind --tool=memcheck --leak-check=full
--log-file=marian.valgrind.log --vanilla  mariam1_2.R 
mariam1_2.with.valgrind.Rout

after compiling the C code with the -O1 (not -O2, as per default) flag.

HTH,

R.


On Fri, Mar 7, 2008 at 10:26 AM,  [EMAIL PROTECTED] wrote:
 Hi,
  I'm no expert programmer at all;
  I'm running an R script (mariam1_2.R). This scripts calls another
  script, which contains an R function, which .Call some C code.
  It runs several times without any problem, but sometimes I get the error:
  ---
   *** caught segfault ***
  address 0x1c404ec8, cause 'memory not mapped'

  Traceback:
   1: .Call(rrfunc, as.double(dx), as.integer(nrows), as.integer(ncols),
  as.double(deltadt), as.character(binmaps), as.integer(ldd),
  as.double(downst),as.integer(outl), as.double(maxinte), as.double(nmn))
   2: rrfuncR(dx, nrows, ncols, delta.t,binmaps.pathed,ldd,downst,
  out.index,interc,n.man)
   3: eval.with.vis(expr, envir, enclos)
   4: eval.with.vis(ei, envir)
   5: source(rrprogv1_2.R)
   6: eval.with.vis(expr, envir, enclos)
   7: eval.with.vis(ei, envir)
   8: source(mariam1_2.R)

  Possible actions:
  1: abort (with core dump, if enabled)
  2: normal R exit
  3: exit R without saving workspace
  4: exit R saving workspace
  Selection:
  ---
  I've seen something related in the documentation, but it is not easy to
  understand it for me. I'm trying to perform a Monte Carlo analysis that
  calls the function iteratively. My question is why sometimes I can call
  forty or fifty times the function without any problem, and other times it
  crashes at the first, second or 6th time. Can you give me any advice?

  Thanks and best regards,
  Javier

  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.




-- 
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] legend for several graphics

2008-03-07 Thread Georg Otto
Thanks a lot, John, Gavin; Hadley and Greg, for your helpful comments
and suggestions. I finally achieved what I wanted using the suggested
method from Gavin with corrections from Greg.

Out of curiosity (and interest to learn): Hadley, how would you
simplify that code using lattice or ggplot and how would you
automatically draw the legend?

Best,

Georg



Greg Snow [EMAIL PROTECTED] writes:


 My modification of your example is:

 library(TeachingDemos)
 op - par(mfrow = c(3,3), ## split region
   oma = c(5,0,4,0) + 0.1, ## create outer margin
   mar = c(5,4,2,2) + 0.1) ## shrink some margins 
 plot(1:10, main = a, pch = 1:2, col= 1:2) 
 plot(1:10, main = b, pch = 1:2, col= 1:2) 
 tmp1 - cnvrt.coords( 0.5, 0, input='plt' )$tdev # save location for
 mtext
 plot(1:10, main = c, pch = 1:2, col= 1:2) 
 plot(1:10, main = d, pch = 1:2, col= 1:2) 
 plot(1:10, main = e, pch = 1:2, col= 1:2) 
 plot(1:10, main = f, pch = 1:2, col= 1:2) 
 plot(1:10, main = g, pch = 1:2, col= 1:2) 
 plot(1:10, main = h, pch = 1:2, col= 1:2) 
 plot(1:10, main = i, pch = 1:2, col= 1:2) 
 ## title 
 mtext(My Plots, side = 3, outer = TRUE, font = 2, line = 1, cex = 1.2,

   at=tmp1$x) 
 ## draw legend 
 par(xpd=NA)
 tmp2 - cnvrt.coords( tmp1$x, 0.05, input='tdev' )$usr # get location
 for legend
 legend(tmp2$x, tmp2$y, legend = c(Type 1, Type 2), 
   pch = 1:2, col = 1:2, ncol = 2, xjust=0.5, yjust=0.5)
 par(op)


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error: file association for 'doc\html\index.html' not available or invalid

2008-03-07 Thread Jon Olav Vik
Today HTML help stopped working. The menu command Help  Html help usually 
brings up my default web browser (Opera 9.26), but now R gives the error
Error: file association for 'doc\html\index.html' not available or invalid
If I try the same menu command a second time, R crashes with the message

The instruction at 0x7c9106c3 referenced memory at 0x7c9f4302. The memory 
could not be written.

The same problem occurs when calling help from the command line, e.g. with
 ?license

I'm running R 2.6.2 on Windows XP SP2. Googling for the error turns up nothing, 
and I have no idea where to look for further diagnosis. I have uninstalled, 
deleted the R package directories, and checked the registry for metions of 
\R\, but the problem remains. I can't think of any unusual changes I made 
before this problem arose.

Any help would be appreciated.

Best regards,
Jon Olav Vik

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] Packages micEcon, sampleSelection, and maxLik

2008-03-07 Thread Arne Henningsen
Dear R Users:

We have splitted up the micEcon package into three packages:

a) Package maxLik provides tools for maximum likelihood estimations 
(see http://www.maxLik.org).

b) Package sampleSelection provides tools for estimating Heckman-type sample 
selection/generalized tobit models (see http://www.sampleSelection.org).

c) Package micEcon contains the remainder, i.e. mainly tools for 
microeconomic demand and firm models, e.g. estimating the Almost Ideal 
Demand System or the Symmetric Normalized Quadratic / Symmetric 
Generalized McFadden profit function (see http://www.micEcon.org).

All these packages are available for download from CRAN and from their 
websites (see above).

Any comments and suggestions on these packages are welcome!
Ott  Arne

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
[EMAIL PROTECTED]
http://www.uni-kiel.de/agrarpol/ahenningsen/

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using xyplot with groups and panel.linejoin

2008-03-07 Thread Dieter Menne
 k.m.csillery at sms.ed.ac.uk writes:

 I am using xyplot() with many groups like this:
 
 statselect - levels(dat$stat)
 xyplot(relmse~T|lambda, groups=stat, data=dat,
panel = panel.superpose,
key=simpleKey(statselect, lines=T))
 

Add lty=l. And remove the panel=panel.superpose, it's the default when groups
are given.

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Passing function to tapply as a string

2008-03-07 Thread Yuri Volchik

Hi,

Was wondering if it is possible to pass function name as a parameter, smth
along this line

param.to.pass-c(1,'max','h')

dd-function(dfd, param=param.to.pass,...){
  ttime.int - format(ttime,fmt)
  data.frame(
 param[3] = tapply(dfd[,param[1]],ttime.int,param[3]),
 ...)
   }


I know there is a as.formula expression but not quite sure if there is some
way to accomplish what i need.
Thanks
-- 
View this message in context: 
http://www.nabble.com/Passing-function-to-tapply-as-a-string-tp15891151p15891151.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Reading microsoft .xls format and openoffice OpenDocument files

2008-03-07 Thread Ajay Shah
1. I have used gdata::read.xls() with much happiness. But every now
   and then it breaks. I have not, as yet, been able to construct a
   mental model about the class of .xls files for which it works. Does
   someone have a simple rule for predicting the circumstances under
   which it will work?

2. Just like there is a read.xls(), it'd be great if we have a
   read.ods() which directly reads files from openoffice. This should
   be easier than grokking Microsoft formats given that openoffice is
   gpl. I hunted a bit and couldn't find any. Does someone know how we
   might approach this?

   Am I correct in thinking that our goal is reading OpenDocument
   files (http://en.wikipedia.org/wiki/OpenDocument) ?

-- 
Ajay Shah  http://www.mayin.org/ajayshah  
[EMAIL PROTECTED] http://ajayshahblog.blogspot.com
*(:-? - wizard who doesn't know the answer.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error: file association for 'doc\html\index.html' not available or invalid

2008-03-07 Thread Prof Brian Ripley
On Fri, 7 Mar 2008, Jon Olav Vik wrote:

 Today HTML help stopped working. The menu command Help  Html help usually
 brings up my default web browser (Opera 9.26), but now R gives the error
 Error: file association for 'doc\html\index.html' not available or invalid
 If I try the same menu command a second time, R crashes with the message

 The instruction at 0x7c9106c3 referenced memory at 0x7c9f4302. The memory
 could not be written.

 The same problem occurs when calling help from the command line, e.g. with
 ?license

 I'm running R 2.6.2 on Windows XP SP2. Googling for the error turns up 
 nothing,
 and I have no idea where to look for further diagnosis. I have uninstalled,
 deleted the R package directories, and checked the registry for metions of
 \R\, but the problem remains. I can't think of any unusual changes I made
 before this problem arose.

Try re-setting the file association for .html files -- it looks as if it 
has been corrupted (not by R).

-- 
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] dictionary lookup

2008-03-07 Thread Thomas Manke
Duncan Murdoch wrote:
 On 06/03/2008 6:45 PM, Thomas Manke wrote:
 Hi,

 I have a character-valued vector (old_names) and want to translate
 its entries whenever possible,  using a dictionary (dict=data.frame).
 The translation direction is dict$V3 -- dict$V2, but
 some values may be undefined (NA). I suppose this is a very basic
 task, but I tried in vain to make it more efficient than below.
 In particular I would like to avoid the explicit (and slow) loop
 Any help is very much welcome.
 Thank you, TM
 
 new_names = old_names
 m = match(old_names, dict$V3)
 N = length(old_names)
 for (i in 1:N) {
  if (is.na(m[i])) { next ; }

  nn = as.vector(dict$V2)[m[i]];
 if (nn ==  ) { next; }

 new_names[i] = nn
 }

 You can vectorize this and it should be fast.  Here's a 
 straightforward replacement for the loop.  It keeps the first 2 lines, 
 and replaces the rest with two more:

 new_names - old_names
 m - match(old_names, dict$V3)

 change - !is.na(m)
 new_names[change] - dict$V2[m[change]]

 Duncan Murdoch
Thank you all for your responses, it certainly pointed me to the right 
direction.
For my purposes, I only had to slightly modify Duncan's suggestion

new_names - rownames(E)
m - match(rownames(E), dict$V3)
change - ( !is.na(m)  dict$V2[m] != )  
new_names[change] - as.vector(dict$V2[m[change]] )

Best wishes, TM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Passing function to tapply as a string

2008-03-07 Thread Henrique Dallazuanna
Yes,

tapply(rnorm(100), gl(5,20), max)

On 07/03/2008, Yuri Volchik [EMAIL PROTECTED] wrote:

  Hi,

  Was wondering if it is possible to pass function name as a parameter, smth
  along this line

  param.to.pass-c(1,'max','h')

  dd-function(dfd, param=param.to.pass,...){
   ttime.int - format(ttime,fmt)
   data.frame(
  param[3] = tapply(dfd[,param[1]],ttime.int,param[3]),
  ...)
}


  I know there is a as.formula expression but not quite sure if there is some
  way to accomplish what i need.
  Thanks
  --
  View this message in context: 
 http://www.nabble.com/Passing-function-to-tapply-as-a-string-tp15891151p15891151.html
  Sent from the R help mailing list archive at Nabble.com.

  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with 'memory not mapped'

2008-03-07 Thread jgarcia
Dear Ramon,
I'm afraid I'm the author of the C function. Although I'm not a 'real'
programmer I need to do some programming in my research work.
As you say, I've used MAKEFLAGS=CFLAGS=-O1, and valgrind, with the
expression you've said.

The content of the log file contains three blocks of the type:
-
==6464== Invalid read of size 8
==6464==at 0x401433E: (within /lib64/ld-2.6.1.so)
==6464==by 0x4009631: (within /lib64/ld-2.6.1.so)
==6464==by 0x5CAA804: (within /lib64/libc-2.6.1.so)
==6464==by 0x59B0143: (within /lib64/libdl-2.6.1.so)
==6464==by 0x400C8E5: (within /lib64/ld-2.6.1.so)
==6464==by 0x59B036C: (within /lib64/libdl-2.6.1.so)
==6464==by 0x59B00F9: dlsym (in /lib64/libdl-2.6.1.so)
==6464==by 0x54F60C: R_local_dlsym (dynload.c:214)
==6464==by 0x4172F8: AddDLL (Rdynload.c:565)
==6464==by 0x4179F3: do_dynload (Rdynload.c:895)
==6464==by 0x4C3A44: do_internal (names.c:1120)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==  Address 0x64A7608 is 24 bytes inside a block of size 27 alloc'd
==6464==at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x4172CC: AddDLL (Rdynload.c:557)
==6464==by 0x4179F3: do_dynload (Rdynload.c:895)
==6464==by 0x4C3A44: do_internal (names.c:1120)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==by 0x495C87: Rf_eval (eval.c:507)
==6464==by 0x4B4C04: Rf_ReplIteration (main.c:263)
==6464==by 0x4B4EB7: R_ReplConsole (main.c:312)
==6464==by 0x4B518F: run_Rmainloop (main.c:975)
==6464==by 0x414AF7: main (Rmain.c:35)
--

and after a lot of block of the type 'uninitialised value', it finishes
like this:

-
==6464== Conditional jump or move depends on uninitialised value(s)
==6464==at 0x5BF324C: (within /lib64/libc-2.6.1.so)
==6464==by 0x5BFB8FA: __printf_fp (in /lib64/libc-2.6.1.so)
==6464==by 0x5BF5587: vfprintf (in /lib64/libc-2.6.1.so)
==6464==by 0x5BFE509: printf (in /lib64/libc-2.6.1.so)
==6464==by 0x88ACE24: rainfallrunoffmodel (rain_runoff_modelv1_2.c:517)
==6464==by 0x4750D1: do_dotcall (dotcode.c:1136)
==6464==by 0x495F36: Rf_eval (eval.c:489)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==by 0x495C87: Rf_eval (eval.c:507)
==6464==by 0x499B6E: do_set (eval.c:1407)
==6464==
==6464== Invalid write of size 8
==6464==at 0x88AD228: rainfallrunoffmodel (rain_runoff_modelv1_2.c:595)
==6464==by 0x4750D1: do_dotcall (dotcode.c:1136)
==6464==by 0x495F36: Rf_eval (eval.c:489)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==by 0x495C87: Rf_eval (eval.c:507)
==6464==by 0x499B6E: do_set (eval.c:1407)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x49938D: do_for (eval.c:1058)
==6464==  Address 0x26C7E9E0 is not stack'd, malloc'd or (recently) free'd
==6464==
==6464== Syscall param write(buf) points to uninitialised byte(s)
==6464==at 0x5C6AC40: write (in /lib64/libc-2.6.1.so)
==6464==  Address 0x402A3DB is not stack'd, malloc'd or (recently) free'd
==6464==
==6464== ERROR SUMMARY: 35923 errors from 210 contexts (suppressed: 244
from 3)
==6464== malloc/free: in use at exit: 284,245,283 bytes in 14,390 blocks.
==6464== malloc/free: 89,306 allocs, 74,916 frees, 1,051,054,834 bytes
allocated.
==6464== For counts of detected errors, rerun with: -v
==6464== searching for pointers to 14,390 not-freed blocks.
==6464== checked 141,122,600 bytes.
==6464==
==6464==
==6464== 64 bytes in 16 blocks are definitely lost in loss record 12 of 54
==6464==at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x4C21D80: realloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x51BE04: parse_expression (regex.c:5205)
==6464==by 0x51BFF3: parse_branch (regex.c:4715)
==6464==by 0x51C07F: parse_reg_exp (regex.c:4667)
==6464==by 0x51C9A6: Rf_regcomp (regex.c:4636)
==6464==by 0x43BD06: do_gsub (character.c:1222)
==6464==by 0x4C3A44: do_internal (names.c:1120)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x49698F: do_begin (eval.c:1159)
==6464==by 0x495D65: Rf_eval (eval.c:463)
==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
==6464==
==6464==
==6464== 87 bytes in 2 blocks are definitely lost in loss record 13 of 54
==6464==at 0x4C21D06: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==6464==by 0x8AD7DBE: G_strdup (strings.c:195)
==6464==by 0x8AD5A78: G_site_get_head (sites.c:818)
==6464==by 0x8AD6808: sitesget (sitesget.c:66)
==6464==by 0x47757D: do_dotcall (dotcode.c:868)
==6464==by 

[R] How to navigate in layout() created graph?

2008-03-07 Thread Rainer M Krug
Hi

I created a complex layout with using layout() and it looks exactly as
I need it. But I don't want to print in the order in which the
subfigure are numbered, but in a different order.

How can I navigate in the layout so that I can specify the subfigure
in which to plot?

At the moment I am using a function which is converting the number to
mfg parameter for par, but it does not seem to work as expected.

Thanks,

Rainer



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

Plant Conservation Unit Department of Botany
University of Cape Town
Rondebosch 7701
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to plot raster obtained from readRAST6 in grey scale?

2008-03-07 Thread Rainer M Krug
Hi

I have a raster which I would like to plot in a greyscale instead of
colour. Is this possible, and how?

Thanks

Rainer

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

Plant Conservation Unit Department of Botany
University of Cape Town
Rondebosch 7701
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error

2008-03-07 Thread Carla Rebelo
Hello!

I need some help, because I don't know how this error means: Error: 
variables ‘Output1’, ‘Output2’, ‘Output3’, ‘Output4’, ‘Output5’ were 
specified with different types from the fit
Execution halted

Can you help me?
Thank You

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with 'memory not mapped'

2008-03-07 Thread Ramon Diaz-Uriarte
Dear Javier,



On Fri, Mar 7, 2008 at 1:09 PM,  [EMAIL PROTECTED] wrote:
 Dear Ramon,
  I'm afraid I'm the author of the C function. Although I'm not a 'real'

Oh, oh... that's too bad. There is not anyone else to blame, then :-).


  programmer I need to do some programming in my research work.
  As you say, I've used MAKEFLAGS=CFLAGS=-O1, and valgrind, with the
  expression you've said.


When looking at the valgrind output, search for lines where your
library is mentioned (rain_runoff_modelv ?). Ignore everything else
about libraries that are not your own (e.g., system or R). Just stick
to the issues that relate to your code.

From the output you've sent, there is Conditional jump or move
depends on uninitialised value(s) on

==6464==by 0x88ACE24: rainfallrunoffmodel (rain_runoff_modelv1_2.c:517)

but more worrisome than that (and I think the immediate cause of the
segfault) is:

  ==6464== Invalid write of size 8
  ==6464==at 0x88AD228: rainfallrunoffmodel (rain_runoff_modelv1_2.c:595)

so it seems your code is trying to write to a place it shouldn't.

Depending on when, what, and to where exactly it is trying to write,
your code will crash sooner or later.


HTH,


R.





  The content of the log file contains three blocks of the type:
  -
  ==6464== Invalid read of size 8
  ==6464==at 0x401433E: (within /lib64/ld-2.6.1.so)
  ==6464==by 0x4009631: (within /lib64/ld-2.6.1.so)
  ==6464==by 0x5CAA804: (within /lib64/libc-2.6.1.so)
  ==6464==by 0x59B0143: (within /lib64/libdl-2.6.1.so)
  ==6464==by 0x400C8E5: (within /lib64/ld-2.6.1.so)
  ==6464==by 0x59B036C: (within /lib64/libdl-2.6.1.so)
  ==6464==by 0x59B00F9: dlsym (in /lib64/libdl-2.6.1.so)
  ==6464==by 0x54F60C: R_local_dlsym (dynload.c:214)
  ==6464==by 0x4172F8: AddDLL (Rdynload.c:565)
  ==6464==by 0x4179F3: do_dynload (Rdynload.c:895)
  ==6464==by 0x4C3A44: do_internal (names.c:1120)
  ==6464==by 0x495D65: Rf_eval (eval.c:463)
  ==6464==  Address 0x64A7608 is 24 bytes inside a block of size 27 alloc'd
  ==6464==at 0x4C21D06: malloc (in
  /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
  ==6464==by 0x4172CC: AddDLL (Rdynload.c:557)
  ==6464==by 0x4179F3: do_dynload (Rdynload.c:895)
  ==6464==by 0x4C3A44: do_internal (names.c:1120)
  ==6464==by 0x495D65: Rf_eval (eval.c:463)
  ==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
  ==6464==by 0x495C87: Rf_eval (eval.c:507)
  ==6464==by 0x4B4C04: Rf_ReplIteration (main.c:263)
  ==6464==by 0x4B4EB7: R_ReplConsole (main.c:312)
  ==6464==by 0x4B518F: run_Rmainloop (main.c:975)
  ==6464==by 0x414AF7: main (Rmain.c:35)
  --

  and after a lot of block of the type 'uninitialised value', it finishes
  like this:

  -
  ==6464== Conditional jump or move depends on uninitialised value(s)
  ==6464==at 0x5BF324C: (within /lib64/libc-2.6.1.so)
  ==6464==by 0x5BFB8FA: __printf_fp (in /lib64/libc-2.6.1.so)
  ==6464==by 0x5BF5587: vfprintf (in /lib64/libc-2.6.1.so)
  ==6464==by 0x5BFE509: printf (in /lib64/libc-2.6.1.so)
  ==6464==by 0x88ACE24: rainfallrunoffmodel (rain_runoff_modelv1_2.c:517)
  ==6464==by 0x4750D1: do_dotcall (dotcode.c:1136)
  ==6464==by 0x495F36: Rf_eval (eval.c:489)
  ==6464==by 0x49698F: do_begin (eval.c:1159)
  ==6464==by 0x495D65: Rf_eval (eval.c:463)
  ==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
  ==6464==by 0x495C87: Rf_eval (eval.c:507)
  ==6464==by 0x499B6E: do_set (eval.c:1407)
  ==6464==
  ==6464== Invalid write of size 8
  ==6464==at 0x88AD228: rainfallrunoffmodel (rain_runoff_modelv1_2.c:595)
  ==6464==by 0x4750D1: do_dotcall (dotcode.c:1136)
  ==6464==by 0x495F36: Rf_eval (eval.c:489)
  ==6464==by 0x49698F: do_begin (eval.c:1159)
  ==6464==by 0x495D65: Rf_eval (eval.c:463)
  ==6464==by 0x497CEB: Rf_applyClosure (eval.c:669)
  ==6464==by 0x495C87: Rf_eval (eval.c:507)
  ==6464==by 0x499B6E: do_set (eval.c:1407)
  ==6464==by 0x495D65: Rf_eval (eval.c:463)
  ==6464==by 0x49698F: do_begin (eval.c:1159)
  ==6464==by 0x495D65: Rf_eval (eval.c:463)
  ==6464==by 0x49938D: do_for (eval.c:1058)
  ==6464==  Address 0x26C7E9E0 is not stack'd, malloc'd or (recently) free'd
  ==6464==
  ==6464== Syscall param write(buf) points to uninitialised byte(s)
  ==6464==at 0x5C6AC40: write (in /lib64/libc-2.6.1.so)
  ==6464==  Address 0x402A3DB is not stack'd, malloc'd or (recently) free'd
  ==6464==
  ==6464== ERROR SUMMARY: 35923 errors from 210 contexts (suppressed: 244
  from 3)
  ==6464== malloc/free: in use at exit: 284,245,283 bytes in 14,390 blocks.
  ==6464== malloc/free: 89,306 allocs, 74,916 frees, 1,051,054,834 bytes
  allocated.
  ==6464== For counts of detected errors, rerun with: -v
  ==6464== searching for pointers to 14,390 not-freed blocks.
  ==6464== checked 141,122,600 bytes.
  ==6464==
  ==6464==
  ==6464== 64 bytes in 16 blocks are definitely lost in loss record 

Re: [R] How to navigate in layout() created graph?

2008-03-07 Thread Charilaos Skiadas
On Mar 7, 2008, at 7:18 AM, Rainer M Krug wrote:

 Hi

 I created a complex layout with using layout() and it looks exactly as
 I need it. But I don't want to print in the order in which the
 subfigure are numbered, but in a different order.

 How can I navigate in the layout so that I can specify the subfigure
 in which to plot?

 At the moment I am using a function which is converting the number to
 mfg parameter for par, but it does not seem to work as expected.

 Thanks,

 Rainer


Look at documentation of ?layout. The mat argument determines the  
order in which the figures appear. The example code that talks about  
scatterplot with marginal histograms should show you how that works.

In other words, to the best of my knowledge, you specify in the call  
to layout in which order the new figures you create will be filling  
the layout.


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

 Plant Conservation Unit Department of Botany
 University of Cape Town
 Rondebosch 7701
 South Africa

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to navigate in layout() created graph?

2008-03-07 Thread Rainer M Krug
On 07/03/2008, Charilaos Skiadas [EMAIL PROTECTED] wrote:
 On Mar 7, 2008, at 7:18 AM, Rainer M Krug wrote:

   Hi
  
   I created a complex layout with using layout() and it looks exactly as
   I need it. But I don't want to print in the order in which the
   subfigure are numbered, but in a different order.
  
   How can I navigate in the layout so that I can specify the subfigure
   in which to plot?
  
   At the moment I am using a function which is converting the number to
   mfg parameter for par, but it does not seem to work as expected.
  
   Thanks,
  
   Rainer
  


 Look at documentation of ?layout. The mat argument determines the
  order in which the figures appear. The example code that talks about
  scatterplot with marginal histograms should show you how that works.

  In other words, to the best of my knowledge, you specify in the call
  to layout in which order the new figures you create will be filling
  the layout.

Yes - I know that I can define the order when I call layout(mat=...,
...), but is there any way that I can skip one when plotting and
return to plot that one later? (e.g. plot subfigure 1, then 3 and
finally 2)



  
   --
   Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)
  
   Plant Conservation Unit Department of Botany
   University of Cape Town
   Rondebosch 7701
   South Africa


 Haris Skiadas
  Department of Mathematics and Computer Science
  Hanover College







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

Plant Conservation Unit Department of Botany
University of Cape Town
Rondebosch 7701
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] training svm

2008-03-07 Thread Charilaos Skiadas
On Mar 7, 2008, at 2:17 AM, Oldrich Kruza wrote:

 Hello Soumyadeep,

 if you store the data in a tabular file, then I suggest using standard
 text-editing tools like cut (say your file is called data.csv, fields
 are separated with commas and you want to get rid of the third and
 sixth column):

 $ cut --complement --delimiter=, --fields=3,6  data.csv   
 data_cut.csv

 If you're not in an Unix environment but have perl, then you may use a
 script like:

  open SRC, data.csv or die(couldn't open source);
  open DST, data_cut.csv or die(couldn't open destination);
  while (SRC) {
  chomp;
  @fields = split /,/;#substitute the comma for the  
 delimiter you use
  splice @fields, 2, 1;#get rid of third column (they're
 zero-based, thus 2 instead of 3)
  splice @fields, 5, 1;#get rid of sixth column
  print DST join(,, @fields), \n;
  }

 If you need to do the selection within R, then you can do it by
 indexing the data structure. Suppose you have the data in a data.frame
 called data. Then:

 data - data[,-6]
 data - data[,-3]

 might do the trick (but since I'm not much of an R hacker, this is
 without guarantee). I think it might be better however to do the
 preprocessing before the data get into R because then you avoid
 loading the columns to discard into memory.

I am guessing that the data is already in R, so it should be easier  
to do it in R, especially if he doesn't know which columns are the  
ones with all identical values. For instance, suppose the data set is  
called x. Then the following would return TRUE for the columns that  
have all values the same:

allsame - sapply(x,function(y) length(table(y))==1)

and then the following will take them out

newdata - x[,!allsame]

 Hope this helps
 ~ Oldrich

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error

2008-03-07 Thread Richard . Cotton
 I need some help, because I don't know how this error means: Error: 
 variables ?Output1?, ?Output2?, ?Output3?, ?Output4?, ?Output5? were 
 specified with different types from the fit
 Execution halted
 
 Can you help me?
No!

Please read the posting guide at 
http://www.R-project.org/posting-guide.html
Please give a reproducible example that tells us exactly what you were 
doing when you got the error message (and give a subject that is more 
informative than 'Error').

Regards,
Richie.

Mathematical Sciences Unit
HSL


ATTENTION:

This message contains privileged and confidential inform...{{dropped:21}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to navigate in layout() created graph?

2008-03-07 Thread Charilaos Skiadas
On Mar 7, 2008, at 8:02 AM, Rainer M Krug wrote:

 On 07/03/2008, Charilaos Skiadas [EMAIL PROTECTED] wrote:
 On Mar 7, 2008, at 7:18 AM, Rainer M Krug wrote:

 Hi

 I created a complex layout with using layout() and it looks  
 exactly as
 I need it. But I don't want to print in the order in which the
 subfigure are numbered, but in a different order.

 How can I navigate in the layout so that I can specify the subfigure
 in which to plot?

 At the moment I am using a function which is converting the  
 number to
 mfg parameter for par, but it does not seem to work as expected.

 Thanks,

 Rainer



 Look at documentation of ?layout. The mat argument determines the
  order in which the figures appear. The example code that talks about
  scatterplot with marginal histograms should show you how that works.

  In other words, to the best of my knowledge, you specify in the call
  to layout in which order the new figures you create will be filling
  the layout.

 Yes - I know that I can define the order when I call layout(mat=...,
 ...), but is there any way that I can skip one when plotting and
 return to plot that one later? (e.g. plot subfigure 1, then 3 and
 finally 2)

Only if you number them in the right order. You might have better  
luck using split.screen, and the associated screen command, for  
what you are trying to do.

I'm not sure I understand it, why don't you want to just number the  
subfigures in the order in which you will draw them?




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

 Plant Conservation Unit Department of Botany
 University of Cape Town
 Rondebosch 7701
 South Africa


 Haris Skiadas
  Department of Mathematics and Computer Science
  Hanover College


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

 Plant Conservation Unit Department of Botany
 University of Cape Town
 Rondebosch 7701
 South Africa

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Rpart and bagging - how is it done?

2008-03-07 Thread Torsten Hothorn

On Fri, 7 Mar 2008, Prof Brian Ripley wrote:

 I believe that the procedure you describe at the end (resampling the cases) 
 is the original interpretation of bagging, and that using weighting is 
 equivalent when a procedure uses case weights.

 If you are getting different results when replicating cases and when using 
 weights then rpart is not using its weights strictly as case weights and it 
 would be preferable to replicate cases.  But I am getting identical 
 predictions by the two routes:

 ind - sample(1:81, replace=TRUE)
 rpart(Kyphosis ~ Age + Number + Start, data=kyphosis[ind,], xval=0)
 rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,
  weights=tabulate(ind, nbins=81), xval=0)

 My memory is that rpart uses unweighted numbers for its control params 
 (unlike tree) and hence is not strictly using case weights.  I believe you 
 can avoid that by setting the control params to their minimum and relying on 
 pruning.

 BTW, it is inaccurate to call these trees 'non-pruned' -- the default
 setting of cp is still (potentially) doing quite a lot of pruning.

 Torsten Hothorn can explain why he chose to do what he did.  There's a small 
 (but only small) computational advantage in using case weights, but the 
 tricky issue for me is how precisely tree growth is stopped, and I don't 
 think that rpart at its default settings is mimicing what Breiman was doing 
 (he would have been growing much larger trees).


its mainly used to avoid repeated formula parsing and other data 
preprocessing steps everytime a tree is grown (which in my experience can 
be quite a substancial advantage both with respect to speed and memory 
consumption). As Brian said, rpart doesn't really interpret weights as
case weights and thus the example code from the book is not totally 
correct. However, for example, party::ctree accepts case weights.

Best wishes,

Torsten


 On Thu, 6 Mar 2008, [EMAIL PROTECTED] wrote:

 
 Hi there.
 
 I was wondering if somebody knows how to perform a bagging procedure on a
 classification tree without running the classifier with weights.
 
 Let me first explain why I need this and then give some details of what I
 have found out so far.
 
 I am thinking about implementing the bagging procedure in Matlab.  Matlab
 has a simple classification tree function (in their Statistics toolbox) but
 it does not accept weights.  A modification of the Matlab procedure to
 accommodate weights would be very complicated.
 
 The rpart function in R accepts weights.  This seems to allow for a rather
 simple implementation of bagging.  In fact Everitt and Hothorn in chapter 8
 of A Handbook of Statistical Analyses Using R describe such a procedure.
 The procedure consists in generating several samples with replacement from
 the original data set.  This data set has N rows.  The implementation
 described in the book first fits a non-pruned tree to the original data
 set.  Then it generates several (say, 25) multinomial samples of size N
 with probabilities 1/N.  Then, each sample is used in turn as the weight
 vector to update the original tree fit.  Finally, all the updated trees are
 combined to produce consensus class predictions.
 
 Now, a typical realization of a multinomial sample consists of small
 integers and several 0's.  I thought that the way that weighting worked was
 this:  the observations with weights equal to 0 are omitted and the
 observations with weights  1 are essentially replicated according to the
 weight.  So I thought that instead of running the rpart procedure with
 weights, say, starting with (1, 0, 2, 0, 1, ... etc.)  I could simply
 generate a sample data set by retaining row 1, omitting row 2, replicating
 row 3 twice, omitting row 4, retaining row 5, etc.  However, this does not
 seem to work as I expected.  Instead of getting identical trees (from
 running weighted rpart on the original data set and running rpart on the
 sample data set described above with no weighting) I get trees that are
 completely different (different threshold values and different order of
 variables entering the splits).  Moreover,  the predictions from these
 trees can be different so the misclassification rates usually differ.
 
 This finally brings me to my question - is there a way to mimic the
 workings of the weighting in rpart by, for example, modification of the
 data set or, perhaps, some other means.
 
 Thanks in advance for your time,
 
 Andy
 
 __
 Andy Jaworski
 518-1-01
 Process Laboratory
 3M Corporate Research Laboratory
 -
 E-mail: [EMAIL PROTECTED]
 Tel:  (651) 733-6092
 Fax:  (651) 736-3122
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of 

Re: [R] Passing function to tapply as a string

2008-03-07 Thread Richard . Cotton
 Was wondering if it is possible to pass function name as a parameter
Yes.  This isn't exactly what you wanted, but it demonstrates the 
principle.

x = rnorm(5)
[1] -0.6510448  0.4591730  1.3225205  1.2314391 -0.0888139

myfun - function(fname, x) eval(parse(text=paste(fname,(x),sep=)))
myfun('max',x)
[1] 1.322521

myfun('min',x)
[1] -0.6510448

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to navigate in layout() created graph?

2008-03-07 Thread Rainer M Krug
On 07/03/2008, Charilaos Skiadas [EMAIL PROTECTED] wrote:
 On Mar 7, 2008, at 8:02 AM, Rainer M Krug wrote:

   On 07/03/2008, Charilaos Skiadas [EMAIL PROTECTED] wrote:
   On Mar 7, 2008, at 7:18 AM, Rainer M Krug wrote:
  
   Hi
  
   I created a complex layout with using layout() and it looks
   exactly as
   I need it. But I don't want to print in the order in which the
   subfigure are numbered, but in a different order.
  
   How can I navigate in the layout so that I can specify the subfigure
   in which to plot?
  
   At the moment I am using a function which is converting the
   number to
   mfg parameter for par, but it does not seem to work as expected.
  
   Thanks,
  
   Rainer
  
  
  
   Look at documentation of ?layout. The mat argument determines the
order in which the figures appear. The example code that talks about
scatterplot with marginal histograms should show you how that works.
  
In other words, to the best of my knowledge, you specify in the call
to layout in which order the new figures you create will be filling
the layout.
  
   Yes - I know that I can define the order when I call layout(mat=...,
   ...), but is there any way that I can skip one when plotting and
   return to plot that one later? (e.g. plot subfigure 1, then 3 and
   finally 2)


 Only if you number them in the right order. You might have better
  luck using split.screen, and the associated screen command, for
  what you are trying to do.

  I'm not sure I understand it, why don't you want to just number the
  subfigures in the order in which you will draw them?

Because i thought it would be easier the other way round? Thanks anyway

Rainer



  
  
  
   --
   Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology
   (UCT)
  
   Plant Conservation Unit Department of Botany
   University of Cape Town
   Rondebosch 7701
   South Africa
  
  
   Haris Skiadas
Department of Mathematics and Computer Science
Hanover College
  
  
   --
   Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)
  
   Plant Conservation Unit Department of Botany
   University of Cape Town
   Rondebosch 7701
   South Africa

  Haris Skiadas
  Department of Mathematics and Computer Science
  Hanover College







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

Plant Conservation Unit Department of Botany
University of Cape Town
Rondebosch 7701
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] LaTeX in R

2008-03-07 Thread Mario Maiworm
Dear Rers,
I understand that I can include R-code in LaTeX using Sweave. Is there a way
to do it the other way round? Particularly, I need some TeX symbols in the
legend of an R-plot. This can be done in matlab easily, so I am optimistic
with R. Any suggestions for a command or package?
Best, 
Mario.


 
__

Mario Maiworm
Biological Psychology and Neuropsychology
University of Hamburg
Von-Melle-Park 11
D-20146 Hamburg

Tel.: +49 40 42838 3515
Fax.: +49 40 42838 6591

http://bpn.uni-hamburg.de/Maiworm_e.html
http://cinacs.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to navigate in layout() created graph?

2008-03-07 Thread Charilaos Skiadas
On Mar 7, 2008, at 8:41 AM, Rainer M Krug wrote:


  I'm not sure I understand it, why don't you want to just number the
  subfigures in the order in which you will draw them?

 Because i thought it would be easier the other way round? Thanks  
 anyway

Yes, I agree it should not be as hard as it is ;). I am guessing  
there might be some technical reasons why layout doesn't make it easy  
to do this.
split.screen is good for that.

 Rainer

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Odp: mean and sd with number of values?

2008-03-07 Thread Petr PIKAL
Hi

Martin Kaffanke [EMAIL PROTECTED] napsal dne 06.03.2008 18:05:03:

 
 Am Donnerstag, den 06.03.2008, 17:47 +0100 schrieb Petr PIKAL:
  Hi
  
  [EMAIL PROTECTED] napsal dne 06.03.2008 17:41:06:
  
   Hi there,
   
   When i do 
   
   mean(fl[1:20], na.rm=T)
  
  e.g.
  
  sum(!is.na(fl[1:20]))
 
 This seems to give me a sum of all the items.
 
 But I'd like to have it per column.
 
  mean(fl[1:20])
aids  angststoerautismus bauchspduekrebs
 prostata 
  -0.7474884  -1.0475500  -0.6267267  NA
 -1.7318179 
 fraudep manndep   hautkrebs herzinfarkt
 leukaemie 
  -1.2919841  -1.5124280  -0.3202036  -0.8246589
 0.7550549 
 lungenkrebs manischdepresiv  magenkrebs  magersucht
 mannmagsucht 
  -1.2451753  -1.9726160   1.4548394  -0.6242250
 NA 
 osteoporose   panik   schizophrenieschlaganfall
 zwangsstoer 
  -1.7974270  NA  -1.8634089  NA
 -1.5056106 
 
  mean(fl[1:20], na.rm=T)
aids  angststoerautismus bauchspduekrebs
 prostata 
  -0.7474884  -1.0475500  -0.6267267   1.2168804
 -1.7318179 
 fraudep manndep   hautkrebs herzinfarkt
 leukaemie 
  -1.2919841  -1.5124280  -0.3202036  -0.8246589
 0.7550549 
 lungenkrebs manischdepresiv  magenkrebs  magersucht
 mannmagsucht 
  -1.2451753  -1.9726160   1.4548394  -0.6242250
 -0.3765245 
 osteoporose   panik   schizophrenieschlaganfall
 zwangsstoer 
  -1.7974270  -1.2328361  -1.8634089  -1.7165059
 -1.5056106 
 
  sum(!is.na(fl[1:20]))
 [1] 892

Then why not compute it across columns either by apply or by colSums

apply(!is.na(fl), 2, sum)
colSums(!is.na(fl))

Regards
Petr


 
 So I'd like to have it like the mean, to see how many data is calculated
 by na.rm=T per column?
 
 Thanks,
 Martin
 [příloha signature.asc odstraněna uživatelem Petr PIKAL/CTCAP] 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] LaTeX in R

2008-03-07 Thread Uwe Ligges


Mario Maiworm wrote:
 Dear Rers,
 I understand that I can include R-code in LaTeX using Sweave. Is there a way
 to do it the other way round? Particularly, I need some TeX symbols in the
 legend of an R-plot. This can be done in matlab easily, so I am optimistic
 with R. Any suggestions for a command or package?

See   ?plotmath

Uwe Ligges




 Best, 
 Mario.
 
 
  
 __
 
 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg
 
 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591
 
 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Error

2008-03-07 Thread Uwe Ligges


Carla Rebelo wrote:
 Hello!
 
 I need some help, because I don't know how this error means: Error: 
 variables ‘Output1’, ‘Output2’, ‘Output3’, ‘Output4’, ‘Output5’ were 
 specified with different types from the fit

Please read the posting guide!
Please tell us at least what produced the error in a reproducable way.

I think you are using predict and the type of Output1, e.g., was a 
different one when estimating the model than when trying to predict from it.

Uwe Ligges

 Execution halted
 
 Can you help me?
 Thank You
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to plot raster obtained from readRAST6 in grey scale?

2008-03-07 Thread Uwe Ligges


Rainer M Krug wrote:
 Hi
 
 I have a raster which I would like to plot in a greyscale instead of
 colour. Is this possible, and how?

Probably, and we may tell you how given you tell us what raster means:

  ?raster
No documentation for 'raster' in specified packages and libraries:
you could try 'help.search(raster)'


Uwe Ligges


 
 Thanks
 
 Rainer


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R code for selecting places spatially and by time

2008-03-07 Thread Ben Bolker
Andrew McFadden Andrew.McFadden at maf.govt.nz writes:

 
 
 Hi all
 
 The code of trying to write relates to selecting properties (given by x
 and y co-ordinates) spatially (distance X from infected properties
 identified by date) over a certain time period.
 
 i.e. what properties are within 3 km from properties infected on
 2008-01-01 over the last 14 days.
 
 Is any one able to give me some clues on how to write code to solve this
 problem.
 
 Some sample data is as follows:
 
 x-rep(c(2660156,2660203,2658165,2659303,2661531,2660914),c(2,2,2,2,1,1)
 )
 y-rep(c(6476767,6475013,6475487,6479659,6477004,6476388),c(2,2,2,2,1,1)
 )
 date-as.character(rep(as.Date(c(2008-01-02,2008-01-17,2008-01-01)
 ,format = %Y-%m-%d),c(4,4,2)))
 cbind(x,y,date)

  This should certainly be possible.  Your description of the
problem isn't entirely clear to me, but here's a first approximation:

dat - data.frame(x,y,date)
## data.frame is better than cbind, it can hold dates and locations

infdate - as.Date(2008-01-01)
infprem - subset(dat,date==infdate)
otherprem - subset(dat,date=infdate)
## or:
elapsed - dat$date-infdate
otherprem - subset(dat,elapsed0  elapsed14)
## I'm not sure this is what you wanted in terms
##  of date restrictions, but you could adjust appropriately
dist - sqrt(outer(infprem$x,otherprem$x,-)^2+
 outer(infprem$y,otherprem$y,-)^2)
 
mindist - apply(dist,2,min)

minval - 1000 ## (I don't know what the units are??)
prem - subset(otherprem,mindistminval)
## or prem - otherprem[mindistminval,]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to do a time-stratified case-crossover analysis for air pollution data?

2008-03-07 Thread Nilsson Fredrik X
Dear Experts,

 

I am trying to do a time-stratified case-crossover analysis on air
pollution data and number of myocardial infarctions. In order to avoid
model selection bias, I started with a simple simulation. 

 

I'm still not sure if my simulation is right. But the results I get from
the ts-case-crossover are much more variable than those from a glm.

 

Is this:

a.  Due to the simple relation of log-rate of mi cases being = alpha
+ beta*pm that the glm results are more precise?
b.  Due to me using method=approximate instead of default exact
in the clogit?
c.  Due to the fact that the approximate method in clogit use
breslow for handling ties and not efron?
d.  Due to that I've misunderstood how to arrange data when doing a
case-crossover, such that there is a way of using exact, that wouldn't
go berserk due to the many ties (see #Berserk script at bottom).
e.  The prize to pay for using a case-crossover analysis?

 

It should perhaps be noted that, because of the absence of individual
data, the exposure to air-pollution (pm10) is assumed to be common to
all individuals on a certain day. 

 

I'd be most grateful for any help and ideas on this matter.

 

Best regards,

 

Fredrik Nilsson, PhD

 

PS. I am aware of the limitations that Whitaker et al. presented in
Environmetrics 2007; 18: 157-171, but tried to use the time-stratified
case-crossover as it could be a simple, but fairly correct way of
doing this type of analysis.

 

Simulation script:

library(survival)

n-2*365

samp-100

ti-1:n

ar1-rnorm(1)

for (i in 2:n){

  ar1[i]-0.2*ar1[i-1]+rnorm(1)

}

 

#old version of air pollution

#pm10-2 + .5*sin(2*pi*ti/365 + 127) + 0.1*ar1

 

startdate-1992-07-01

date1-as.Date(startdate)

dates-date1 + (ti-1)

tyda-weekdays(dates)

tymo-months(dates)

tyyear-as.character(dates)

for (i in 1:n)

{

  ask-tyyear[i]

  tyyear[i]-substr(ask,1,4)

}

 

 

moeff-cumsum(c(1,31,28,31,30,31,30,31,31,30,31,30))

a-as.Date(1994-12-31)

monthnames-months(a+moeff)

tymofa-match(tymo,monthnames)

 

moeff-.5*sin(2*pi*moeff/365 + 127)

 

#new version; to have strictly stationary levels of air-pollution 

#within strata

pm10-2 + .5*moeff[tymofa] + 0.1*ar1

 

#intercept and proportionality to pm10 coefficients of log-rate

al- -2.5

be- 1.4

 

 

qres-numeric(samp)

glmres-qres

gamres-qres

for(q in 1:samp)

{

 

rate-exp(al + be*pm10)

mi-rpois(length(rate),lambda=rate)

 

 

date1-as.Date(startdate)

dates-date1 + (ti-1)

tyda-weekdays(dates)

tymo-months(dates)

tyyear-as.character(dates)

for (i in 1:n)

{

  ask-tyyear[i]

  tyyear[i]-substr(ask,1,4)

}

 

#replicate cases

air-data.frame(mi, tyda, tymo, tyyear, pm10, dates)

air$stratn-as.numeric(strata(air$tyda, air$tymo,air$tyyear))

lest-unique(air$stratn)

 

air$nctrl-0

airbase-air

 

#find the number of controls whithin each stratum

for (i in 1:length(lest))

{

   a-which(air$stratn==lest[i])

   for (j in 1:length(a))

   {

  air$nctrl[a[j]]-sum(air$mi[a[-j]])

   }

}

 

 

#create cases and controls

cami-rep(1,sum(mi))

ctmi-rep(0,sum(air$nctrl))

 

capm-rep(pm10, mi)

ctpm-rep(pm10, air$nctrl)

 

cast-rep(air$stratn, mi)

ctst-rep(air$stratn, air$nctrl)

 

cady-rep(dates, mi)

ctdy-rep(dates, air$nctrl)

 

cases-c(cami, ctmi)

stranu-c(cast, ctst)

days-c(cady, ctdy)

pmva-c(capm, ctpm)

 

air2-data.frame(cases, days, pmva,stranu)

air.cl-clogit(cases~pmva + strata(stranu), method=approximate,
data=air2)

air.glm-glm(mi~pm10, family=poisson, data=air)

#air.gam-gam(mi~s(pm10), family=poisson)

qres[q]-as.numeric(coef(air.cl))

glmres[q]-as.numeric(coef(air.glm)[2])

#gamres[q]-as.numeric(coef(air.gam)[2])

 

}

par(mfrow=c(2,1))

plot(density(qres))

plot(density(glmres))

fivenum(qres)

fivenum(glmres)

 

# Berserk script

# this shows that even for very few cases, my intended way of doing TS
C-C is quite time-consuming.

#

#case-c(5,0,2,1)

#airq-c(10,2,3,3)

#

#nctrl-0*case

#for (i in 1:length(case))

#{

#  nctrl[i]-sum(case[-i])

#}

#

#airca-rep(airq,case) 

#airct-rep(airq,nctrl)

#

#cases-rep(1,sum(case))

#ctrls-rep(0,sum(nctrl))

#

#mi-c(cases,ctrls)

#airq-c(airca,airct)

#a-Sys.time()

#air.cl-clogit(mi~airq)

#b-Sys.time()

#b-a

#a-Sys.time()

#air.cl-clogit(mi~airq, method=approximate)

#b-Sys.time()

#b-a


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-Logo in \LaTeX (Mag. Ferri Leberl)

2008-03-07 Thread Jean lobry
Dear Mag. Ferri Leberl,

I'm using something like:

--- tex.tex ---
\documentclass{article}
\usepackage{graphicx}
\usepackage{fancyvrb}
\newcommand{\Rlogo}{\protect\includegraphics[height=1.8ex,keepaspectratio]{Rlogo.pdf}}
\newcommand{\myinput}[1] {\begin{scriptsize}
   \VerbatimInput[frame=single,label=#1]{#1}
   \end{scriptsize}}
\title{The R logo, \Rlogo, in \LaTeX}
\author{J.R. Lobry}

\begin{document}
\maketitle
\section{Introduction to \Rlogo:}
This is about the \Rlogo~sofware suite\footnote{
\Rlogo~is available at...}.
% include source in final document
\myinput{tex.tex}
\end{document}
--

with:
unix$ pdflatex tex.tex
this is what I get:
http://pbil.univ-lyon1.fr/members/lobry/tmp/tex.pdf

The PDF version of the R-Logo I'm using is here:
http://pbil.univ-lyon1.fr/members/lobry/tmp/Rlogo.pdf

HTH,

Jean
-- 
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to do a time-stratified case-crossover analysis for air pollution data? Unformatted text-version, with an additional note

2008-03-07 Thread Nilsson Fredrik X
Dear Experts,

I am trying to do a time-stratified case-crossover analysis on air pollution 
data and number of myocardial infarctions. In order to avoid model selection 
bias, I started with a simple simulation. 

I'm still not sure if my simulation is right. But the results I get from the 
ts-case-crossover are much more variable than those from a glm.

Is this:
a. Due to the simple relation of log-rate of mi cases being = alpha + beta*pm 
that the glm results are more precise? 
b. Due to me using method=approximate instead of default exact in the 
clogit? 
c. Due to the fact that the approximate method in clogit use breslow for 
handling ties and not efron? 
d. Due to that I've misunderstood how to arrange data when doing a 
case-crossover, such that there is a way of using exact, that wouldn't go 
berserk due to the many ties (see #Berserk script at bottom). 
e. The prize to pay for using a case-crossover analysis? 
f. Or, are my simulation results for glm overly precise due to the positive 
autocorrelation (changed to -0.9 which made the time-stratifed be more precise, 
but not the glm). This note was not in the HTML-version. Sorry for that.

It should perhaps be noted that, because of the absence of individual data, the 
exposure to air-pollution (pm10) is assumed to be common to all individuals on 
a certain day. 

I'd be most grateful for any help and ideas on this matter.

Best regards,

Fredrik Nilsson, PhD

PS. I am aware of the limitations that Whitaker et al. presented in 
Environmetrics 2007; 18: 157-171, but tried to use the time-stratified 
case-crossover as it could be a simple, but fairly correct way of doing this 
type of analysis.

Simulation script:
library(survival)
n-2*365
samp-100
ti-1:n
ar1-rnorm(1)
for (i in 2:n){
  ar1[i]-0.2*ar1[i-1]+rnorm(1)
}

#old version of air pollution
#pm10-2 + .5*sin(2*pi*ti/365 + 127) + 0.1*ar1

startdate-1992-07-01
date1-as.Date(startdate)
dates-date1 + (ti-1)
tyda-weekdays(dates)
tymo-months(dates)
tyyear-as.character(dates)
for (i in 1:n)
{
  ask-tyyear[i]
  tyyear[i]-substr(ask,1,4)
}


moeff-cumsum(c(1,31,28,31,30,31,30,31,31,30,31,30))
a-as.Date(1994-12-31)
monthnames-months(a+moeff)
tymofa-match(tymo,monthnames)

moeff-.5*sin(2*pi*moeff/365 + 127)

#new version; to have strictly stationary levels of air-pollution 
#within strata
pm10-2 + .5*moeff[tymofa] + 0.1*ar1

#intercept and proportionality to pm10 coefficients of log-rate
al- -2.5
be- 1.4


qres-numeric(samp)
glmres-qres
gamres-qres
for(q in 1:samp)
{

rate-exp(al + be*pm10)
mi-rpois(length(rate),lambda=rate)


date1-as.Date(startdate)
dates-date1 + (ti-1)
tyda-weekdays(dates)
tymo-months(dates)
tyyear-as.character(dates)
for (i in 1:n)
{
  ask-tyyear[i]
  tyyear[i]-substr(ask,1,4)
}

#replicate cases
air-data.frame(mi, tyda, tymo, tyyear, pm10, dates)
air$stratn-as.numeric(strata(air$tyda, air$tymo,air$tyyear))
lest-unique(air$stratn)

air$nctrl-0
airbase-air

#find the number of controls whithin each stratum
for (i in 1:length(lest))
{
   a-which(air$stratn==lest[i])
   for (j in 1:length(a))
   {
  air$nctrl[a[j]]-sum(air$mi[a[-j]])
   }
}


#create cases and controls
cami-rep(1,sum(mi))
ctmi-rep(0,sum(air$nctrl))

capm-rep(pm10, mi)
ctpm-rep(pm10, air$nctrl)

cast-rep(air$stratn, mi)
ctst-rep(air$stratn, air$nctrl)

cady-rep(dates, mi)
ctdy-rep(dates, air$nctrl)

cases-c(cami, ctmi)
stranu-c(cast, ctst)
days-c(cady, ctdy)
pmva-c(capm, ctpm)

air2-data.frame(cases, days, pmva,stranu)
air.cl-clogit(cases~pmva + strata(stranu), method=approximate, data=air2)
air.glm-glm(mi~pm10, family=poisson, data=air)
#air.gam-gam(mi~s(pm10), family=poisson)
qres[q]-as.numeric(coef(air.cl))
glmres[q]-as.numeric(coef(air.glm)[2])
#gamres[q]-as.numeric(coef(air.gam)[2])

}
par(mfrow=c(2,1))
plot(density(qres))
plot(density(glmres))
fivenum(qres)
fivenum(glmres)

# Berserk script
# this shows that even for very few cases, my intended way of doing TS C-C is 
quite time-consuming.
#
#case-c(5,0,2,1)
#airq-c(10,2,3,3)
#
#nctrl-0*case
#for (i in 1:length(case))
#{
#  nctrl[i]-sum(case[-i])
#}
#
#airca-rep(airq,case) 
#airct-rep(airq,nctrl)
#
#cases-rep(1,sum(case))
#ctrls-rep(0,sum(nctrl))
#
#mi-c(cases,ctrls)
#airq-c(airca,airct)
#a-Sys.time()
#air.cl-clogit(mi~airq)
#b-Sys.time()
#b-a
#a-Sys.time()
#air.cl-clogit(mi~airq, method=approximate)
#b-Sys.time()
#b-a

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] LaTeX in R

2008-03-07 Thread Mario Maiworm
Thank you, uwe and jeremy. I was actually looking exactly for that! But
something still doesn't work:
I want to plot a symbol in a legend of a plot, lets say \sigma = 2. 2
should be the value of a variable. So, when I try 

mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
legend(x=topright,legend=paste(expression(sigma), = ,mySigma),lty=1)

, the sigma is not plotted as a symbol. This version: 

mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
legend(x=topright,legend=expression(paste(sigma, = ,mySigma)),lty=1)

gives me a 'real' sigma but the mySigma variable is not evaluated. Any
ideas?
Mario.
 
__

Mario Maiworm
Biological Psychology and Neuropsychology
University of Hamburg
Von-Melle-Park 11
D-20146 Hamburg

Tel.: +49 40 42838 3515
Fax.: +49 40 42838 6591

http://bpn.uni-hamburg.de/Maiworm_e.html
http://cinacs.org
__

 -Ursprüngliche Nachricht-
 Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 7. März 2008 15:27
 An: Mario Maiworm
 Cc: r-help@r-project.org
 Betreff: Re: [R] LaTeX in R
 
 
 
 Mario Maiworm wrote:
  Dear Rers,
  I understand that I can include R-code in LaTeX using Sweave. Is there
 a way
  to do it the other way round? Particularly, I need some TeX symbols in
 the
  legend of an R-plot. This can be done in matlab easily, so I am
 optimistic
  with R. Any suggestions for a command or package?
 
 See   ?plotmath
 
 Uwe Ligges
 
 
 
 
  Best,
  Mario.
 
 
 
  __
 
  Mario Maiworm
  Biological Psychology and Neuropsychology
  University of Hamburg
  Von-Melle-Park 11
  D-20146 Hamburg
 
  Tel.: +49 40 42838 3515
  Fax.: +49 40 42838 6591
 
  http://bpn.uni-hamburg.de/Maiworm_e.html
  http://cinacs.org
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
  and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-Logo in \LaTeX (Mag. Ferri Leberl)

2008-03-07 Thread Gabor Csardi
Jean,

this is nice, but 1) the logo is a bitmap, it is ugly if you 
resize it, 2) you don't need a pdf version for pdflatex, it 
handles jpg (and maybe also png as well), so you can 
just use the logos at the R developer site. 

It would be really nice to have a non-bitmap version, though.
If it exists.

Gabor

On Fri, Mar 07, 2008 at 04:08:21PM +0100, Jean lobry wrote:
 Dear Mag. Ferri Leberl,
 
 I'm using something like:
 
 --- tex.tex ---
 \documentclass{article}
 \usepackage{graphicx}
 \usepackage{fancyvrb}
 \newcommand{\Rlogo}{\protect\includegraphics[height=1.8ex,keepaspectratio]{Rlogo.pdf}}
 \newcommand{\myinput}[1] {\begin{scriptsize}
\VerbatimInput[frame=single,label=#1]{#1}
\end{scriptsize}}
 \title{The R logo, \Rlogo, in \LaTeX}
 \author{J.R. Lobry}
 
 \begin{document}
 \maketitle
 \section{Introduction to \Rlogo:}
 This is about the \Rlogo~sofware suite\footnote{
 \Rlogo~is available at...}.
 % include source in final document
 \myinput{tex.tex}
 \end{document}
 --
 
 with:
 unix$ pdflatex tex.tex
 this is what I get:
 http://pbil.univ-lyon1.fr/members/lobry/tmp/tex.pdf
 
 The PDF version of the R-Logo I'm using is here:
 http://pbil.univ-lyon1.fr/members/lobry/tmp/Rlogo.pdf
 
 HTH,
 
 Jean
 -- 
 Jean R. Lobry([EMAIL PROTECTED])
 Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
 43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
 allo  : +33 472 43 27 56 fax: +33 472 43 13 88
 http://pbil.univ-lyon1.fr/members/lobry/
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]UNIL DGM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] boxcox.fit error

2008-03-07 Thread Alexys Herleym Rodriguez Avellaneda
Hi,

Thakns all for your help

I am doing the next in my dataframe tabla, column pend1, because the
Lilliefors (Kolmogorov-Smirnov) test give me a pvalue  alfa. (data no
normal distribution). I need do a transformation with box-cox or
other:


 bc - boxcox.fit(tabla$pend1)
R send to me:
Error in boxcox.fit(tabla$pend1) : Transformation requires positive data

The summary for my data is:
 summary(tabla$pend1)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.
0.012.819.820.227.257.9
 length(tabla$pend1)
[1] 4408

Someone can help me?. What is the error?

Thanks

Alexys H

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] locate the rows in a dataframe with some criteria

2008-03-07 Thread zhihuali

Hi, netters,

This is probably a rookie question but I couldn't find the answer after hours 
of searching and trying.

Suppose there'a a dataframe M:

x y
10   A
13   B
8 A
 11   A

I want to locate the rows where x =10 and y=A. I know how to do it to 
vectors by using 
which, but how to do it with the dataframe?

Thank you very much!


Zhihua Li

_
MSN ÖÐÎÄÍø£¬×îÐÂʱÉÐÉú»î×ÊѶ£¬°×Áì¾Û¼¯ÃÅ»§¡£

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] locate the rows in a dataframe with some criteria

2008-03-07 Thread Charilaos Skiadas
On Mar 7, 2008, at 10:50 AM, zhihuali wrote:


 Hi, netters,

 This is probably a rookie question but I couldn't find the answer  
 after hours of searching and trying.

 Suppose there'a a dataframe M:

 x y
 10   A
 13   B
 8 A
  11   A

 I want to locate the rows where x =10 and y=A. I know how to do  
 it to vectors by using
 which, but how to do it with the dataframe?


Does ?subset do what you want?

 Thank you very much!


 Zhihua Li


Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] locate the rows in a dataframe with some criteria

2008-03-07 Thread N. Lapidus
Hi Zhihua,

M - data.frame (x=c(10, 13, 8, 11), y=c('A', 'B', 'A', 'A'))
which (M$x = 10  M$y == 'A')
# [1] 1 4

Hope it helps,
Nael

2008/3/7 N. Lapidus [EMAIL PROTECTED]:

 Hi Zhihua,

 M - data.frame (x=c(10, 13, 8, 11), y=c('A', 'B', 'A', 'A'))
 which (M$x = 10  M$y == 'A')
 # [1] 1 4

 Hope it helps,
 Nael


 2008/3/7 zhihuali [EMAIL PROTECTED]:

 
  Hi, netters,
 
  This is probably a rookie question but I couldn't find the answer after
  hours of searching and trying.
 
  Suppose there'a a dataframe M:
 
  x y
  10   A
  13   B
  8 A
   11   A
 
  I want to locate the rows where x =10 and y=A. I know how to do it to
  vectors by using
  which, but how to do it with the dataframe?
 
  Thank you very much!
 
 
  Zhihua Li
 
  _
  MSN ÖÐÎÄÍø£¬×îÐÂʱÉÐÉú»î×ÊѶ£¬°×Áì¾Û¼¯ÃÅ»§¡£
 
 [[alternative HTML version deleted]]
 
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] LaTeX in R

2008-03-07 Thread Uwe Ligges
You might want to read
  Ligges, U. (2002): R Help Desk: Automation of Mathematical Annotation 
in Plots. R News 2 (3), 32-34.
with an example at the end that meets your requirements:

(please note that I removed those ugly ;


mySigma[1] - 2
mySigma[2] - 3
plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l')
lines(dnorm(1:10, sd = mySigma[2]), lty = 2)
legend1 - substitute(sigma == myS, list(myS = mySigma[1]))
legend2 - substitute(sigma == myS, list(myS = mySigma[2]))
legend(x = topright, lty = c(1,2),
legend = do.call(expression, list(legend1, legend2)))


Uwe Ligges



Mario Maiworm wrote:
 Finally, this should work for an array of sigmas. I just realized that the
 substitute()-command is not evaluated within a c()-environment :(
 
 mySigma[1] - 2; mySigma[2] - 3;
 plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l') ;
 lines(dnorm(1:10,sd = mySigma[2]),lty = 2);
 legend(x = topright, lty = c(1,2),legend = c(substitute(sigma == myS,
 list(myS = mySigma[1])),substitute(sigma == myS, list(myS = mySigma[2]
 
 Mario.
 
  
 __
 
 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg
 
 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591
 
 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org
 __
 
 -Ursprüngliche Nachricht-
 Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 7. März 2008 16:30
 An: Mario Maiworm
 Cc: r-help@r-project.org
 Betreff: Re: AW: [R] LaTeX in R



 Mario Maiworm wrote:
 Thank you, uwe and jeremy. I was actually looking exactly for that!
 But
 something still doesn't work:
 I want to plot a symbol in a legend of a plot, lets say \sigma = 2.
 2
 should be the value of a variable. So, when I try

 mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
 legend(x=topright,legend=paste(expression(sigma), =
 ,mySigma),lty=1)
 , the sigma is not plotted as a symbol. This version:

 mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
 legend(x=topright,legend=expression(paste(sigma, =
 ,mySigma)),lty=1)
 gives me a 'real' sigma but the mySigma variable is not evaluated. Any
 ideas?
 Yes:


 mySigma - 2
 plot(1:10, dnorm(1:10, sd = mySigma), type='l')
 legend(x = topright, lty = 1,
 legend = substitute(sigma == myS, list(myS = mySigma)))


 Uwe Ligges


 Mario.

 __

 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg

 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591

 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org
 __

 -Ursprüngliche Nachricht-
 Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 7. März 2008 15:27
 An: Mario Maiworm
 Cc: r-help@r-project.org
 Betreff: Re: [R] LaTeX in R



 Mario Maiworm wrote:
 Dear Rers,
 I understand that I can include R-code in LaTeX using Sweave. Is
 there
 a way
 to do it the other way round? Particularly, I need some TeX
 symbols in
 the
 legend of an R-plot. This can be done in matlab easily, so I am
 optimistic
 with R. Any suggestions for a command or package?
 See   ?plotmath

 Uwe Ligges




 Best,
 Mario.



 __

 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg

 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591

 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] polygon shapefile from line edge coordinate list

2008-03-07 Thread Murray Richardson
Hello,

I am looking for advice on a task I am trying to complete.

I have a 4 column dataframe defining the start and end coordinates of 
line edges (from a CGAL alpha shapes function to define concave hulls 
from point clusters).  I would like to create polygon shapefiles from 
these line edges, presumably creating lines first and then polygons.

e.g. columns are:

startX  startY endX endY

where each row represents start and end coordinates of a line segment.

I am new to R spatial packages and I am not sure which one is best 
suited to this task. There seems to be a lot of options, which is great 
but hard to know which one to start with.  Any suggestions on the best 
way to proceed with this?  One further challenge is that the list 
includes line segments defining multiple polygons.

Thanks for any advice.

Murray

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] LaTeX in R

2008-03-07 Thread Sundar Dorai-Raj
Or my personal favorite if the length of mySigma is variable:

mySigma - 2:3
plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l')
lines(dnorm(1:10,sd = mySigma[2]),lty = 2)
leg - as.expression(lapply(mySigma, function(x) bquote(sigma == .(x
legend(x = topright, lty = c(1,2),legend = leg)

Thanks,

--sundar

Uwe Ligges said the following on 3/7/2008 8:15 AM:
 You might want to read
   Ligges, U. (2002): R Help Desk: Automation of Mathematical Annotation 
 in Plots. R News 2 (3), 32-34.
 with an example at the end that meets your requirements:
 
 (please note that I removed those ugly ;
 
 
 mySigma[1] - 2
 mySigma[2] - 3
 plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l')
 lines(dnorm(1:10, sd = mySigma[2]), lty = 2)
 legend1 - substitute(sigma == myS, list(myS = mySigma[1]))
 legend2 - substitute(sigma == myS, list(myS = mySigma[2]))
 legend(x = topright, lty = c(1,2),
 legend = do.call(expression, list(legend1, legend2)))
 
 
 Uwe Ligges
 
 
 
 Mario Maiworm wrote:
 Finally, this should work for an array of sigmas. I just realized that the
 substitute()-command is not evaluated within a c()-environment :(

 mySigma[1] - 2; mySigma[2] - 3;
 plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l') ;
 lines(dnorm(1:10,sd = mySigma[2]),lty = 2);
 legend(x = topright, lty = c(1,2),legend = c(substitute(sigma == myS,
 list(myS = mySigma[1])),substitute(sigma == myS, list(myS = mySigma[2]

 Mario.

  
 __

 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg

 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591

 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org
 __

 -Ursprüngliche Nachricht-
 Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 7. März 2008 16:30
 An: Mario Maiworm
 Cc: r-help@r-project.org
 Betreff: Re: AW: [R] LaTeX in R



 Mario Maiworm wrote:
 Thank you, uwe and jeremy. I was actually looking exactly for that!
 But
 something still doesn't work:
 I want to plot a symbol in a legend of a plot, lets say \sigma = 2.
 2
 should be the value of a variable. So, when I try

 mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
 legend(x=topright,legend=paste(expression(sigma), =
 ,mySigma),lty=1)
 , the sigma is not plotted as a symbol. This version:

 mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
 legend(x=topright,legend=expression(paste(sigma, =
 ,mySigma)),lty=1)
 gives me a 'real' sigma but the mySigma variable is not evaluated. Any
 ideas?
 Yes:


 mySigma - 2
 plot(1:10, dnorm(1:10, sd = mySigma), type='l')
 legend(x = topright, lty = 1,
 legend = substitute(sigma == myS, list(myS = mySigma)))


 Uwe Ligges


 Mario.

 __

 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg

 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591

 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org
 __

 -Ursprüngliche Nachricht-
 Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 7. März 2008 15:27
 An: Mario Maiworm
 Cc: r-help@r-project.org
 Betreff: Re: [R] LaTeX in R



 Mario Maiworm wrote:
 Dear Rers,
 I understand that I can include R-code in LaTeX using Sweave. Is
 there
 a way
 to do it the other way round? Particularly, I need some TeX
 symbols in
 the
 legend of an R-plot. This can be done in matlab easily, so I am
 optimistic
 with R. Any suggestions for a command or package?
 See   ?plotmath

 Uwe Ligges




 Best,
 Mario.



 __

 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg

 Tel.: +49 40 42838 3515
 Fax.: +49 40 42838 6591

 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with Error!

2008-03-07 Thread hoogeebear

Hi,

Can anyone explain the following error??

Error in FUN(newX[, i], ...) : missing observations in cov/cor
In addition: Warning message:
In FUN(newX[, i], ...) : NAs introduced by coercion

svm_modelSAheart1 - svm(x_training, y_training) is the command i am
using.my x/y training are working fine.

If anyone needs more information just let me know!

Hope to hear from someone soon.

Regards. 

-- 
View this message in context: 
http://www.nabble.com/Help-with-Error%21-tp15900037p15900037.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Rpart and bagging - how is it done?

2008-03-07 Thread apjaworski
I would like to thank Brian Ripley and Torsten Hothorn for their quick and
thoughtful responses.

I rerun the example given by Professor Ripley by just starting R and
sourcing the code below and I got slightly different results.  Then I ran
it again setting the random seed before the sample command and I got
identical results a few times.  However, I found the example below that
seems to be a reproducible on my system (Win200 Pro, CoreDuo Xeon about a
year old).   I get the same results in 2.6.2 (patched March 4) and 2.7.0
(version of February 28).  Both were compiled from the tarballs in Cygwin
and up-to-date Rtools with no errors.  I just ran make fullcheck on 2.6.2
and it passes with no problems (just usual stuff - network conectivity
fails due to our firewall and slight numercial differences in a few cases.
The results from the rpart test are attached included at the bottom of this
post.

set.seed(123)
library(rpart)
ind - sample(1:81, replace=TRUE)
rpart(Kyphosis ~ Age + Number + Start, data=kyphosis[ind,], xval=0)
rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,
   weights=tabulate(ind, nbins=81), xval=0)

Here is what I get:

 rpart(Kyphosis ~ Age + Number + Start, data=kyphosis[ind,], xval=0)
n= 81

node), split, n, loss, yval, (yprob)
  * denotes terminal node

1) root 81 14 absent (0.8271605 0.1728395) *
 rpart(Kyphosis ~ Age + Number + Start, data=kyphosis,
+weights=tabulate(ind, nbins=81), xval=0)
n= 81

node), split, n, loss, yval, (yprob)
  * denotes terminal node

 1) root 81 14 absent (0.8271605 0.1728395)
   2) Start=8.5 62  6 absent (0.9062500 0.0937500)
 4) Start=14.5 29  0 absent (1.000 0.000) *
 5) Start 14.5 33  6 absent (0.800 0.200)
  10) Age 55 12  0 absent (1.000 0.000) *
  11) Age=55 21  6 absent (0.600 0.400)
22) Age=111 14  2 absent (0.800 0.200) *
23) Age 111 7  1 present (0.200 0.800) *
   3) Start 8.5 19  8 absent (0.5294118 0.4705882) *

The trees are dramatically different (the first one is just a root).  The
predictions are of course different (the first model predicts all cases as
absent) but the total number of misclassified observations differs by only
1 (17 vs. 16).

Can anyone reproduce this, or is something wrong with my system?

Thanks again,

Andy

PS.  rpart version is 3.1-39

rpart results from make fullcheck

 Testing package rpart 
Massaging examples into 'rpart-Ex.R' ...
Running examples in 'rpart-Ex.R' ...
Running specific tests
  Running `surv_test.R'
  Running `testall.R'
  Comparing `testall.Rout' to `testall.Rout.save' ...127c127
   g2   22.77 to the right, improve=6.8130, (6 missing)
---
   g2   22.76 to the right, improve=6.8130, (6 missing)
159c159
   g2   22.77 to the right, improve=4.8340, (6 missing)
---
   g2   22.76 to the right, improve=4.8340, (6 missing)
193c193
   grade  3.5   to the left,  agree=0.772, adj=0.188, (0 split)
---
   grade  3.5   to the left,  agree=0.772, adj=0.187, (0 split)
199c199
   g2   13.47 to the left,  improve=3.55300, (0 missing)
---
   g2   13.48 to the left,  improve=3.55300, (0 missing)
241c241
  1) root 146 53.420  5.893e-18
---
  1) root 146 53.420 -4.563e-17
275c275
   mean=5.893e-18, MSE=0.3659
---
   mean=-4.563e-17, MSE=0.3659
346c346
   g2   13.47 to the left,  improve=4.238e-02, (3 missing)
---
   g2   13.48 to the left,  improve=4.238e-02, (3 missing)
375c375
   g2   17.91 to the right, improve=0.1271000, (1 missing)
---
   g2   17.92 to the right, improve=0.1271000, (1 missing)
515c515
   g2   13.47 to the left,  improve=1.94600, (3 missing)
---
   g2   13.48 to the left,  improve=1.94600, (3 missing)
555c555
   g2   17.91 to the right, improve=3.122000, (1 missing)
---
   g2   17.92 to the right, improve=3.122000, (1 missing)
647c647
   life70.25 to the right, improve=0.25230, (0 missing)
---
   life70.26 to the right, improve=0.25230, (0 missing)
OK
  Running `usersplits.R'
  Comparing `usersplits.Rout' to `usersplits.Rout.save' ...174c174
 Timing ratio =  3.2
---
 Timing ratio =  5.9
OK

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


   
 Prof Brian Ripley 
 [EMAIL PROTECTED] 
 ac.uk To 
   [EMAIL PROTECTED]  
 03/07/2008 03:11   cc 
 AM[EMAIL PROTECTED]   
   R-help@R-project.org  

Re: [R] R-Logo in \LaTeX

2008-03-07 Thread Jean lobry
Gabor,

  this is nice, but
  1) the logo is a bitmap, it is ugly if you resize it

Sure, it's a bitmap, but the naked eye resolution is only
100 $\mu$m so that a vectorized solution is overkilling
in most common situations IMHO. I have to zoom by a factor
1200% to see some pixellization problems on my screen,
but my eyes are admitedly getting older and older, one more
instance of fortune(75) issue I guess :-(

  2) you don't need a pdf version for pdflatex, it
  handles jpg (and maybe also png as well), so you can
  just use the logos at the R developer site.

Not so sure, I had to convert it a long time ago into a PDF
format for a reason I don't remember. I'm sharing my *.rnw
on a CVS with colleages working under Linux, Unix, Mac and
Windows, so the reason could be that there was a problem
in a given platform. The PDF choice is defensive in the sense
that we are Sweaving with \SweaveOpts{pdf = T, eps = F},
so that including PDF is a pre-condition.

It would be really nice to have a non-bitmap version, though.
If it exists.

There was a not so-old thread about this on R-devel:
http://finzi.psych.upenn.edu/R/R-devel/archive/19448.html

Best,

Jean
-- 
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] LaTeX in R

2008-03-07 Thread Mario Maiworm

I finally got everything plotted as I had planned. So, thank you again.
Sundars suggestion looks more flexible when it comes to large numbers of
categories (i.e. sigmas). In the plot I will be using, there are 3 sigmas...
I am keen to learn about that bquote and substitute stuff. I will definitely
take a look at your newsletter contribution, uwe.
The ';'s were intended to ease the mail2console copy-and-paste, as some mail
programs take control of your linebreaks.
Mario.

__

Mario Maiworm
Biological Psychology and Neuropsychology
University of Hamburg
Von-Melle-Park 11
D-20146 Hamburg

Tel.: +49 40 42838 3515
Fax.: +49 40 42838 6591

http://bpn.uni-hamburg.de/Maiworm_e.html
http://cinacs.org
__

 -Ursprüngliche Nachricht-
 Von: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED]
 Gesendet: Freitag, 7. März 2008 17:22
 An: Uwe Ligges
 Cc: Mario Maiworm; r-help@r-project.org
 Betreff: Re: [R] LaTeX in R
 
 Or my personal favorite if the length of mySigma is variable:
 
 mySigma - 2:3
 plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l')
 lines(dnorm(1:10,sd = mySigma[2]),lty = 2)
 leg - as.expression(lapply(mySigma, function(x) bquote(sigma == .(x
 legend(x = topright, lty = c(1,2),legend = leg)
 
 Thanks,
 
 --sundar
 
 Uwe Ligges said the following on 3/7/2008 8:15 AM:
  You might want to read
Ligges, U. (2002): R Help Desk: Automation of Mathematical
 Annotation
  in Plots. R News 2 (3), 32-34.
  with an example at the end that meets your requirements:
 
  (please note that I removed those ugly ;
 
 
  mySigma[1] - 2
  mySigma[2] - 3
  plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l')
  lines(dnorm(1:10, sd = mySigma[2]), lty = 2)
  legend1 - substitute(sigma == myS, list(myS = mySigma[1]))
  legend2 - substitute(sigma == myS, list(myS = mySigma[2]))
  legend(x = topright, lty = c(1,2),
  legend = do.call(expression, list(legend1, legend2)))
 
 
  Uwe Ligges
 
 
 
  Mario Maiworm wrote:
  Finally, this should work for an array of sigmas. I just realized
 that the
  substitute()-command is not evaluated within a c()-environment :(
 
  mySigma[1] - 2; mySigma[2] - 3;
  plot(1:10, dnorm(1:10, sd = mySigma[1]), type = 'l') ;
  lines(dnorm(1:10,sd = mySigma[2]),lty = 2);
  legend(x = topright, lty = c(1,2),legend = c(substitute(sigma ==
 myS,
  list(myS = mySigma[1])),substitute(sigma == myS, list(myS =
 mySigma[2]
 
  Mario.
 
 
  __
 
  Mario Maiworm
  Biological Psychology and Neuropsychology
  University of Hamburg
  Von-Melle-Park 11
  D-20146 Hamburg
 
  Tel.: +49 40 42838 3515
  Fax.: +49 40 42838 6591
 
  http://bpn.uni-hamburg.de/Maiworm_e.html
  http://cinacs.org
  __
 
  -Ursprüngliche Nachricht-
  Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
  Gesendet: Freitag, 7. März 2008 16:30
  An: Mario Maiworm
  Cc: r-help@r-project.org
  Betreff: Re: AW: [R] LaTeX in R
 
 
 
  Mario Maiworm wrote:
  Thank you, uwe and jeremy. I was actually looking exactly for
 that!
  But
  something still doesn't work:
  I want to plot a symbol in a legend of a plot, lets say \sigma =
 2.
  2
  should be the value of a variable. So, when I try
 
  mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
  legend(x=topright,legend=paste(expression(sigma), =
  ,mySigma),lty=1)
  , the sigma is not plotted as a symbol. This version:
 
  mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
  legend(x=topright,legend=expression(paste(sigma, =
  ,mySigma)),lty=1)
  gives me a 'real' sigma but the mySigma variable is not
 evaluated. Any
  ideas?
  Yes:
 
 
  mySigma - 2
  plot(1:10, dnorm(1:10, sd = mySigma), type='l')
  legend(x = topright, lty = 1,
  legend = substitute(sigma == myS, list(myS = mySigma)))
 
 
  Uwe Ligges
 
 
  Mario.
 
 
 __
 
  Mario Maiworm
  Biological Psychology and Neuropsychology
  University of Hamburg
  Von-Melle-Park 11
  D-20146 Hamburg
 
  Tel.: +49 40 42838 3515
  Fax.: +49 40 42838 6591
 
  http://bpn.uni-hamburg.de/Maiworm_e.html
  http://cinacs.org
 
 __
 
  -Ursprüngliche Nachricht-
  Von: Uwe Ligges [mailto:[EMAIL PROTECTED]
  Gesendet: Freitag, 7. März 2008 15:27
  An: Mario Maiworm
  Cc: r-help@r-project.org
  Betreff: Re: [R] LaTeX in R
 
 
 
  Mario Maiworm wrote:
  Dear Rers,
  I understand that I can include R-code in LaTeX using Sweave.
 Is
  there
  a way
  to do it the other way round? Particularly, I need some TeX
  symbols in
  the
  legend of an R-plot. This can be done in matlab easily, so I
 am
  optimistic
  with R. Any suggestions for a command or package?
  See   ?plotmath
 
  Uwe Ligges
 
 
 
 
  Best,
  Mario.
 
 
 
 
 

[R] confused about CORREP cor.LRtest

2008-03-07 Thread Mark W Kimpel
After some struggling with the data format, non-standard in 
BioConductor, I have gotten cor.balance in package CORREP to work. My 
desire was to obtain maximum-likelihood p-values from the same data 
object using cor.LRtest, but it appears that this function wants 
something different, which I can't figure out from the documentation.

Briefly, my dataset consists of 36 samples from 12 conditions and I have 
  497 genes of interest to be correlated. The following works:

M - cor.balance(stddata, m = 3, G=497)

The following does not:
M.p - cor.LRtest(stddata, m1 = 3, m2 = 3)

Do I need to do something to stddata between example 1 and 2 or does m 
stand for something different in the two examples?

sessionInfo follows. Thanks, Mark

  sessionInfo()
R version 2.7.0 Under development (unstable) (2008-03-05 r44683)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

other attached packages:
  [1] rat2302_2.0.1Rgraphviz_1.17.13graph_1.17.17
  [4] igraph_0.5   CORREP_1.5.0 e1071_1.5-17
  [7] class_7.2-41 affy_1.17.8  preprocessCore_1.1.5
[10] affyio_1.7.13Biobase_1.99.1

loaded via a namespace (and not attached):
[1] cluster_1.11.10
-- 

Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN  46074

(317) 490-5129 Work,  Mobile  VoiceMail
(317) 204-4202 Home (no voice mail please)

mwkimpelatgmaildotcom

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Time series panel

2008-03-07 Thread GRAHAM LEASK
I have a set of data that consists of a number of biological measurements.
   
  The columns are Time that runs from 01/01/2005 to 01/5/2007, Group which has 
23 levels and postcode which is nested within group. This is a balanced panel 
but the number of postcodes differs within groups, from 15 to 400. The rest of 
this data consists of a number of columns of quantitative measures, largely 
counts.
   
  I would like to set this up as a dataframe but retain the time series element 
and the structural relations within the data. How can I do this in R? 
   
  Whenever I try ts I end up with things out of order without the time series 
element.correctly represented
   
  Secondly assuming that I wish to regress temperature against vegetation and 
type how do I express this as a linear hierarchical model nesting postcode 
within group but keeping time as non nested (eg group x time) with calendar 
time as a group level predictor?
   
  Any help would be most appreciated.
   
   
   
  Graham Leask


Kind regards


Dr Graham Leask
Economics and Strategy Group
Aston Business School
Aston University
Aston Triangle
Birmingham
B4 7ET

Tel: Direct line 0121 204 3150
Fax: 0870 759 8408
email [EMAIL PROTECTED]
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-Logo in \LaTeX

2008-03-07 Thread Gabor Csardi
Jean,

On Fri, Mar 07, 2008 at 06:09:35PM +0100, Jean lobry wrote:
 Gabor,
 
  this is nice, but
  1) the logo is a bitmap, it is ugly if you resize it
 
 Sure, it's a bitmap, but the naked eye resolution is only
 100 $\mu$m so that a vectorized solution is overkilling
 in most common situations IMHO. 

a vectorized solution can be rendered smoothly at any 
desired size. Furthermore, it can be easily edited and the 
size of the file is (usually) much smaller than the bitmap 
version. No overkill at all, as it is SIMPLER to use the 
vector version.

 I have to zoom by a factor
 1200% to see some pixellization problems on my screen,
 but my eyes are admitedly getting older and older, one more
 instance of fortune(75) issue I guess :-(

Hmmm, i've downloaded your pdf, and it is clearly ugly at 400%.
I'm talking about the Rlogo.pdf file. E.g. i'm not sure that 
it would look good on an A0 poster.

  2) you don't need a pdf version for pdflatex, it
  handles jpg (and maybe also png as well), so you can
  just use the logos at the R developer site.
 
 Not so sure, I had to convert it a long time ago into a PDF
 format for a reason I don't remember. I'm sharing my *.rnw
 on a CVS with colleages working under Linux, Unix, Mac and
 Windows, so the reason could be that there was a problem
 in a given platform. The PDF choice is defensive in the sense
 that we are Sweaving with \SweaveOpts{pdf = T, eps = F},
 so that including PDF is a pre-condition.

Maybe this is different if you use Sweave. pdflatex itself 
handles jpg without problems.

 It would be really nice to have a non-bitmap version, though.
 If it exists.
 
 There was a not so-old thread about this on R-devel:
 http://finzi.psych.upenn.edu/R/R-devel/archive/19448.html

Of which the conclusion is that there is no vector version.

Best,
Gabor

 Best,
 
 Jean
 -- 
 Jean R. Lobry([EMAIL PROTECTED])
 Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
 43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
 allo  : +33 472 43 27 56 fax: +33 472 43 13 88
 http://pbil.univ-lyon1.fr/members/lobry/
 

-- 
Csardi Gabor [EMAIL PROTECTED]UNIL DGM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problems installing packages using the inbuilt facility: Error i n gzfile(file, r) : unable to open connection

2008-03-07 Thread Kauer, Philipp
Hi 

I have been trawling the web, FAQs, and R manuals for help on the following 
issue, but have failed and was wondering if anyone has a solution to the 
following problem:

After having installed R 2.6.2 for Windows (binary), I tried to install various 
packages. Every time I try loading a package (any package) via the built-in 
menu, I run into the following error message. 

 utils:::menuInstallPkgs()
trying URL 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip 
http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip '
Content type 'application/zip' length 971893 bytes (949 Kb)
opened URL
downloaded 949 Kb

Warning in gzfile(file, r) :
  cannot open compressed file 'ada/DESCRIPTION', probable reason 'No such file 
or directory'
Error in gzfile(file, r) : unable to open connection
 traceback()
6: gzfile(file, r)
5: read.dcf(file.path(curPkg, DESCRIPTION), c(Package, Version, 
   Type))
4: unpackPkg(foundpkgs[okp, 2], foundpkgs[okp, 1], lib, installWithVers)
3: .install.winbinary(pkgs = pkgs, lib = lib, contriburl = contriburl, 
   method = method, available = available, destdir = destdir, 
   installWithVers = installWithVers, dependencies = dependencies)
2: install.packages(NULL, .libPaths()[1], dependencies = NA, type = type)
1: utils:::menuInstallPkgs()

I tried saving the ZIP  of the package to my C drive, and then installing from 
that, but I get the same error message. I then tried calling gzfile with the 
filename of the ZIP directly, and I seem to get a file handle without any error 
message:

gzfile(C:/Program Files/R/R-2.6.2/library/ada_2.0-1.zip,r)
   description  
class 
C:/Program Files/R/R-2.6.2/library/ada_2.0-1.zip  
 gzfile 
  mode  
 text 
 rb6  
 binary 
opened  
 can read 
  opened  
yes 
 can write 
  no 



It might be worth noting, that I initially I also had problems with the 
internet download facility, which I fixed starting R with the flag --internet2, 
as indicated in the FAQs. 

Can you please help?

Many thanks - Philipp

PS: I did the same on my PC at home, and there everything works without 
problems.


==
Please access the attached hyperlink for an important el...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Trouble with R CMD check

2008-03-07 Thread Shewcraft, Ryan
Friends,

I changed one line of a package at the source level and then rebuilt it.
When I run R CMD check, I get an error:

installing R.css in C:/polsplineRS.Rcheck


-- Making package polsplineRS 
  adding build stamp to DESCRIPTION
  making DLL ...
making hareall.d from hareall.c
making heftall.d from heftall.c
making lsdall.d from lsdall.c
making lspecall.d from lspecall.c
making nlsd.d from nlsd.c
making polyall.d from polyall.c
making polymars.d from polymars.c
gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
hareall.c -o hareall.o
hareall.c: In function `gremdim':
hareall.c:2127: warning: unused variable `x'
hareall.c: In function `compall':
hareall.c:1656: warning: 'lala' might be used uninitialized in this
function
hareall.c: In function `newton':
hareall.c:1876: warning: 'rall' might be used uninitialized in this
function
hareall.c: In function `search':
hareall.c:646: warning: 'iloc' might be used uninitialized in this
function
hareall.c:646: warning: 'lloc' might be used uninitialized in this
function
hareall.c:646: warning: 'uloc' might be used uninitialized in this
function
hareall.c: In function `adders':
hareall.c:529: warning: 'crit1' might be used uninitialized in this
function
hareall.c: In function `share':
hareall.c:2126: warning: 'bb1' might be used uninitialized in this
function
hareall.c:2126: warning: 'bt1' might be used uninitialized in this
function
hareall.c:2126: warning: 'bb2' might be used uninitialized in this
function
hareall.c:2126: warning: 'bw' might be used uninitialized in this
function
hareall.c:2127: warning: 'wald' might be used uninitialized in this
function
hareall.c: In function `sphare':
hareall.c:3417: warning: 's' might be used uninitialized in this
function
hareall.c: At top level:
hareall.c:132: warning: 'iigvector' declared `static' but never defined
gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
heftall.c -o heftall.o
heftall.c: In function `sheft':
heftall.c:301: warning: 'nintx' might be used uninitialized in this
function
heftall.c:301: warning: 'addi' might be used uninitialized in this
function
heftall.c:1848: warning: 'loloc' might be used uninitialized in this
function
heftall.c:1848: warning: 'uploc' might be used uninitialized in this
function
heftall.c:1848: warning: 'nowloc1' might be used uninitialized in this
function
gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
lsdall.c -o lsdall.o
lsdall.c: In function `knotplace':
lsdall.c:1890: warning: 'ia' might be used uninitialized in this
function
lsdall.c:1895: warning: 'u3' might be used uninitialized in this
function
lsdall.c:1895: warning: 'u4' might be used uninitialized in this
function
lsdall.c: In function `liter':
lsdall.c:369: warning: 'zerror' might be used uninitialized in this
function
lsdall.c:370: warning: 'newlikelihood' might be used uninitialized in
this function
lsdall.c: In function `logcensor':
lsdall.c:51: warning: 'xnknots' might be used uninitialized in this
function
lsdall.c:55: warning: 'xczheta' might be used uninitialized in this
function
lsdall.c: In function `pqlsd':
lsdall.c:2908: warning: 'j' might be used uninitialized in this function
lsdall.c: At top level:
lsdall.c:1458: warning: 'fun2' defined but not used
lsdall.c:1471: warning: 'fun48' defined but not used
gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
lspecall.c -o lspecall.o
lspecall.c: In function `tsadd':
lspecall.c:626: warning: 'b2' might be used uninitialized in this
function
gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c nlsd.c
-o nlsd.o
nlsd.c: In function `ludcmp':
nlsd.c:695: warning: 'imax' might be used uninitialized in this function
nlsd.c: In function `setupspace':
nlsd.c:1717: warning: 'm' might be used uninitialized in this function
nlsd.c: In function `startspace':
nlsd.c:1838: warning: 'l' might be used uninitialized in this function
nlsd.c: In function `pompall':
nlsd.c:1158: warning: 'f' might be used uninitialized in this function
nlsd.c: In function `nlsd':
nlsd.c:747: warning: 'nowloc1' might be used uninitialized in this
function
nlsd.c:747: warning: 'loloc' might be used uninitialized in this
function
nlsd.c:747: warning: 'uploc' might be used uninitialized in this
function
gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
polyall.c -o polyall.o
polyall.c: In function `poly':
polyall.c:3121: warning: 'okd' might be used uninitialized in this
function
polyall.c:2777: warning: 'aj' might be used uninitialized in this
function
polyall.c:2777: warning: 'ak' might be used uninitialized in this
function
polyall.c:2777: warning: 'sj' might be used uninitialized in this
function
polyall.c:2777: warning: 'sk' might be used uninitialized in this
function
polyall.c:2777: warning: 'bbi' might be used uninitialized in this
function
polyall.c:2777: warning: 'bbj' might be used uninitialized in this
function
polyall.c:2777: warning: 'bbk' might be used uninitialized in 

[R] Numerical Integration in 1D

2008-03-07 Thread Max
Dear UseRs,

I'm curious about the derivative of n!.

We know that Gamma(n+1)=n! So when on takes the derivative of 
Gamma(n+1) we get Int(ln(x)*exp(-x)*x^n,x=0..Inf).

I've tried code like

 integrand-function(x) {log(x)*exp(x)*x^n}
 integrate(integrand,lower=0,upper=Inf)

It seems that R doesn't like to integrate for any n, and I was 
wondering if anyone knew a way around this?

-Max

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Trouble with R CMD check

2008-03-07 Thread Shewcraft, Ryan
Thanks!  That's seemed to partially work, but now when I try to load it
in R I get:

library(polsplineRS)
Error in library.dynam(polspline, pkg, lib) : 
shared library 'polspline' not found
Error in library(polsplineRS) : .First.lib failed for 'polsplineRS' 

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 07, 2008 1:36 PM
To: Shewcraft, Ryan
Cc: r-help@r-project.org
Subject: Re: [R] Trouble with R CMD check

On 3/7/2008 1:21 PM, Shewcraft, Ryan wrote:
 Friends,
 
 I changed one line of a package at the source level and then rebuilt
it.
 When I run R CMD check, I get an error:

You're getting lots of warnings from the compiler; presumably those have
nothing to do with you.  Then at the end you're getting an error because
you haven't set up your R toolset completely:

hhc: not found

This is the Microsoft Help Workshop help compiler.  Either you didn't
install it, or didn't put it in the right place.  But you can avoid the
error by just not building compiled help, using

Rcmd install --docs=normal polsplineRS

Duncan Murdoch


 
 installing R.css in C:/polsplineRS.Rcheck
 
 
 -- Making package polsplineRS 
   adding build stamp to DESCRIPTION
   making DLL ...
 making hareall.d from hareall.c
 making heftall.d from heftall.c
 making lsdall.d from lsdall.c
 making lspecall.d from lspecall.c
 making nlsd.d from nlsd.c
 making polyall.d from polyall.c
 making polymars.d from polymars.c
 gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
 hareall.c -o hareall.o
 hareall.c: In function `gremdim':
 hareall.c:2127: warning: unused variable `x'
 hareall.c: In function `compall':
 hareall.c:1656: warning: 'lala' might be used uninitialized in this 
 function
 hareall.c: In function `newton':
 hareall.c:1876: warning: 'rall' might be used uninitialized in this 
 function
 hareall.c: In function `search':
 hareall.c:646: warning: 'iloc' might be used uninitialized in this 
 function
 hareall.c:646: warning: 'lloc' might be used uninitialized in this 
 function
 hareall.c:646: warning: 'uloc' might be used uninitialized in this 
 function
 hareall.c: In function `adders':
 hareall.c:529: warning: 'crit1' might be used uninitialized in this 
 function
 hareall.c: In function `share':
 hareall.c:2126: warning: 'bb1' might be used uninitialized in this 
 function
 hareall.c:2126: warning: 'bt1' might be used uninitialized in this 
 function
 hareall.c:2126: warning: 'bb2' might be used uninitialized in this 
 function
 hareall.c:2126: warning: 'bw' might be used uninitialized in this 
 function
 hareall.c:2127: warning: 'wald' might be used uninitialized in this 
 function
 hareall.c: In function `sphare':
 hareall.c:3417: warning: 's' might be used uninitialized in this 
 function
 hareall.c: At top level:
 hareall.c:132: warning: 'iigvector' declared `static' but never
defined
 gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
 heftall.c -o heftall.o
 heftall.c: In function `sheft':
 heftall.c:301: warning: 'nintx' might be used uninitialized in this 
 function
 heftall.c:301: warning: 'addi' might be used uninitialized in this 
 function
 heftall.c:1848: warning: 'loloc' might be used uninitialized in this 
 function
 heftall.c:1848: warning: 'uploc' might be used uninitialized in this 
 function
 heftall.c:1848: warning: 'nowloc1' might be used uninitialized in this

 function
 gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
 lsdall.c -o lsdall.o
 lsdall.c: In function `knotplace':
 lsdall.c:1890: warning: 'ia' might be used uninitialized in this 
 function
 lsdall.c:1895: warning: 'u3' might be used uninitialized in this 
 function
 lsdall.c:1895: warning: 'u4' might be used uninitialized in this 
 function
 lsdall.c: In function `liter':
 lsdall.c:369: warning: 'zerror' might be used uninitialized in this 
 function
 lsdall.c:370: warning: 'newlikelihood' might be used uninitialized in 
 this function
 lsdall.c: In function `logcensor':
 lsdall.c:51: warning: 'xnknots' might be used uninitialized in this 
 function
 lsdall.c:55: warning: 'xczheta' might be used uninitialized in this 
 function
 lsdall.c: In function `pqlsd':
 lsdall.c:2908: warning: 'j' might be used uninitialized in this 
 function
 lsdall.c: At top level:
 lsdall.c:1458: warning: 'fun2' defined but not used
 lsdall.c:1471: warning: 'fun48' defined but not used
 gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
 lspecall.c -o lspecall.o
 lspecall.c: In function `tsadd':
 lspecall.c:626: warning: 'b2' might be used uninitialized in this 
 function
 gcc   -Ic:/PROGRA~1/R/R-24~1.1/include  -Wall -O2 -std=gnu99   -c
nlsd.c
 -o nlsd.o
 nlsd.c: In function `ludcmp':
 nlsd.c:695: warning: 'imax' might be used uninitialized in this 
 function
 nlsd.c: In function `setupspace':
 nlsd.c:1717: warning: 'm' might be used uninitialized in this function
 nlsd.c: In function `startspace':
 nlsd.c:1838: warning: 'l' might be 

Re: [R] Numerical Integration in 1D

2008-03-07 Thread Ravi Varadhan
Hi Max,

The analytic integral \int _0 ^\Inf exp(-t) t^n log(t) might not converge
because the integrand tends to -Inf as t - 0.

So, here is a numerical approach to estimating the derivative of the gamma
function:

library(numDeriv)

fx - function(x, n) exp(-x) * x^n

gf - function(n) {integrate(fx, lower=0, upper=Inf, n=n)$val}

 grad(x=3, func=gf)
[1] 7.536706

 grad(x=10, func=gf)
[1] 8534040


Best,
Ravi.



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

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

 




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Max
Sent: Friday, March 07, 2008 1:41 PM
To: [EMAIL PROTECTED]
Subject: [R] Numerical Integration in 1D

Dear UseRs,

I'm curious about the derivative of n!.

We know that Gamma(n+1)=n! So when on takes the derivative of 
Gamma(n+1) we get Int(ln(x)*exp(-x)*x^n,x=0..Inf).

I've tried code like

 integrand-function(x) {log(x)*exp(x)*x^n}
 integrate(integrand,lower=0,upper=Inf)

It seems that R doesn't like to integrate for any n, and I was 
wondering if anyone knew a way around this?

-Max

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Numerical Integration in 1D

2008-03-07 Thread Max
Prof Brian Ripley formulated on Friday :
 On Fri, 7 Mar 2008, Max wrote:

 Dear UseRs,
 
 I'm curious about the derivative of n!.
 
 We know that Gamma(n+1)=n! So when on takes the derivative of
 Gamma(n+1) we get Int(ln(x)*exp(-x)*x^n,x=0..Inf).
 
 I've tried code like
 
 integrand-function(x) {log(x)*exp(x)*x^n}
 integrate(integrand,lower=0,upper=Inf)
 
 It seems that R doesn't like to integrate for any n, and I was
 wondering if anyone knew a way around this?

 ln(x) e^x x^n is not integrable on (0, Inf).  You presumably slipped over 
 a minus sign, but your definition of gamma(n) is wrong -- see ?gamma.

 integrate(function(x) exp(-x)*x^n, lower=0, upper=Inf)

 will work for gamma(n+1).

I did miss a minus sign in the integration, which explains part of my 
problems. The function of interest is the derivative of Gamma(n+1) with 
respect to n, but obviously integrated over x from 0 to Infinity.

What happens now is:

 integrand-function(x) {log(x)*exp(-x)*x^n}
 integrate(integrand,lower=0,upper=Inf)
Error in f(x, ...) : object n not found

Any ideas on how to get around this error?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Numerical Integration in 1D

2008-03-07 Thread Ravi Varadhan
Hi max,

Prof. Ripley is right.  Your problem is that you missed a (-) sign in the
exponential.  Here is a demonstration showing the agreement between
numerical and analytical results: 

gx - function(x, n) exp(-x) * x^n * log(x)

df - function(n) {integrate(gx, lower=0, upper=Inf, n=n)$val}

library(numDeriv)

fx - function(x, n) exp(-x) * x^n

gf - function(n) {integrate(fx, lower=0, upper=Inf, n=n)$val}

 grad(x=6, func=gf)
[1] 1348.405
 
 df(6)
[1] 1348.405


Ravi.



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

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

 





-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Max
Sent: Friday, March 07, 2008 1:41 PM
To: [EMAIL PROTECTED]
Subject: [R] Numerical Integration in 1D

Dear UseRs,

I'm curious about the derivative of n!.

We know that Gamma(n+1)=n! So when on takes the derivative of 
Gamma(n+1) we get Int(ln(x)*exp(-x)*x^n,x=0..Inf).

I've tried code like

 integrand-function(x) {log(x)*exp(x)*x^n}
 integrate(integrand,lower=0,upper=Inf)

It seems that R doesn't like to integrate for any n, and I was 
wondering if anyone knew a way around this?

-Max

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] error in random forest

2008-03-07 Thread Nagu
Hi,

I get the following error when I try to predict the probabilities of a
test sample:

Error in predict.randomForest(fit.EBA.OM.rf.50, x.OM, type = prob) :
  New factor levels not present in the training data

I have about 630 predictor variables in the dataset x.OM (25 factor
variables and the remaining are continuous variables). Any ideas on
how to trace it?

Thank you,
Nagu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] zoo object won't plot

2008-03-07 Thread Gabor Grothendieck
1. This is not reproducible.
Lines was not provided in reproducible form.
Please look at my prior emails and use that
form so that one can copy from your post and
paste it directly into R and observe the error.

2. What do you mean by does not plot?  Do you get
an error or does nothing appear?  If its the latter
its because there are no lines in the plot, only
disjoint points separated by NAs so one would
not expect there to be any lines.

plot(na.omit(z1))
plot(na.approx(z1, na.rm = FALSE))
plot(z1, type = p)

would all create plots with lines (or points) if that's the problem.



On Fri, Mar 7, 2008 at 1:53 PM, stephen sefick [EMAIL PROTECTED] wrote:
 DateTimeRM61
 11/30/2006 12:31NA
 11/30/2006 12:46NA
 11/30/2006 13:012646784125
 11/30/2006 13:16NA
 11/30/2006 13:31NA
 11/30/2006 13:46NA
 11/30/2006 14:012666435177
 11/30/2006 14:16NA
 11/30/2006 14:31NA
 11/30/2006 14:46NA
 11/30/2006 15:012653041914
 11/30/2006 15:16NA
 11/30/2006 15:31NA
 11/30/2006 15:46NA
 11/30/2006 16:012693126189
 11/30/2006 16:16NA
 11/30/2006 16:31NA
 11/30/2006 16:46NA
 11/30/2006 17:012658366411
 11/30/2006 17:16NA
 11/30/2006 17:31NA
 11/30/2006 17:46NA
 11/30/2006 18:012705885426
 11/30/2006 18:16NA
 11/30/2006 18:31NA
 11/30/2006 18:46NA
 11/30/2006 19:012707635675
 11/30/2006 19:16NA
 11/30/2006 19:31NA
 11/30/2006 19:46NA
 11/30/2006 20:012721482049
 11/30/2006 20:16NA
 11/30/2006 20:31NA
 11/30/2006 20:46NA
 11/30/2006 21:012712886423
 11/30/2006 21:16NA
 11/30/2006 21:31NA
 11/30/2006 21:46NA
 11/30/2006 22:012720426598
 11/30/2006 22:16NA
 11/30/2006 22:31NA
 11/30/2006 22:46NA
 11/30/2006 23:012724468912

 #read data in as zoo object
 # chron
 library(chron)
 fmt.chron - function(x) {
   chron(sub( .*, , x), gsub(.* (.*), \\1:00, x))
 }
 z1 - read.zoo(textConnection(Lines), sep = ,, header = TRUE, FUN = 
 fmt.chron)

 the above data will not plot

 #rplot
 plot(z1)


 --
 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.

-K. Mullis

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] bayesm version 2.2-0

2008-03-07 Thread Rossi, Peter E.
bayesm version 2.2-0 is now available on CRAN.

Major changes include:

1. general density estimation using a Dirichlet Process Prior and a
normal base
2. linear instrumental variable models with unknown error distributions
   (the Bayesian analogue of IV methods).  Achieved via DP priors.

peter r


 Peter E. Rossi
 Joseph T. and Bernice S. Lewis Professor of Marketing and Statistics
 Director, Kilts Center for Marketing
 Editor, Quantitative Marketing and Economics
 Rm 353, Graduate School of Business, U of Chicago
 5807 S. Woodlawn Ave, Chicago IL 60637
 Tel: (773) 702-7513   |   Fax: (773) 834-2081 
 WWW: http://ChicagoGsb.edu/fac/peter.rossi
 SSRN: http://ssrn.com/author=22862

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] triple integral: adapt package question

2008-03-07 Thread Davood Tofighi
Dear All,

I have a function f(x,y,z)=exp(x^3+y^4+x^2*y+x*z^2+y/z) over D, where is D={
(x,y,z)| 0 zInf, 0yc1*z, 0xc2*/y}. x,y,z are all vectors and c1 and c2
are constants. I tried the adapt package and I get some error. This is the
error message:

Error in function (z, y, x)  : argument x is missing, with no default

I included my R code. Can anyone please let me know how I can calculate the
numerical integral of such a function where some of the boundaries are
functions of the other variables?

require(adapt)
fn-function(z,y,x) {exp(x^3+y^4+x^2*y+x*z^2+y/z)}
x-runif(200);y-runif(200);z-runif(200);
c1-.5;c2-5;M-100;#M to represent infinity
i1-adapt(3,lo=c(.0001,0,0),up=c(M,c1*z,c2/y),functn=fn)$value
print(i1);
 Thanks,
-- 
Davood Tofighi

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] training svm

2008-03-07 Thread Max Kuhn
Also, see the nearZeroVar function in the caret package.

MAx

On Fri, Mar 7, 2008 at 7:41 AM, Charilaos Skiadas [EMAIL PROTECTED] wrote:

 On Mar 7, 2008, at 2:17 AM, Oldrich Kruza wrote:

   Hello Soumyadeep,
  
   if you store the data in a tabular file, then I suggest using standard
   text-editing tools like cut (say your file is called data.csv, fields
   are separated with commas and you want to get rid of the third and
   sixth column):
  
   $ cut --complement --delimiter=, --fields=3,6  data.csv 
   data_cut.csv
  
   If you're not in an Unix environment but have perl, then you may use a
   script like:
  
open SRC, data.csv or die(couldn't open source);
open DST, data_cut.csv or die(couldn't open destination);
while (SRC) {
chomp;
@fields = split /,/;#substitute the comma for the
   delimiter you use
splice @fields, 2, 1;#get rid of third column (they're
   zero-based, thus 2 instead of 3)
splice @fields, 5, 1;#get rid of sixth column
print DST join(,, @fields), \n;
}
  
   If you need to do the selection within R, then you can do it by
   indexing the data structure. Suppose you have the data in a data.frame
   called data. Then:
  
   data - data[,-6]
   data - data[,-3]
  
   might do the trick (but since I'm not much of an R hacker, this is
   without guarantee). I think it might be better however to do the
   preprocessing before the data get into R because then you avoid
   loading the columns to discard into memory.

  I am guessing that the data is already in R, so it should be easier
  to do it in R, especially if he doesn't know which columns are the
  ones with all identical values. For instance, suppose the data set is
  called x. Then the following would return TRUE for the columns that
  have all values the same:

  allsame - sapply(x,function(y) length(table(y))==1)

  and then the following will take them out

  newdata - x[,!allsame]

   Hope this helps
   ~ Oldrich

  Haris Skiadas
  Department of Mathematics and Computer Science
  Hanover College



  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.




-- 

Max

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Numerical Integration in 1D

2008-03-07 Thread Prof Brian Ripley
On Fri, 7 Mar 2008, Max wrote:

 Prof Brian Ripley formulated on Friday :
 On Fri, 7 Mar 2008, Max wrote:

 Dear UseRs,

 I'm curious about the derivative of n!.

 We know that Gamma(n+1)=n! So when on takes the derivative of
 Gamma(n+1) we get Int(ln(x)*exp(-x)*x^n,x=0..Inf).

 I've tried code like

 integrand-function(x) {log(x)*exp(x)*x^n}
 integrate(integrand,lower=0,upper=Inf)

 It seems that R doesn't like to integrate for any n, and I was
 wondering if anyone knew a way around this?

 ln(x) e^x x^n is not integrable on (0, Inf).  You presumably slipped over
 a minus sign, but your definition of gamma(n) is wrong -- see ?gamma.

 integrate(function(x) exp(-x)*x^n, lower=0, upper=Inf)

 will work for gamma(n+1).

 I did miss a minus sign in the integration, which explains part of my
 problems. The function of interest is the derivative of Gamma(n+1) with
 respect to n, but obviously integrated over x from 0 to Infinity.

And you said n!, so n must be integer and you cannot differentiate a 
function of a integer argument.

If you are interested in the derivative of gamma(x), check out ?digamma.

 What happens now is:

 integrand-function(x) {log(x)*exp(-x)*x^n}
 integrate(integrand,lower=0,upper=Inf)
 Error in f(x, ...) : object n not found

 Any ideas on how to get around this error?

Set 'n' in the evaluation environment.

E.g.

 n - 3
 integrate(integrand, lower=0, upper=Inf)
7.536706 with absolute error  4.7e-06
 digamma(4)*gamma(4)
[1] 7.536706

-- 
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Combine two columns

2008-03-07 Thread amarkey
Is there a way to combine two columns within a data frame?

Example data:

id  snp AL1 AL2
150030  A   B
151030  A   A
152030  A   B

This is what I would like:

indvsnp AL1AL2
150030  AB
151030  AA
152030  AB

Any help is greatly appreciated.

Alysta

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Combine two columns

2008-03-07 Thread Henrique Dallazuanna
Try:

transform(x, AL1Al2 = paste(AL1, AL2, sep=''))[-c(3:4)]

On 07/03/2008, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Is there a way to combine two columns within a data frame?

  Example data:

  id  snp AL1 AL2
  150030  A   B
  151030  A   A
  152030  A   B

  This is what I would like:

  indvsnp AL1AL2
  150030  AB
  151030  AA
  152030  AB

  Any help is greatly appreciated.

  Alysta

  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Passing function to tapply as a string

2008-03-07 Thread Henrique Dallazuanna
Or perhaps:

myfun - function(fname, ...)match.fun(fname)(...)

On 07/03/2008, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Was wondering if it is possible to pass function name as a parameter

 Yes.  This isn't exactly what you wanted, but it demonstrates the
  principle.

  x = rnorm(5)
  [1] -0.6510448  0.4591730  1.3225205  1.2314391 -0.0888139

  myfun - function(fname, x) eval(parse(text=paste(fname,(x),sep=)))
  myfun('max',x)
  [1] 1.322521

  myfun('min',x)
  [1] -0.6510448

  Regards,
  Richie.

  Mathematical Sciences Unit
  HSL


  
  ATTENTION:

  This message contains privileged and confidential inform...{{dropped:20}}


  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Combine two columns

2008-03-07 Thread Gabor Grothendieck
Depending on your purpose you might want to look
at ?interaction or its synonym : (i.e. a colon)

On Fri, Mar 7, 2008 at 4:09 PM,  [EMAIL PROTECTED] wrote:
 Is there a way to combine two columns within a data frame?

 Example data:

 id  snp AL1 AL2
 150030  A   B
 151030  A   A
 152030  A   B

 This is what I would like:

 indvsnp AL1AL2
 150030  AB
 151030  AA
 152030  AB

 Any help is greatly appreciated.

 Alysta

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Finding Interaction and main effects contrasts for two-way ANOVA

2008-03-07 Thread Thompson, David (MNR)
 Dale,

Other than the first SAS contrast, does the following demonstrate what
your asking for?
 summary(twoway)
 material temp   voltage   
 1:12 50:12   Min.   : 20  
 2:12 65:12   1st Qu.: 70  
 3:12 80:12   Median :108  
  Mean   :106  
  3rd Qu.:142  
  Max.   :188  
 contrasts(twoway$material)
  2 3
1 0 0
2 1 0
3 0 1
 contrasts(twoway$temp)
   65 80
50  0  0
65  1  0
80  0  1
 fit - aov(voltage ~ material*temp, data=twoway)
 summary.aov(fit)
  Df Sum Sq Mean Sq F value  Pr(F)
material   2  1068453427.91  0.0020 ** 
temp   2  39119   19559   28.97 1.9e-07 ***
material:temp  4   961424033.56  0.0186 *  
Residuals 27  18231 675
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 


# setting (partial) contrasts
 contrasts(twoway$material) - c(1,-1,0) # ignoring the second
available df
 contrasts(twoway$temp) - c(0,1,-1) # ignoring the second available df
 contrasts(twoway$material)
  [,1]  [,2]
11 -0.41
2   -1 -0.41
30  0.82
 contrasts(twoway$temp)
   [,1]  [,2]
500 -0.82
651  0.41
80   -1  0.41

 summary.aov(fit, split=list(material=list('m1-m2'=1), temp=list('t50 -
t80'=1)))
 Df Sum Sq Mean Sq F value  Pr(F)
material  2  1068453427.91 0.00198 ** 
  material: m1-m2 1   380038005.63 0.02506 *  
temp  2  39119   19559   28.97 1.9e-07 ***
  temp: t50 - t80 1  11310   11310   16.75 0.00035 ***
material:temp 4   961424033.56 0.01861 *  
  material:temp: m1-m2.t50 - t80  1   497049707.36 0.01146 *  
Residuals27  18231 675
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

# other examples of setting contrasts
# compare m1 vs m2 and m2 vs m3
 contrasts(twoway$material) - matrix(c(1,-1,0,1,1,-2), nrow=3)
 contrasts(twoway$material)
  [,1] [,2]
110
2   -11
30   -1
# compare m1 vs m2 and m1+m2 vs m3
 contrasts(twoway$material) - matrix(c(1,-1,0,1,1,-2), nrow=3)
 contrasts(twoway$material)
  [,1] [,2]
111
2   -11
30   -2

I'm not sure if 'summary.aov' is the only lm-family summary method with
the split argument.

DaveT.
*
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
[EMAIL PROTECTED]
http://ofri.mnr.gov.on.ca
*
-Original Message-
From: Steele [mailto:[EMAIL PROTECTED] 
Sent: March 6, 2008 09:08 PM
To: [EMAIL PROTECTED]
Subject: [R] Finding Interaction and main effects contrasts 
for two-way ANOVA

I've tried  without success to calculate interaction and main effects
contrasts using R.  I've found the functions C(), contrasts(),
se.contrasts() and fit.contrasts() in package gmodels.  Given the url
for a small dataset and the two-way anova model below, I'd like to
reproduce the results from appended SAS code.  Thanks.  --Dale.

  ## the dataset (from Montgomery)
twoway - read.table(http://dsteele.veryspeedy.net/sta501/twoway.txt;,
col.names=c('material', 'temp','voltage'),colClasses=c('factor',
'factor', 'numeric'))

  ## the model
fit - aov(voltage ~ material*temp, data=twoway)

/* SAS code */
proc glm data=twoway;
class material temp;
model voltage = material temp material*temp;
contrast '21-22-31+32' material*temp 0 0 0 1 -1 0 -1 1 0;
estimate '21-22-31+32' material*temp 0 0 0 1 -1 0 -1 1 0;
contrast 'material1-material2' material 1 -1 0;
estimate 'material1-material2' material 1 -1 0;
contrast 'temp50 - temp80' temp 1 0 -1;
estimate 'temp50 - temp80' temp 1 0 -1;
run;

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Warning: matrix by vector division

2008-03-07 Thread Alexey Shipunov
Dear list,

I just made a very simple mistake, but it was hard to spot. And I
think that I should warn other people, because it is probably so
simple to make...

=== R code  ===

# Let us create a matrix:
(a - cbind(c(0,1,1), rep(1,3)))

#  [,1] [,2]
# [1,]01
# [2,]11
# [3,]11

# That is a MISTAKE:
a/colSums(a)

#   [,1]  [,2]
# [1,] 0.000 0.333
# [2,] 0.333 0.500
# [3,] 0.500 0.333
# I just wonder if some R warning should be issued here?

# That is what I actually needed (column-wise frequencies):
t(t(a)/colSums(a))

#  [,1]  [,2]
# [1,]  0.0 0.333
# [2,]  0.5 0.333
# [3,]  0.5 0.333

=== end of R code ===

With best wishes and regards,
Alexey Shipunov

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Irregular Time Series Issue

2008-03-07 Thread A Mani
Hello,
   I have an irregular time series of the form :

Time Data Time1 Data1 
1   b1 e
7  g 4i
NA  NA   5 k
NA  NA  NA  NA ...

(the columns have varying length of NAs after a certain point)
Converting this to regular time series with Pastecs does not seem to
work, when I see the
entire data as a single series. So I remove the NAs and deal with one
series at a time in a loop.

Any suggestions ?


Thanks

A. Mani


-- 
A. Mani
Member, Cal. Math. Soc

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Warning: matrix by vector division

2008-03-07 Thread Benilton Carvalho

and you might want to check ?prop.table

 prop.table(a, 2)
 [,1]  [,2]
[1,]  0.0 0.333
[2,]  0.5 0.333
[3,]  0.5 0.333

or even ?sweep (which will be useful for more complex situations)

 sweep(a, 2, colSums(a), /)
 [,1]  [,2]
[1,]  0.0 0.333
[2,]  0.5 0.333
[3,]  0.5 0.333

b

On Mar 7, 2008, at 5:32 PM, Alexey Shipunov wrote:


Dear list,

I just made a very simple mistake, but it was hard to spot. And I
think that I should warn other people, because it is probably so
simple to make...

=== R code  ===

# Let us create a matrix:
(a - cbind(c(0,1,1), rep(1,3)))

#  [,1] [,2]
# [1,]01
# [2,]11
# [3,]11

# That is a MISTAKE:
a/colSums(a)

#   [,1]  [,2]
# [1,] 0.000 0.333
# [2,] 0.333 0.500
# [3,] 0.500 0.333
# I just wonder if some R warning should be issued here?

# That is what I actually needed (column-wise frequencies):
t(t(a)/colSums(a))

#  [,1]  [,2]
# [1,]  0.0 0.333
# [2,]  0.5 0.333
# [3,]  0.5 0.333

=== end of R code ===

With best wishes and regards,
Alexey Shipunov

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to Estimate Covariance by Week based on a linear regression model

2008-03-07 Thread Felipe Carrillo
Hi all:
  I have always used SPSS to estimate weekly
covariance based on a linear regression model
  but have to hard code the model Std. Error and the
Mean-Square and then execute
  one week a the time. I was wondering if someone
could give me an idea on how to estimate
  weekly(WK) covariance using the summary and anova of
dfr(lineal  model below). I have
  to do this for 52 weeks(WK) but I am providing a
dataset with only two weeks below. The
  first week(WK 38 is missing values)

 dfr - read.table(textConnection(percentQ 
Efficiency
1.5650.0125
1.94 0.0213
0.8760.003736
1.0270.006
1.5360.0148
1.5360.0162
2.6070.02
1.4560.0157
2.16 0.0103
1.6980.0196
1.64 0.0098684
1.8140.0183
2.3940.0107
2.4690.0221
3.6110.0197
3.4660.0155
1.8770.0283
2.8930.0189
1.8510.009772
2.8340.0285
1.9230.022
2.5810.0159
2.3610.0053591
2.43 0.0185
1.66 0.0151
2.2850.0084034
2.2850.0124
2.37 0.0122
2.3920.0146
2.2440.0175), header=TRUE)
# Linear model
Reg-lm(Efficiency~percentQ,data=dfr)
summary(Reg)

# Coefficients standard error
Std=Betas[,Std. Error]
Std[1]^2
Std[1]^2

# Analysis of Variance (ANOVA) 
MS - anova(lm(Efficiency~percentQ,data=dfr))
MS
# value of the Residual Mean-Square
MS$Mean Sq[2]

#I want to estimate weekly(WK) covariance of the
dataset below using the linear model above.

temp53 - read.table(textConnection(XD TD PD WK
  38
  38
  38
  38
3.0259   0.022522163299   38
2.2316   0.01724 120315   38
2.3374   0.017944137874   38
2.2024   0.017046160524   39
2.4216   0.018504163565   39
1.4672   0.012157143973   39
1.4817   0.012253111956   39
1.4959   0.0123488967739
1.4431   0.0119979526939
1.5676   0.0128258155839), header=TRUE)
# I read about the cov function and tried it with my
data but couldn't get the desired results..I would
really appreciate any hints..Thanks



Felipe D. Carrillo
  Fishery Biologist
  US Fish  Wildlife Service
  California, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Warning: matrix by vector division

2008-03-07 Thread jim holtman
R is working exactly as documented.  If you look at how the matrix is
stored  (column-wise) and then what you are dividing by, you will see
that it is doing what you asked (when recycling values):

 as.vector(a)
[1] 0 1 1 1 1 1
 as.vector(a)/c(2,3)
[1] 0.000 0.333 0.500 0.333 0.500 0.333



On Fri, Mar 7, 2008 at 5:32 PM, Alexey Shipunov [EMAIL PROTECTED] wrote:
 Dear list,

 I just made a very simple mistake, but it was hard to spot. And I
 think that I should warn other people, because it is probably so
 simple to make...

 === R code  ===

 # Let us create a matrix:
 (a - cbind(c(0,1,1), rep(1,3)))

 #  [,1] [,2]
 # [1,]01
 # [2,]11
 # [3,]11

 # That is a MISTAKE:
 a/colSums(a)

 #   [,1]  [,2]
 # [1,] 0.000 0.333
 # [2,] 0.333 0.500
 # [3,] 0.500 0.333
 # I just wonder if some R warning should be issued here?

 # That is what I actually needed (column-wise frequencies):
 t(t(a)/colSums(a))

 #  [,1]  [,2]
 # [1,]  0.0 0.333
 # [2,]  0.5 0.333
 # [3,]  0.5 0.333

 === end of R code ===

 With best wishes and regards,
 Alexey Shipunov

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




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

What is the problem you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Warning: matrix by vector division

2008-03-07 Thread Alexey Shipunov
Dear all,

Thank you very much for all your valuable suggestions!

Best wishes,

Alexey Shipunov

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problems installing packages using the inbuilt facility: Error i n gzfile(file, r) : unable to open connection

2008-03-07 Thread Henrik Bengtsson
Works fine for me on the same setup.  Try this and compare (especially
the size of the downloaded file):

 url - http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip;;
 download.file(url, basename(url), mode=wb)  # Note wb!!!
trying URL 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip'
Content type 'application/zip' length 971893 bytes (949 Kb)
opened URL
downloaded 949 Kb
 file.info(basename(url))
size isdir mode   mtime   ctime
ada_2.0-1.zip 971893 FALSE  666 2008-03-07 15:43:52 2008-03-07 15:43:28
atime exe
ada_2.0-1.zip 2008-03-07 15:43:52  no
 install.packages(basename(url), repos=NULL)
package 'ada' successfully unpacked and MD5 sums checked
updating HTML package descriptions
 library(ada)
Loading required package: rpart


/Henrik

On Fri, Mar 7, 2008 at 10:02 AM, Kauer, Philipp
[EMAIL PROTECTED] wrote:
 Hi

  I have been trawling the web, FAQs, and R manuals for help on the following 
 issue, but have failed and was wondering if anyone has a solution to the 
 following problem:

  After having installed R 2.6.2 for Windows (binary), I tried to install 
 various packages. Every time I try loading a package (any package) via the 
 built-in menu, I run into the following error message.

   utils:::menuInstallPkgs()
  trying URL 
 'http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip 
 http://cran.uk.r-project.org/bin/windows/contrib/2.6/ada_2.0-1.zip '
  Content type 'application/zip' length 971893 bytes (949 Kb)
  opened URL
  downloaded 949 Kb

  Warning in gzfile(file, r) :
   cannot open compressed file 'ada/DESCRIPTION', probable reason 'No such 
 file or directory'
  Error in gzfile(file, r) : unable to open connection
   traceback()
  6: gzfile(file, r)
  5: read.dcf(file.path(curPkg, DESCRIPTION), c(Package, Version,
Type))
  4: unpackPkg(foundpkgs[okp, 2], foundpkgs[okp, 1], lib, installWithVers)
  3: .install.winbinary(pkgs = pkgs, lib = lib, contriburl = contriburl,
method = method, available = available, destdir = destdir,
installWithVers = installWithVers, dependencies = dependencies)
  2: install.packages(NULL, .libPaths()[1], dependencies = NA, type = type)
  1: utils:::menuInstallPkgs()

  I tried saving the ZIP  of the package to my C drive, and then installing 
 from that, but I get the same error message. I then tried calling gzfile with 
 the filename of the ZIP directly, and I seem to get a file handle without any 
 error message:

  gzfile(C:/Program Files/R/R-2.6.2/library/ada_2.0-1.zip,r)
description
   class
  C:/Program Files/R/R-2.6.2/library/ada_2.0-1.zip   
 gzfile
   mode
text
  rb6
binary
 opened
can read
   opened
   yes
  can write
   no



  It might be worth noting, that I initially I also had problems with the 
 internet download facility, which I fixed starting R with the flag 
 --internet2, as indicated in the FAQs.

  Can you please help?

  Many thanks - Philipp

  PS: I did the same on my PC at home, and there everything works without 
 problems.


  
 ==
  Please access the attached hyperlink for an important el...{{dropped:8}}

  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] boxcox.fit error

2008-03-07 Thread Bill.Venables
As the error message says: the transformation requires positive data

Your data has a minimum value at zero.  That means it is merely
non-negative.  
Positive means all the values must be greater than zero.  Strictly.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Alexys Herleym Rodriguez Avellaneda
Sent: Saturday, 8 March 2008 1:40 AM
To: r-help@r-project.org
Subject: [R] boxcox.fit error

Hi,

Thakns all for your help

I am doing the next in my dataframe tabla, column pend1, because the
Lilliefors (Kolmogorov-Smirnov) test give me a pvalue  alfa. (data no
normal distribution). I need do a transformation with box-cox or
other:


 bc - boxcox.fit(tabla$pend1)
R send to me:
Error in boxcox.fit(tabla$pend1) : Transformation requires positive data

The summary for my data is:
 summary(tabla$pend1)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.
0.012.819.820.227.257.9
 length(tabla$pend1)
[1] 4408

Someone can help me?. What is the error?

Thanks

Alexys H

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] error in random forest

2008-03-07 Thread Bill.Venables
The error message is pretty clear, really.  To spell it out a bit more,
what you have done is as follows.

Your training set has factor variables in it.  Suppose one of them is
f.  In the training set it has 5 levels, say.

Your test set also has a factor f, as it must, but it appears that in
the test set it has 6 levels, or more, or levels that do not agree with
those for f in the training set.

This mismatch measn that the predict method for randomForest cannot use
this test set.

What you have to do is make sure that the factor levels agree for every
factor in both test and training set. One way to do this is to put the
test and training set together with rbind(...) say, and then separate
them again.  But even this will still have a problem for you.  Because
you training set will have some factor levels empty, which are not empty
in the test set.  The error will most likely be more subtle, though.

You really need to sort this out yourself.  It is not particularly an R
problem, but a confusion over data.  To be useful, your training set
need to cover the field for all levels of every factor.  Think about it.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Nagu
Sent: Saturday, 8 March 2008 5:37 AM
To: r-help@r-project.org; [EMAIL PROTECTED]
Subject: [R] error in random forest

Hi,

I get the following error when I try to predict the probabilities of a
test sample:

Error in predict.randomForest(fit.EBA.OM.rf.50, x.OM, type = prob) :
  New factor levels not present in the training data

I have about 630 predictor variables in the dataset x.OM (25 factor
variables and the remaining are continuous variables). Any ideas on
how to trace it?

Thank you,
Nagu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Irregular Time Series Issue

2008-03-07 Thread Spencer Graves
  Have you considered using 'corCAR1' with 'lme' in the 'nlme' 
package? 

  Hope this helps. 
  Spencer Graves
p.s.  If you are not familiar with this, I highly recommend Pinheiro, 
J.C., and Bates, D.M. (2000) Mixed-Effects Models in S and S-PLUS 
(Springer).  The ~R\library\nlme\scripts directory contains ch01.R, 
ch02.R, etc., which contain R scripts to reproduce virtually all the 
examples in the text.  These are especially valuable for R, because the 
book was written before 'nlme' was ported to R, and there are a few 
changes for which the version in the book gives the wrong answer, while 
following the script gives the correct answer. 

A Mani wrote:
 Hello,
I have an irregular time series of the form :

 Time Data Time1 Data1 
 1   b1 e
 7  g 4i
 NA  NA   5 k
 NA  NA  NA  NA ...

 (the columns have varying length of NAs after a certain point)
 Converting this to regular time series with Pastecs does not seem to
 work, when I see the
 entire data as a single series. So I remove the NAs and deal with one
 series at a time in a loop.

 Any suggestions ?


 Thanks

 A. Mani




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] error in random forest

2008-03-07 Thread Nagu
Thank you very much. I'll jump in to the data and verify the
consistency between the training and testing variables and their
levels.

On Fri, Mar 7, 2008 at 5:14 PM,  [EMAIL PROTECTED] wrote:
 The error message is pretty clear, really.  To spell it out a bit more,
  what you have done is as follows.

  Your training set has factor variables in it.  Suppose one of them is
  f.  In the training set it has 5 levels, say.

  Your test set also has a factor f, as it must, but it appears that in
  the test set it has 6 levels, or more, or levels that do not agree with
  those for f in the training set.

  This mismatch measn that the predict method for randomForest cannot use
  this test set.

  What you have to do is make sure that the factor levels agree for every
  factor in both test and training set. One way to do this is to put the
  test and training set together with rbind(...) say, and then separate
  them again.  But even this will still have a problem for you.  Because
  you training set will have some factor levels empty, which are not empty
  in the test set.  The error will most likely be more subtle, though.

  You really need to sort this out yourself.  It is not particularly an R
  problem, but a confusion over data.  To be useful, your training set
  need to cover the field for all levels of every factor.  Think about it.



  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  On Behalf Of Nagu
  Sent: Saturday, 8 March 2008 5:37 AM
  To: r-help@r-project.org; [EMAIL PROTECTED]
  Subject: [R] error in random forest

  Hi,

  I get the following error when I try to predict the probabilities of a
  test sample:

  Error in predict.randomForest(fit.EBA.OM.rf.50, x.OM, type = prob) :
   New factor levels not present in the training data

  I have about 630 predictor variables in the dataset x.OM (25 factor
  variables and the remaining are continuous variables). Any ideas on
  how to trace it?

  Thank you,
  Nagu

  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ask for help on nonlinear fitting

2008-03-07 Thread Ruqiang Liang
I have a table like the following. I want to fit Cm to Vm like this:
Cm ~ 
Cl+Q1*b1*38.67*exp(-b1*(Vm-Vp1)*0.03867)/(1+exp(-b1*(Vm-Vp1)*0.03867))^2+Q2*b2*38.67*exp(-b2*(Vm-Vp2)*0.03867)/(1+exp(-b2*(Vm-Vp2)*0.03867))^2

I use nls, with start=list(Q1=2e-3, b1=1, Vp1=-25, Q2=3e-3, b2=1,
Vp2=200). But I always get 'singlular gradient' error like this. But
in SigmaPlot I can get the result. How can I get with R.

Thanks!

The table:

Vm Cm Ih
-147.715 8.15 -0.107
-146.944 8.081 -0.106
-146.173 8.089 -0.106
-145.409 8.114 -0.108
-144.638 8.105 -0.107
-143.873 8.085 -0.105
-143.102 8.151 -0.102
-142.338 8.084 -0.1
-141.567 8.079 -0.101
-140.796 8.077 -0.101
-140.032 8.077 -0.102
-139.261 8.126 -0.101
-138.497 8.153 -0.099
-137.726 8.129 -0.097
-136.962 8.073 -0.096
-136.191 8.088 -0.097
-135.426 8.119 -0.098
-134.655 8.121 -0.098
-133.885 8.062 -0.096
-133.12 8.135 -0.093
-132.349 8.089 -0.091
-131.585 8.065 -0.091
-130.814 8.064 -0.092
-130.05 8.071 -0.094
-129.279 8.139 -0.092
-128.515 8.15 -0.09
-127.744 8.119 -0.087
-126.973 8.074 -0.086
-126.208 8.083 -0.087
-125.438 8.084 -0.088
-124.673 8.102 -0.089
-123.902 8.083 -0.087
-123.138 8.132 -0.084
-122.367 8.108 -0.082
-121.596 8.072 -0.083
-120.832 8.07 -0.083
-120.061 8.083 -0.085
-119.297 8.134 -0.084
-118.532 8.14 -0.081
-117.762 8.119 -0.078
-116.997 8.078 -0.077
-116.226 8.102 -0.079
-115.455 8.112 -0.08
-114.691 8.104 -0.08
-113.92 8.093 -0.078
-113.156 8.126 -0.075
-112.385 8.109 -0.073
-111.621 8.066 -0.073
-110.85 8.054 -0.074
-110.085 8.077 -0.076
-109.315 8.134 -0.075
-108.544 8.133 -0.073
-107.779 8.131 -0.069
-107.008 8.093 -0.068
-106.244 8.113 -0.069
-105.473 8.094 -0.071
-104.709 8.106 -0.071
-103.938 8.1 -0.069
-103.174 8.135 -0.066
-102.403 8.115 -0.064
-101.632 8.061 -0.065
-100.868 8.05 -0.066
-100.097 8.091 -0.067
-99.332 8.122 -0.066
-98.561 8.137 -0.064
-97.797 8.123 -0.061
-97.026 8.098 -0.061
-96.255 8.117 -0.061
-95.491 8.108 -0.063
-94.72 8.107 -0.063
-93.956 8.108 -0.062
-93.185 8.144 -0.059
-92.421 8.115 -0.057
-91.65 8.078 -0.057
-90.885 8.053 -0.058
-90.114 8.093 -0.06
-89.344 8.134 -0.059
-88.579 8.147 -0.057
-87.815 8.122 -0.054
-87.044 8.08 -0.053
-86.28 8.128 -0.054
-85.509 8.094 -0.055
-84.745 8.114 -0.056
-83.974 8.119 -0.054
-83.203 8.135 -0.051
-82.438 8.122 -0.049
-81.667 8.062 -0.049
-80.903 8.072 -0.05
-80.132 8.094 -0.052
-79.368 8.142 -0.051
-78.597 8.131 -0.049
-77.826 8.122 -0.046
-77.062 8.097 -0.045
-76.291 8.138 -0.046
-75.527 8.094 -0.048
-74.756 8.124 -0.048
-73.991 8.116 -0.046
-73.221 8.137 -0.044
-72.456 8.118 -0.042
-71.685 8.082 -0.042
-70.914 8.051 -0.043
-70.15 8.089 -0.044
-69.379 8.143 -0.044
-68.615 8.14 -0.042
-67.844 8.113 -0.039
-67.08 8.099 -0.038
-66.309 8.139 -0.039
-65.544 8.084 -0.041
-64.774 8.119 -0.041
-64.003 8.144 -0.039
-63.238 8.142 -0.037
-62.467 8.142 -0.035
-61.703 8.076 -0.035
-60.932 8.069 -0.036
-60.168 8.093 -0.037
-59.397 8.133 -0.037
-58.626 8.131 -0.035
-57.862 8.107 -0.032
-57.098 8.106 -0.031
-56.327 8.146 -0.032
-55.562 8.091 -0.033
-54.791 8.12 -0.034
-54.027 8.141 -0.032
-53.256 8.138 -0.03
-52.485 8.143 -0.028
-51.721 8.071 -0.028
-50.95 8.058 -0.029
-50.186 8.097 -0.03
-49.415 8.146 -0.03
-48.651 8.128 -0.028
-47.88 8.125 -0.025
-47.115 8.116 -0.024
-46.344 8.15 -0.025
-45.573 8.092 -0.026
-44.809 8.142 -0.027
-44.038 8.159 -0.026
-43.274 8.164 -0.023
-42.503 8.161 -0.021
-41.739 8.078 -0.021
-40.968 8.079 -0.022
-40.204 8.105 -0.024
-39.433 8.157 -0.023
-38.662 8.15 -0.021
-37.897 8.131 -0.018
-37.127 8.122 -0.017
-36.362 8.149 -0.018
-35.591 8.092 -0.02
-34.827 8.138 -0.02
-34.056 8.16 -0.019
-33.285 8.152 -0.017
-32.521 8.164 -0.014
-31.75 8.092 -0.014
-30.986 8.074 -0.015
-30.215 8.094 -0.017
-29.45 8.148 -0.016
-28.68 8.151 -0.014
-27.915 8.121 -0.012
-27.144 8.125 -0.01
-26.38 8.162 -0.011
-25.609 8.094 -0.012
-24.845 8.132 -0.013
-24.074 8.17 -0.011
-23.31 8.158 -0.01
-22.539 8.153 -0.007
-21.774 8.081 -0.007
-21.004 8.09 -0.008
-20.233 8.103 -0.01
-19.468 8.151 -0.009
-18.697 8.124 -0.007
-17.933 8.132 -0.005
-17.162 8.122 -0.003
-16.398 8.149 -0.004
-15.627 8.081 -0.005
-14.863 8.13 -0.006
-14.092 8.157 -0.004
-13.321 8.175 -0.003
-12.557 8.157 0
-11.786 8.078 0
-11.021 8.085 -0.001
-10.25 8.106 -0.002
-9.486 8.145 -0.002
-8.715 8.13 0
-7.944 8.136 0.003
-7.18 8.108 0.005
-6.409 8.132 0.004
-5.645 8.099 0.002
-4.874 8.134 0.002
-4.11 8.158 0.003
-3.339 8.165 0.005
-2.574 8.162 0.008
-1.803 8.082 0.008
-1.033 8.087 0.007
-0.268 8.096 0.005
0.503 8.137 0.006
1.267 8.121 0.008
2.038 8.122 0.01
2.802 8.12 0.012
3.566 8.124 0.011
4.337 8.091 0.01
5.108 8.125 0.009
5.873 8.147 0.011
6.643 8.172 0.013
7.408 8.146 0.015
8.179 8.081 0.016
8.943 8.086 0.015
9.714 8.114 0.013
10.485 8.131 0.014
11.249 8.103 0.016
12.02 8.127 0.018
12.784 8.108 0.02
13.555 8.107 0.019
14.32 8.087 0.018
15.09 8.106 0.017
15.855 8.142 0.019
16.626 8.164 0.021
17.397 8.138 0.024
18.161 8.068 0.024
18.932 8.075 0.023
19.696 8.088 0.022
20.467 8.126 0.022
21.231 8.103 0.025
22.002 8.127 0.027