Re: [R] bug checking

2005-10-12 Thread Parlamis Franklin
Thanks all for following up.  I'll consider the bug "filed."

I should note for the record that if 'col="red"' is replaced in my  
code by 'col.main="red"' the x axis is still made red.

I'll use the workaround for now (for which thanks).  Even with little  
things like this, plotting from the command line in R is orders  
better than dragging a bunch of frames around an Excel window.

On Oct 11, 2005, at 6:34 PM, Marc Schwartz wrote:

> Thanks for the code and the clarifications, including the PDF file.
>
> Yes, I can replicate the behavior here (R 2.2.0 on FC4) and I am  
> cc:ing
> Kurt Hornik, who ported chron to R and is the chron package  
> maintainer.
>
> It appears that the "culprit" is the argument 'col = "red"', which
> towards the end of plot.times() is used as follows:
>
> ...
> else if (x.times)
> axis.times(1, x, simplify = simplify, labels = TRUE,
> adj = adj, col = col, cex = cex, font = font,
> las = las, lab = lab, mgp = mgp, tcl = tcl)
> ...
>
> Thus, if the 'x' data is of class 'times', the above code is used and
> the color of the axis line and tick marks are set to "red" as per the
> 'col' argument to axis(), which axis.times() ultimately calls.
>
> This results in the behavior that you are seeing, where both the plot
> symbols/lines and the axis are colored the same.
>
> This does sound like a bug and Kurt can comment better on this.
>
> HTH,
>
> Marc Schwartz
>
>
> On Tue, 2005-10-11 at 18:02 -1000, Parlamis Franklin wrote:
>
>> ## Code was long, so I simplified it by creating vectors from scratch
>> so it would run as is.  Putative "bug" is still evidenced on the x  
>> axis
>>
>> discount.factors.dates <- seq.dates(from="09/30/2005",  
>> to="09/30/2035")
>> rates<-seq(4.4, 5.2, by=0.0025);
>> plot(discount.factors.dates[1:length(rates)], rates,
>>   pch=18, las=1, bty="n",
>>   col="red", col.main="red",
>>   xlab="Date", ylab="Rate",
>>   ylim=c(min(rates)-(max(rates)-min(rates))/10,max(rates)+(max
>> (rates)-min(rates))/10))
>>
>> ## This is the output:
>>
>> ## Hopefully you all see the red x axis.
>>
>> ## I am running R Cocoa GUI 1.1.2 with R 2.1.1 framework on a dual
>> proc 2.7 Ghz Power Mac.  A Quartz device is opened when 'plot' is
>> called.  X11User and X11SDK are installed on t he computer, as well
>> as xCode 2.1 (in case that's relevant).
>>
>>
>> On Oct 11, 2005, at 4:47 PM, Marc Schwartz wrote:
>>
>>
>>> On Tue, 2005-10-11 at 16:07 -1000, Parlamis Franklin wrote:
>>>
>>>
 I have observed the following behavior, wondering if it is a bug
 before I submit a report.

 I am using the plot function with call:  plot(X, Y,
 col="red", . . . ) where X is an object that inherits from classes
 'dates' and 'times' (created with the 'dates' function from package
 'chron') and y is a numeric vector.  The color red is applied to  
 the
 area from the first to the last tick mark on the x axis (even if I
 don't set col="red" and only set, say col.main="red").

 If instead of feeding the function X, I feed it unclass(X) or
 as.vector(X) the red color is not applied to the area between the
 first and last ticks on the x axis.

 Is this a bug, or just a consequence of there not being a plot  
 method
 for the class I am trying to feed the function?

 Franklin Parlamis


>>>
>>> As per the Posting Guide, it would be immensely helpful in the  
>>> attempt
>>> to help you, if you would provide the exact code you are using and
>>> some
>>> sample data here, so that we can exactly replicate what you are
>>> experiencing.
>>>
>>> Lacking that, it would be difficult to assist as we can only  
>>> guess. It
>>> does sound like there is an _appropriate_ change in the plot method
>>> behavior as a direct consequence of your modifying the class of the
>>> argument(s), which is of course how methods are dispatched. Thus,  
>>> if I
>>> were to guess, this is not a bug.
>>>
>>> I would however, certainly recommend that you submit an example
>>> here to
>>> confirm the behavior, before you post a bug report, as that would
>>> avoid
>>> a more energetic response.
>>>
>>> Marc Schwartz
>>>
>>>
>>>
>>>
>>
>>
>
>

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


Re: [R] General note on help list...

2005-10-12 Thread Murray Pung
I believe if you unsubscribe from the list, but send any questions to the 
address r-help@stat.math.ethz.ch, that should work, assuming those who respond 
to you question include your email address as well as the mailing list address 
in their reply (which I think is usually the case).

Murray

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 12 October 2005 4:45 PM
To: r-help@stat.math.ethz.ch
Subject: [R] General note on help list...


R-Helpers

I am just getting started with R and am learning the basics.

I have 'Introductory Statistics with R' by Dalgaard and decided to join this 
help forum too.

At present, I am receiving approx. 40 posts per day regarding R queries by 
various list members. Is there any way to turn that feature off such that I 
only receive responses to my questions?

Once I learn the basics then I will benefit from reading other members 
questions...but for now it is more confusing for me than helpful.

I appreciate any guidance...

Regards


Alex

-
Email sent from www.ntlworld.com
Virus-checked using McAfee(R) Software 
Visit www.ntlworld.com/security for more information

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

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


Re: [R] problem in installing a package

2005-10-12 Thread Ting-Yuan Liu

Hi Claire,

For the R CMD check error... It seems that you used some special 
characters, such as "_", in your Rd files so that Latex can not handle 
them.  Try to add the escape charatcer "\" before these special 
characters.

HTH,
Ting-Yuan

On Wed, 5 Oct 2005, Claire Lee wrote:

> I'm using R in Windows XP. I created a package myself.
> I've used R CMD check to check it. Everything seems OK
> except the latex. I get the error message:
> * checking bbHist-manual.tex ... ERROR
> LaTeX errors when creating DVI version.
> This typically indicates Rd problems.
> 
> I ignored it because I didn't want to submit it to
> CRAN.
> 
> Then I tried to use R CMD INSTALL to install it. First
> I get: 
> "mv: cannot move `c:/PROGRA~1/R/rw2011/library/bbHist'
> to `c:/PROGRA~1/R/rw2011/library/00LOCK/bbHist
> ': Permission denied" 
> 
> and a bunch of making DLL errors.  Then when I tried a
> second time, I get:
> 
> open(c:/progra~1/r/rw2011/library/bbHist/DESCRIPTION):
> No such file or directory
> 
> I can see a 00LOCK directory is created in the
> c:/PROGRA~1/R/rw2011/library directory. Any idea why
> this is happening?
> 
> Thanks.
> 
> Claire
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


[R] step.gam and number of tested smooth functions

2005-10-12 Thread astrzelczak

Hi,

I'm working with step.gam in gam package. I'm interested both in spline and
lowess functions and when I define all the models that I'm interested in I get
something like that:

> gam.object.ALC<-gam(X143S~ALC,data=dane,family=binomial)
>
step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC+s(ALC,2)+s(ALC,3)+s(ALC,4)+s(ALC,6)+s(ALC,8)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))
Start:  X143S ~ ALC; AIC= 104.0815
Trial:  X143S ~  1; AIC= 111.1054
Trial:  X143S ~  s(ALC, 2); AIC= 103.3325
Step :  X143S ~ s(ALC, 2) ; AIC= 103.3325

Trial:  X143S ~  s(ALC, 3); AIC= 102.9598
Step :  X143S ~ s(ALC, 3) ; AIC= 102.9598

Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103

Trial:  X143S ~  s(ALC, 6); AIC= 102.4548

I have impression that the algorithm stops when the next trial gives higher AIC
without examining further functions. When I deleted some of the spline functions
that were worse than s(ALC,4) I got:

 >
step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC++s(ALC,4)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))
Start:  X143S ~ ALC; AIC= 104.0815
Trial:  X143S ~  1; AIC= 111.1054
Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103

Trial:  X143S ~  lo(ALC, degree = 1, span = 0.5); AIC= 99.8127
Step :  X143S ~ lo(ALC, degree = 1, span = 0.5) ; AIC= 99.8127

Trial:  X143S ~  lo(ALC, degree = 2, span = 0.5); AIC= 100.5275

Lowess turned out to be better in this situation. Is there any way to examine
all the models without stopping when AIC is higher in the next trial? Or maybe
manual handling is the only solution?

thanks for help in advance

Agnieszka Strzelczak

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


Re: [R] step.gam and number of tested smooth functions

2005-10-12 Thread Prof Brian Ripley
step.gam is a tricky function to use correctly.  You will need to consult 
the original documentation (in Chambers & Hastie ca 1992) or ask the 
package author for help.

BTW, it uses loess not lowess.

On Wed, 12 Oct 2005 [EMAIL PROTECTED] wrote:

>
> Hi,
>
> I'm working with step.gam in gam package. I'm interested both in spline and
> lowess functions and when I define all the models that I'm interested in I get
> something like that:
>
>> gam.object.ALC<-gam(X143S~ALC,data=dane,family=binomial)
>>
> step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC+s(ALC,2)+s(ALC,3)+s(ALC,4)+s(ALC,6)+s(ALC,8)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))
> Start:  X143S ~ ALC; AIC= 104.0815
> Trial:  X143S ~  1; AIC= 111.1054
> Trial:  X143S ~  s(ALC, 2); AIC= 103.3325
> Step :  X143S ~ s(ALC, 2) ; AIC= 103.3325
>
> Trial:  X143S ~  s(ALC, 3); AIC= 102.9598
> Step :  X143S ~ s(ALC, 3) ; AIC= 102.9598
>
> Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
> Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103
>
> Trial:  X143S ~  s(ALC, 6); AIC= 102.4548
>
> I have impression that the algorithm stops when the next trial gives higher 
> AIC
> without examining further functions. When I deleted some of the spline 
> functions
> that were worse than s(ALC,4) I got:
>
> >
> step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC++s(ALC,4)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))
> Start:  X143S ~ ALC; AIC= 104.0815
> Trial:  X143S ~  1; AIC= 111.1054
> Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
> Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103
>
> Trial:  X143S ~  lo(ALC, degree = 1, span = 0.5); AIC= 99.8127
> Step :  X143S ~ lo(ALC, degree = 1, span = 0.5) ; AIC= 99.8127
>
> Trial:  X143S ~  lo(ALC, degree = 2, span = 0.5); AIC= 100.5275
>
> Lowess turned out to be better in this situation. Is there any way to examine
> all the models without stopping when AIC is higher in the next trial? Or maybe
> manual handling is the only solution?
>
> thanks for help in advance
>
> Agnieszka Strzelczak
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

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


[R] arima with R

2005-10-12 Thread giacomo moro
Hi,
I'm using R for some arima models. In the past I used for arima models Rats and 
Tsp. Using the R arima function, I get only the statistics sigma^2 and log 
likelihood; with Rats and Tsp it is possible to obtain more statistics, such as 
R, R square, Durbin Watson, standard error, etc. 
Is it possible using R to have the statistics mentioned?
My best regards,
  Giacomo



-

[[alternative HTML version deleted]]

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


[R] Historical England and Wales Shape Files

2005-10-12 Thread Camarda, Carlo Giovanni
Dear R-user,
I would like to apply spatial statistics on some historical data, in
particular from 1850 to 1900 by registration district of England and
Wales.
I have searched in the R-archive, but unsuccessfully.
Do you know whether R contains those shape files? Or where would be
possible to download and use in R?
Thanks in advance,
Carlo Giovanni Camarda


+
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

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


Re: [R] Under-dispersion - a stats question?

2005-10-12 Thread Martin Henry H. Stevens

Hello all:
Thank you for you interest.

This text of this email  is in the attached "R-help.r" file.
The R script is in "R-helpscript.r".
The data set is "wk6trial.csv".


One of my students has performed a laboratory experiment with petri  
dishes containing hundreds of  species of bacteria, and six species  
each of algae and ciliated protozoans. Our goal was to examine the  
effects of nutrient concentration and dish size on the number of  
species of each group remaining after six weeks.


I attached the data set and some code for the algae analysis.

We had four dish sizes (factor), seven nutrient concentrations  
(continuous), and three replicates of each unique treatment  
combination, for a total n = 84.


Our response variables were (i) the number of bacterial species  
(0-400 species, modeled with quasipoisson), (ii) the proportion of  
algae species (out of six initial species - modeled with binomial)  
and (iii) the proportion of protozoan species (out of six initial  
species - modeled with binomial). For algae and protozoans, we  
modeled the proportion of species rather than the raw number because  
in each case we were constrained by the design to have between 0 and  
6 species. I discussed this with a local statistician, and he thought  
it made sense.


Each of these response variables is the combined result of both  
unknown species' responses to treatments as well as the unknown  
interactions among species. Further, these three responses are  
themselves interdependent to some degree. For instance, the number  
and identity of protozoan species may influence the number of  
bacterial species. Nonetheless, it is common practice in ecology to  
model the number of species of a group (or its logarithm)  with a  
univariate model assuming either a normal or Poisson error  
distribution. I would HAPPILY learn better.


While modeling these groups, I consulted a few texts (Neter et al.  
1996, Venables and Ripley 2002, Dalgaard 2002, Crawley 2002, Fox  
2002) and attempted to follow standard procedures laid out in these  
books.


For the algae and the protozoans, I began with a binomial model,

glm(cbind(AS, 6-AS) ~ Nutrients + I(Nutrients^2) + Size +
Nutrients:Size + I(Nutrients^2):Size, data=dat,  
family=binomial)


where AS is the number of algae species in a dish. I retained this  
family upon observation that the residual dev. / residual DF was (for  
algae) = 0.19. I minimized the model by hand based on the F tests  
(not the treatment contrast coefficients, after V&R p. 197 - Hauck  
and Donner 1977) and using step() and found that the only significant  
treatment was a linear effect of nutrient concentration. I examined  
the qq plot, the resid ~ fitted plot, and Cook's distances and  
everything looked fine.


When I repeated this with quasibinomial, it estimated the dispersion  
parameter (0.19), I found that both Size and Nutrients were  
significant (no interaction).


So,... my orignal question to the list was, is it appropriate to  
model and fit the error distribution with quasi- functions if  
dispersion seems much less than 1.0?


Now I am unclear how to evaluate under-dispersion (even after  
consulting V&R 2002, p. 208-209).


Upon reading through this, if you made it this far, you may have lots  
of other comments as well, and I truly hope to become better educated  
as a result!


BTW, I modeled the bacteria with a quasipoisson (dispersion = 91!).  
Perhaps a negative binomial would have been better?


Many thanks for your inputs,
Hank Stevens




On Oct 12, 2005, at 1:10 AM, Jari Oksanen wrote:


On Tue, 2005-10-11 at 17:16 -0400, Kjetil Holuerson wrote:


Martin Henry H. Stevens wrote:


Hello all:
I frequently have glm models in which the residual variance is much
lower than the residual degrees of freedom (e.g. Res.Dev=30.5,  
Res.DF

= 82). Is it appropriate for me to use a quasipoisson error
distribution and test it with an F distribution? It seems to me that
I could stand to gain a much-reduced standard error if I let the
procedure estimate my dispersion factor (which is what I assume the
quasi- distributions do).




I did'nt see an answer to this. maybe you could treat as a
quasimodel, but first you should ask why there is underdispersion.

Underdispersion could arise if you have dependent responses, for
instance, competition (say, between plants) could produce
underdispersion. Then you would be better off changing to an  
appropriate

model. maybe you could post more about your experimental setup?


Some ecologists from Bergen, Norway, suggest using quasipoisson  
with its

underdispersed residual error (while I wouldn't do that). However, it
indeed would be useful to know a bit more about the setup, like the  
type

of dependent variable. If the dependent variable happens to be the
number of species (like it's been in some papers by MHHS), this
certainly is *not* Poisson nor quasi-Poisson nor in the exponential
family, although it so often is mo

Re: [R] arima with R

2005-10-12 Thread ronggui
armaFit in package "fSeries " will give the result in details.


=== 2005-10-12 17:55:13 您在来信中写道:===

>Hi,
>I'm using R for some arima models. In the past I used for arima models Rats 
>and Tsp. Using the R arima function, I get only the statistics sigma^2 and log 
>likelihood; with Rats and Tsp it is possible to obtain more statistics, such 
>as R, R square, Durbin Watson, standard error, etc. 
>Is it possible using R to have the statistics mentioned?
>My best regards,
>  Giacomo
>
>
>   
>-
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

= = = = = = = = = = = = = = = = = = = =



 

2005-10-12

--
Deparment of Sociology
Fudan University

My new mail addres is [EMAIL PROTECTED]
Blog:http://sociology.yculblog.com

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

Re: [R] adding 1 month to a date

2005-10-12 Thread bogdan romocea
Simple addition and subtraction works as well:
  as.Date("1995/12/01",format="%Y/%m/%d") + 30
If you have datetime values you can use
  strptime("1995-12-01 08:00:00",format="%Y-%m-%d %H:%M:%S") + 30*24*3600
where 30*24*3600 = 30 days expressed in seconds.


> -Original Message-
> From: Marc Schwartz [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 11, 2005 10:16 PM
> To: t c
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] adding 1 month to a date
>
>
> On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
> > Within an R dataset, I have a date field called date_.
> (The dates are
> > in the format -MM-DD, e.g. 1995-12-01.)
>
> > How can I add or subtract 1 month from this date, to get
> 1996-01-01 or
> > 1995-11-01.
>
> There might be an easier way to do this, but using seq.Date(), you can
> increment or decrement from a Time 0 by months:
>
> Add 1 month:
>
> This takes your Time 0, generates a 2 element sequence (which begins
> with Time 0) and then takes the second element:
>
> > seq(as.Date("1995-12-01"), by = "month", length = 2)[2]
> [1] "1996-01-01"
>
>
>
> Subtract 1 month:
>
> Same as above, but we use 'by = "-1 month"' and take the
> second element:
>
> > seq(as.Date("1995-12-01"), by = "-1 month", length = 2)[2]
> [1] "1995-11-01"
>
>
> See ?as.Date and ?seq.Date for more information. The former
> function is
> used to convert from a character vector to a Date class object. Note
> that in your case, the date format is consistent with the default. Pay
> attention to the 'format' argument in as.Date() if your dates
> should be
> in other formats.
>
> HTH,
>
> Marc Schwartz
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

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


Re: [R] adding 1 month to a date

2005-10-12 Thread Prof Brian Ripley
On Wed, 12 Oct 2005, bogdan romocea wrote:

> Simple addition and subtraction works as well:
>  as.Date("1995/12/01",format="%Y/%m/%d") + 30
> If you have datetime values you can use
>  strptime("1995-12-01 08:00:00",format="%Y-%m-%d %H:%M:%S") + 30*24*3600
> where 30*24*3600 = 30 days expressed in seconds.

Sorry, not in general, as a month is not generally of 30 days (including 
in your example).

seq.Date is a good way to do this.

>
>
>> -Original Message-
>> From: Marc Schwartz [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, October 11, 2005 10:16 PM
>> To: t c
>> Cc: r-help@stat.math.ethz.ch
>> Subject: Re: [R] adding 1 month to a date
>>
>>
>> On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
>>> Within an R dataset, I have a date field called date_.
>> (The dates are
>>> in the format -MM-DD, e.g. 1995-12-01.)
>>
>>> How can I add or subtract 1 month from this date, to get
>> 1996-01-01 or
>>> 1995-11-01.
>>
>> There might be an easier way to do this, but using seq.Date(), you can
>> increment or decrement from a Time 0 by months:
>>
>> Add 1 month:
>>
>> This takes your Time 0, generates a 2 element sequence (which begins
>> with Time 0) and then takes the second element:
>>
>>> seq(as.Date("1995-12-01"), by = "month", length = 2)[2]
>> [1] "1996-01-01"
>>
>>
>>
>> Subtract 1 month:
>>
>> Same as above, but we use 'by = "-1 month"' and take the
>> second element:
>>
>>> seq(as.Date("1995-12-01"), by = "-1 month", length = 2)[2]
>> [1] "1995-11-01"
>>
>>
>> See ?as.Date and ?seq.Date for more information. The former
>> function is
>> used to convert from a character vector to a Date class object. Note
>> that in your case, the date format is consistent with the default. Pay
>> attention to the 'format' argument in as.Date() if your dates
>> should be
>> in other formats.
>>
>> HTH,
>>
>> Marc Schwartz
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

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


Re: [R] bug checking

2005-10-12 Thread Marc Schwartz
Three additional comments:

1. The same phenomena occurs on the y axis if the x and y values are
reversed.

2. I neglected to mention this last night (my time), but given that
"chron" is not part of the base R distribution, the proper procedure for
actually filing a bug against the package would be to contact the
author/maintainer (Kurt) and not to file a bug in the main R bug
tracking system.

3. The problem with 'col.main' is I believe a result of this argument
being passed as part of the "..." arguments to plot.times(). Hence you
end up with partial matching of the argument here, so "col.main" is
operated upon in the same fashion as "col".

HTH,

Marc Schwartz


On Tue, 2005-10-11 at 21:06 -1000, Parlamis Franklin wrote:
> Thanks all for following up.  I'll consider the bug "filed."
> 
> I should note for the record that if 'col="red"' is replaced in my  
> code by 'col.main="red"' the x axis is still made red.
> 
> I'll use the workaround for now (for which thanks).  Even with little  
> things like this, plotting from the command line in R is orders  
> better than dragging a bunch of frames around an Excel window.
> 
> On Oct 11, 2005, at 6:34 PM, Marc Schwartz wrote:
> 
> > Thanks for the code and the clarifications, including the PDF file.
> >
> > Yes, I can replicate the behavior here (R 2.2.0 on FC4) and I am  
> > cc:ing
> > Kurt Hornik, who ported chron to R and is the chron package  
> > maintainer.
> >
> > It appears that the "culprit" is the argument 'col = "red"', which
> > towards the end of plot.times() is used as follows:
> >
> > ...
> > else if (x.times)
> > axis.times(1, x, simplify = simplify, labels = TRUE,
> > adj = adj, col = col, cex = cex, font = font,
> > las = las, lab = lab, mgp = mgp, tcl = tcl)
> > ...
> >
> > Thus, if the 'x' data is of class 'times', the above code is used and
> > the color of the axis line and tick marks are set to "red" as per the
> > 'col' argument to axis(), which axis.times() ultimately calls.
> >
> > This results in the behavior that you are seeing, where both the plot
> > symbols/lines and the axis are colored the same.
> >
> > This does sound like a bug and Kurt can comment better on this.
> >
> > HTH,
> >
> > Marc Schwartz
> >
> >
> > On Tue, 2005-10-11 at 18:02 -1000, Parlamis Franklin wrote:
> >
> >> ## Code was long, so I simplified it by creating vectors from scratch
> >> so it would run as is.  Putative "bug" is still evidenced on the x  
> >> axis
> >>
> >> discount.factors.dates <- seq.dates(from="09/30/2005",  
> >> to="09/30/2035")
> >> rates<-seq(4.4, 5.2, by=0.0025);
> >> plot(discount.factors.dates[1:length(rates)], rates,
> >>   pch=18, las=1, bty="n",
> >>   col="red", col.main="red",
> >>   xlab="Date", ylab="Rate",
> >>   ylim=c(min(rates)-(max(rates)-min(rates))/10,max(rates)+(max
> >> (rates)-min(rates))/10))
> >>
> >> ## This is the output:
> >>
> >> ## Hopefully you all see the red x axis.
> >>
> >> ## I am running R Cocoa GUI 1.1.2 with R 2.1.1 framework on a dual
> >> proc 2.7 Ghz Power Mac.  A Quartz device is opened when 'plot' is
> >> called.  X11User and X11SDK are installed on t he computer, as well
> >> as xCode 2.1 (in case that's relevant).
> >>
> >>
> >> On Oct 11, 2005, at 4:47 PM, Marc Schwartz wrote:
> >>
> >>
> >>> On Tue, 2005-10-11 at 16:07 -1000, Parlamis Franklin wrote:
> >>>
> >>>
>  I have observed the following behavior, wondering if it is a bug
>  before I submit a report.
> 
>  I am using the plot function with call:  plot(X, Y,
>  col="red", . . . ) where X is an object that inherits from classes
>  'dates' and 'times' (created with the 'dates' function from package
>  'chron') and y is a numeric vector.  The color red is applied to  
>  the
>  area from the first to the last tick mark on the x axis (even if I
>  don't set col="red" and only set, say col.main="red").
> 
>  If instead of feeding the function X, I feed it unclass(X) or
>  as.vector(X) the red color is not applied to the area between the
>  first and last ticks on the x axis.
> 
>  Is this a bug, or just a consequence of there not being a plot  
>  method
>  for the class I am trying to feed the function?
> 
>  Franklin Parlamis
> 
> 
> >>>
> >>> As per the Posting Guide, it would be immensely helpful in the  
> >>> attempt
> >>> to help you, if you would provide the exact code you are using and
> >>> some
> >>> sample data here, so that we can exactly replicate what you are
> >>> experiencing.
> >>>
> >>> Lacking that, it would be difficult to assist as we can only  
> >>> guess. It
> >>> does sound like there is an _appropriate_ change in the plot method
> >>> behavior as a direct consequence of your modifying the class of the
> >>> argument(s), which is of course how methods are dispatched. Thus,  
> >>> if I
> >>> were to guess, this is not a bug.
> >>>
> >>> I would however, certainly recommend th

[R] Newbie problem with read.table

2005-10-12 Thread Jan Conrad
Hi R,
 I have a seemingly simple problem. I have a table in following format
(tab seperated)

   Njets NBjets NElec NMuon   Meff  HTHT3j  HEAplan
Plan   
1  4 3  2   0   366.278 253.642 87.7473   1385
0.0124566   0.376712   
2  3 1  1   0   235.19  157.688 18.2852
574.253 0.00064187  0.00528814 

I read in with:

> ttbar<-read.table("test2.dat",header=TRUE)


> ttbar
  Njets NBjets NElec NMuonMeff  HTHT3j   HE  Aplan
1 4  3 2 0 366.278 253.642 87.7473 1385.000 0.01245660
2 3  1 1 0 235.190 157.688 18.2852  574.253 0.00064187
Plan
1 0.37671200
2 0.00528814,

 i.e.. the table is split after 9 variables. How come ?

Thanks,
Jan

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


Re: [R] adding 1 month to a date

2005-10-12 Thread Marc Schwartz
Thanks to Prof. Ripley for pointing this out.

One of the approaches that I had considered here was to set up a vector
of the number of days in each month (adjusting of course for leap
years), and use "day arithmetic" to add/subtract the appropriate number
of days.

However, it was easier to use seq.Date() and to further consider putting
a wrapper around it to make it yet even easier to use.

Marc

On Wed, 2005-10-12 at 13:23 +0100, Prof Brian Ripley wrote:
> On Wed, 12 Oct 2005, bogdan romocea wrote:
> 
> > Simple addition and subtraction works as well:
> >  as.Date("1995/12/01",format="%Y/%m/%d") + 30
> > If you have datetime values you can use
> >  strptime("1995-12-01 08:00:00",format="%Y-%m-%d %H:%M:%S") + 30*24*3600
> > where 30*24*3600 = 30 days expressed in seconds.
> 
> Sorry, not in general, as a month is not generally of 30 days (including 
> in your example).
> 
> seq.Date is a good way to do this.
> 
> >
> >
> >> -Original Message-
> >> From: Marc Schwartz [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, October 11, 2005 10:16 PM
> >> To: t c
> >> Cc: r-help@stat.math.ethz.ch
> >> Subject: Re: [R] adding 1 month to a date
> >>
> >>
> >> On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
> >>> Within an R dataset, I have a date field called date_.
> >> (The dates are
> >>> in the format -MM-DD, e.g. 1995-12-01.)
> >>
> >>> How can I add or subtract 1 month from this date, to get
> >> 1996-01-01 or
> >>> 1995-11-01.
> >>
> >> There might be an easier way to do this, but using seq.Date(), you can
> >> increment or decrement from a Time 0 by months:
> >>
> >> Add 1 month:
> >>
> >> This takes your Time 0, generates a 2 element sequence (which begins
> >> with Time 0) and then takes the second element:
> >>
> >>> seq(as.Date("1995-12-01"), by = "month", length = 2)[2]
> >> [1] "1996-01-01"
> >>
> >>
> >>
> >> Subtract 1 month:
> >>
> >> Same as above, but we use 'by = "-1 month"' and take the
> >> second element:
> >>
> >>> seq(as.Date("1995-12-01"), by = "-1 month", length = 2)[2]
> >> [1] "1995-11-01"
> >>
> >>
> >> See ?as.Date and ?seq.Date for more information. The former
> >> function is
> >> used to convert from a character vector to a Date class object. Note
> >> that in your case, the date format is consistent with the default. Pay
> >> attention to the 'format' argument in as.Date() if your dates
> >> should be
> >> in other formats.
> >>
> >> HTH,
> >>
> >> Marc Schwartz

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


[R] Questions about readBin function (Was: dec2bin?)

2005-10-12 Thread Tuszynski, Jaroslaw W.
Hi,

The latest version of R had some changes to functions "readbin() and
writeBin() [which] now support raw vectors as well as filenames and
connections.". As a result I am working on retiring "raw2bin" and "bin2raw"
functions from "caTools" package which do exactly the same. Thanks to Prof.
Ripley for bringing this change to my attention.

Which brings me to my question: how to use readBin function to read the
whole file or vector "con" and not just requested number of elements (n)
from it? In other words what to do if I do not know what to set argument "n"
to ("The (maximal) number of records to be read"), and want to read all
records?  

So far the simplest solution I found is to measure vector length (or file
size) of "con" and set n to length()%/%size. Which gets quite messy if
"size" is not provided and have to be deduced from "what" (see code below).
Am I missing something? Is there an easier way to read the whole file or
vector? Shouldn't that be the default?

readBin(con, what, n = 1, size = NA, signed = TRUE, endian =
.Platform$endian)

bin2raw = function(x, ...) writeBin(x, raw(), ...) # old bin2raw can be
easily written using curent writeBin

raw2bin = function(r, what, size=NA, ...)
{
  TypeList = c("logical", "integer", "double", "complex", "character",
"raw", 
   "numeric", "int")
  if (!is.character(what) || length(what) != 1 || !(what %in% TypeList)) 
what <- typeof(what)
  if (!is.vector(r) || mode(r) == "list") 
stop("raw2bin: 'r' has to be vector of type 'raw'")
  if (what=="raw") return(r)
  if (!is.na(size)) nBits=size 
  else nBits = switch(match(typeof(x), TypeList), 4, 4, 8, 16, 2, 1, 8, 4) 
  n = length(r)
  if (n%%nBits) 
stop("raw2bin: number of elements in 'r' is not multiple of 'size'")
  x = readBin(r, what, n = n%/%nBits, size=size, ...)
  return (x)
}

 Jarek 
\ 
 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192   ">  \ 
 [EMAIL PROTECTED] `   \

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


Re: [R] Newbie problem with read.table

2005-10-12 Thread Marc Schwartz
On Wed, 2005-10-12 at 14:31 +0200, Jan Conrad wrote:
> Hi R,
>  I have a seemingly simple problem. I have a table in following format
> (tab seperated)
> 
>Njets NBjets   NElec NMuon   Meff  HTHT3j  HEAplan
> Plan 
> 1  4 32   0   366.278 253.642 87.7473   1385
> 0.0124566   0.376712   
> 2  3 11   0   235.19  157.688 18.2852
> 574.253 0.00064187  0.00528814 
> 
> I read in with:
> 
> > ttbar<-read.table("test2.dat",header=TRUE)
> 
> 
> > ttbar
>   Njets NBjets NElec NMuonMeff  HTHT3j   HE  Aplan
> 1 4  3 2 0 366.278 253.642 87.7473 1385.000 0.01245660
> 2 3  1 1 0 235.190 157.688 18.2852  574.253 0.00064187
> Plan
> 1 0.37671200
> 2 0.00528814,
> 
>  i.e.. the table is split after 9 variables. How come ?
> 
> Thanks,
> Jan

As per ?read.table, the default delimiter is 'sep = ""', which is any
"whitespace".

Hence, if your file is tab delimited, you need to modify your call to:

  ttbar <- read.table("test2.dat", header = TRUE, sep = "\t")

HTH,

Marc Schwartz

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


Re: [R] Newbie problem with read.table

2005-10-12 Thread Roger Bivand
On Wed, 12 Oct 2005, Jan Conrad wrote:

> Hi R,
>  I have a seemingly simple problem. I have a table in following format
> (tab seperated)
> 
>Njets NBjets   NElec NMuon   Meff  HTHT3j  HEAplan
> Plan 
> 1  4 32   0   366.278 253.642 87.7473   1385
> 0.0124566   0.376712   
> 2  3 11   0   235.19  157.688 18.2852
> 574.253 0.00064187  0.00528814 
> 
> I read in with:
> 
> > ttbar<-read.table("test2.dat",header=TRUE)
> 
> 
> > ttbar
>   Njets NBjets NElec NMuonMeff  HTHT3j   HE  Aplan
> 1 4  3 2 0 366.278 253.642 87.7473 1385.000 0.01245660
> 2 3  1 1 0 235.190 157.688 18.2852  574.253 0.00064187
> Plan
> 1 0.37671200
> 2 0.00528814,
> 
>  i.e.. the table is split after 9 variables. How come ?

> options("width")
$width
[1] 80

says what the width of your console is. Columns beyond this get wrapped 
gently (not each row by itself) - it can be set different values if you 
choose - try:

ow <- options("width")
options(width=40)
options("width")
ttbar
options(ow)
options("width")

So this is just the print function for data.frame objects doing its unsung
job. A very useful function for looking at things when they don't seem to
be what you think is str(), which concisely says what the structure of an
object is, so str(ttbar)  should tell you that it is a data frame of 10
variables and 2 observations.

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

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


[R] Model parameterization / Factor Levels

2005-10-12 Thread Peyuco Porras Porras .
Dear R users; 

I'm looking for some hint about how to deal with the following situation: 

Response = Y 
Factor A = levels: 0, 1 
Factor B = levels: 0, 1 
Factor C = levels: 1,2,3,4 

Model: Logistic 3-parms. 
where th1~1+A+C, th2~1+C; th3~1 

For 'simplicity' (for me) I'm using the SAS contrast parameterization. 

The output looks like 

Beta p-value 
th1.(Intercept) 550 <0.000 
th1.A1 -15 <0.000 
th1.B1 5 <0.032 
th1.C1 -12 <0.001 
th1.C2 -5 0.022 
th1.C3 -3 0.222 
th2.(Intercept) .. 

..etc 

if we look at the results, we may conclude that level 3 for Factor C is not 
statiscally significant. The question is: How can I remove this level of this 
factor 
from the analysis? Let's say that the final results looks like 

Model: Logistic 3-parms. 
where th1~1+A+C, th2~1+C; th3~1, but C with levels 1,2 and 4 only 

Beta p-value 
th1.(Intercept) 560 <0.000 
th1.A1 -15 <0.000 
th1.B1 5 <0.032 
th1.C1 -15 <0.001 
th1.C2 -8 0.031 
th2.(Intercept) .. 

..etc 


I tried replacing Factor C by 4 different columns, say FACTORC_1, FACTOR_C2, 
FACTOR_C3, and FACTOR_C4 each one of them with 0 or 1, and the model I tried 
was 

f1<-nlme(Y~SSlogis(X,th1,th2,th3)|Subject,fixed=list(th1~A+B+FACTORC_1+FACTOR_C2,
 etc 

but, as I expected, the model can't be solved 

I will appreciate any help

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


Re: [R] Questions about readBin function (Was: dec2bin?)

2005-10-12 Thread Roger D. Peng
I think you can use 'seek()' here, but it may not be completely reliable on all 
platforms.

-roger

Tuszynski, Jaroslaw W. wrote:
> Hi,
> 
> The latest version of R had some changes to functions "readbin() and
> writeBin() [which] now support raw vectors as well as filenames and
> connections.". As a result I am working on retiring "raw2bin" and "bin2raw"
> functions from "caTools" package which do exactly the same. Thanks to Prof.
> Ripley for bringing this change to my attention.
> 
> Which brings me to my question: how to use readBin function to read the
> whole file or vector "con" and not just requested number of elements (n)
> from it? In other words what to do if I do not know what to set argument "n"
> to ("The (maximal) number of records to be read"), and want to read all
> records?  
> 
> So far the simplest solution I found is to measure vector length (or file
> size) of "con" and set n to length()%/%size. Which gets quite messy if
> "size" is not provided and have to be deduced from "what" (see code below).
> Am I missing something? Is there an easier way to read the whole file or
> vector? Shouldn't that be the default?
> 
> readBin(con, what, n = 1, size = NA, signed = TRUE, endian =
> .Platform$endian)
> 
> bin2raw = function(x, ...) writeBin(x, raw(), ...) # old bin2raw can be
> easily written using curent writeBin
> 
> raw2bin = function(r, what, size=NA, ...)
> {
>   TypeList = c("logical", "integer", "double", "complex", "character",
> "raw", 
>"numeric", "int")
>   if (!is.character(what) || length(what) != 1 || !(what %in% TypeList)) 
> what <- typeof(what)
>   if (!is.vector(r) || mode(r) == "list") 
> stop("raw2bin: 'r' has to be vector of type 'raw'")
>   if (what=="raw") return(r)
>   if (!is.na(size)) nBits=size 
>   else nBits = switch(match(typeof(x), TypeList), 4, 4, 8, 16, 2, 1, 8, 4) 
>   n = length(r)
>   if (n%%nBits) 
> stop("raw2bin: number of elements in 'r' is not multiple of 'size'")
>   x = readBin(r, what, n = n%/%nBits, size=size, ...)
>   return (x)
> }
> 
>  Jarek 
> \ 
>  Jarek Tuszynski, PhD.   o / \ 
>  Science Applications International Corporation  <\__,|  
>  (703) 676-4192   ">  \ 
>  [EMAIL PROTECTED] `   \
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

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


Re: [R] R data import

2005-10-12 Thread Tuszynski, Jaroslaw W.
A few suggestions:
- read.fwf function sounds like what you need, but I have never used it so I
am not sure
- use readLines and manually extract needed positions and convert them to
numbers 

 Jarek 
\ 
 Jarek Tuszynski, PhD.   o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192   ">  \ 
 [EMAIL PROTECTED] `   \ 



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 11, 2005 7:52 PM
To: r-help@stat.math.ethz.ch
Subject: [R] R data import

Hello,

I hope all is well. I've gone through and searched just about all the
manuals, faqs, contribs available on the data import/export process and have
not found any answer to a specific question. Hopefully, I will be able to
fall back upon the valuable expertise in mailing list. Here goes:

How can I import SPECIFIC columns of data in a fixed width file? E.g. I have
a fwf with 40 variables ranging from 1 to 10 characters and at any given
time, need only a few to analyze, like so:
 .etc.
which looks something like:
02M1LOS...xxcanidae011289.10001291412


In essence I am looking for functionality similar to the SAS
pointer/informat method. I would appreciate any help anyone would be able to
give!

Thanks so much for your help.

best,
Ratnendra Sharma
U Minn

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

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


Re: [R] Historical England and Wales Shape Files

2005-10-12 Thread Roger Bivand
On Wed, 12 Oct 2005, Camarda, Carlo Giovanni wrote:

> Dear R-user,
> I would like to apply spatial statistics on some historical data, in
> particular from 1850 to 1900 by registration district of England and
> Wales.
> I have searched in the R-archive, but unsuccessfully.
> Do you know whether R contains those shape files? Or where would be
> possible to download and use in R?

None of the contributed packages to R contain such shapefiles. I'm afraid 
you have to find them first yourself. From:

http://edina.ac.uk/ukborders/description/data_by_country.shtml

boundary data appear to be available for 1871, 1881, and 1911 for these
units, if you have permission to use that service.



> Thanks in advance,
> Carlo Giovanni Camarda
> 
> 
> +
> This mail has been sent through the MPI for Demographic Rese...{{dropped}}
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


Re: [R] Newbie problem with read.table

2005-10-12 Thread Marc Schwartz
On Wed, 2005-10-12 at 14:56 +0200, Roger Bivand wrote:
> On Wed, 12 Oct 2005, Jan Conrad wrote:
> 
> > Hi R,
> >  I have a seemingly simple problem. I have a table in following format
> > (tab seperated)
> > 
> >Njets NBjets NElec NMuon   Meff  HTHT3j  HEAplan
> > Plan   
> > 1  4 3  2   0   366.278 253.642 87.7473   1385
> > 0.0124566   0.376712   
> > 2  3 1  1   0   235.19  157.688 18.2852
> > 574.253 0.00064187  0.00528814 
> > 
> > I read in with:
> > 
> > > ttbar<-read.table("test2.dat",header=TRUE)
> > 
> > 
> > > ttbar
> >   Njets NBjets NElec NMuonMeff  HTHT3j   HE  Aplan
> > 1 4  3 2 0 366.278 253.642 87.7473 1385.000 0.01245660
> > 2 3  1 1 0 235.190 157.688 18.2852  574.253 0.00064187
> > Plan
> > 1 0.37671200
> > 2 0.00528814,
> > 
> >  i.e.. the table is split after 9 variables. How come ?
> 
> > options("width")
> $width
> [1] 80
> 
> says what the width of your console is. Columns beyond this get wrapped 
> gently (not each row by itself) - it can be set different values if you 
> choose - try:
> 
> ow <- options("width")
> options(width=40)
> options("width")
> ttbar
> options(ow)
> options("width")
> 
> So this is just the print function for data.frame objects doing its unsung
> job. A very useful function for looking at things when they don't seem to
> be what you think is str(), which concisely says what the structure of an
> object is, so str(ttbar)  should tell you that it is a data frame of 10
> variables and 2 observations.

Thanks to Roger for this clarification. I took the splitting of the
variables to be a consequence of the delimiter and not just a benign
consequence of the printed output (at least I presume this is the proper
interpretation of Jan's problem.)

The tab character is of course included in "whitespace"using "\t"
explicitly would be helpful if there is embedded whitespace (other than
a tab) within a field.

Marc


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


Re: [R] Newbie problem with read.table

2005-10-12 Thread Jan Conrad
Thank you all for your answers. Yes, indeed it was only a printing
problem (in fact I had tried
the \t option before without sucess).

My first interaction with R (and the R help), I must say I am impressed.


Best,

Jan

-Original Message-
From: Marc Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 12, 2005 3:14 PM
To: [EMAIL PROTECTED]
Cc: Jan Conrad; r-help@stat.math.ethz.ch
Subject: Re: [R] Newbie problem with read.table


On Wed, 2005-10-12 at 14:56 +0200, Roger Bivand wrote:
> On Wed, 12 Oct 2005, Jan Conrad wrote:
> 
> > Hi R,
> >  I have a seemingly simple problem. I have a table in following 
> > format (tab seperated)
> > 
> >Njets NBjets NElec NMuon   Meff  HTHT3j  HE
Aplan
> > Plan   
> > 1  4 3  2   0   366.278 253.642 87.7473   1385
> > 0.0124566   0.376712   
> > 2  3 1  1   0   235.19  157.688 18.2852
> > 574.253 0.00064187  0.00528814
> > 
> > I read in with:
> > 
> > > ttbar<-read.table("test2.dat",header=TRUE)
> > 
> > 
> > > ttbar
> >   Njets NBjets NElec NMuonMeff  HTHT3j   HE
Aplan
> > 1 4  3 2 0 366.278 253.642 87.7473 1385.000
0.01245660
> > 2 3  1 1 0 235.190 157.688 18.2852  574.253
0.00064187
> > Plan
> > 1 0.37671200
> > 2 0.00528814,
> > 
> >  i.e.. the table is split after 9 variables. How come ?
> 
> > options("width")
> $width
> [1] 80
> 
> says what the width of your console is. Columns beyond this get 
> wrapped
> gently (not each row by itself) - it can be set different values if
you 
> choose - try:
> 
> ow <- options("width")
> options(width=40)
> options("width")
> ttbar
> options(ow)
> options("width")
> 
> So this is just the print function for data.frame objects doing its 
> unsung job. A very useful function for looking at things when they 
> don't seem to be what you think is str(), which concisely says what 
> the structure of an object is, so str(ttbar)  should tell you that it 
> is a data frame of 10 variables and 2 observations.

Thanks to Roger for this clarification. I took the splitting of the
variables to be a consequence of the delimiter and not just a benign
consequence of the printed output (at least I presume this is the proper
interpretation of Jan's problem.)

The tab character is of course included in "whitespace"using "\t"
explicitly would be helpful if there is embedded whitespace (other than
a tab) within a field.

Marc


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


Re: [R] Hmisc latex function

2005-10-12 Thread Charles Dupont
Marc Schwartz (via MN) wrote:
> On Tue, 2005-10-11 at 10:01 -0400, Rick Bilonick wrote:
> 
>>I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the
>>latest version of Hmisc. When I run an example from the latex function I
>>get the following:
>>
>>
>>>x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine
>>
>>2')))
>>
>>>x
>>
>>  c d enLine 2
>>a 1 35
>>b 2 46
>>
>>>latex(x)   # creates x.tex in working directory
>>
>>sh: line 0: cd: “/tmp/Rtmpl10983”: No such file or directory
>>This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>>entering extended mode
>>! I can't find file `“/tmp/Rtmpl10983/file643c9869”'.
>><*> “/tmp/Rtmpl10983/file643c9869”
>>
>>Please type another input file name: q
>>(/usr/share/texmf/tex/latex/tools/q.tex
>>LaTeX2e <2003/12/01>
>>Babel  and hyphenation patterns for american, french, german,
>>ngerman, b
>>ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
>>esperanto, e
>>stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
>>norsk, polis
>>h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
>>swedish, tur
>>kish, ukrainian, nohyphenation, loaded.
>>File ignored
>>xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such
>>file.
>>
>>
>>How can I fix this?
>>
>>Rick B.
> 
> 
> I get the same results, also on FC4 with R 2.2.0.
> 
> I am cc:ing Frank here for his input, but a quick review of the code and
> created files suggests that there may be conflict between the locations
> of some of the resultant files during the latex system call. Some files
> appear in a temporary R directory, while others appear in the current R
> working directory.
> 
> For example, if I enter the full filename:
>  
>   /tmp/RtmpC12100/file643c9869.tex
> 
> at the latex prompt, I get:
> 
> 
>>latex(x)
> 
> sh: line 0: cd: “/tmp/RtmpC12100”: No such file or directory
> This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
> entering extended mode
> ! I can't find file `“/tmp/RtmpC12100/file643c9869”'.
> <*> “/tmp/RtmpC12100/file643c9869”
> 
> Please type another input file name: *** loading the extensions
> datasource
> /tmp/RtmpC12100/file643c9869.tex
> (/tmp/RtmpC12100/file643c9869.tex
> LaTeX2e <2003/12/01>
> Babel  and hyphenation patterns for american, french, german,
> ngerman, b
> ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
> esperanto, e
> stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
> norsk, polis
> h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
> swedish, tur
> kish, ukrainian, nohyphenation, loaded.
> (/usr/share/texmf/tex/latex/base/report.cls
> Document Class: report 2004/02/16 v1.4f Standard LaTeX document class
> (/usr/share/texmf/tex/latex/base/size10.clo))
> (/usr/share/texmf/tex/latex/geometry/geometry.sty
> (/usr/share/texmf/tex/latex/graphics/keyval.sty)
> (/usr/share/texmf/tex/latex/geometry/geometry.cfg))
> No file file643c9869.aux.
> [1] (./file643c9869.aux) )
> Output written on file643c9869.dvi (1 page, 368 bytes).
> Transcript written on file643c9869.log.
> xdvi-motif.bin: Fatal error: /tmp/RtmpC12100/file643c9869.dvi


H,  It works for me.  Interesting.

It almost looks like the temp dir is not being created, but thats not 
possible because R does that.  It might be a Unicode issue with you 
system shell.  Can you run this statement in R

sys(paste('cd',dQuote(tempdir()),";",
"echo Hello BOB > test.test",
";","cat test.test"))


What version of Hmisc are you using?  What local are you using?

Charles

-- 
Charles Dupont  Computer System Analyst School of Medicine
Department of Biostatistics Vanderbilt University

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

Re: [R] "symbol print-name too long"

2005-10-12 Thread Afshartous, David
Spencer,
Thanks for your reply.  Yes, I finally resolved the issue.
One of the archive e-mails on this topic suggested looking 
for a the symbol ' and I mistakenly searched for the symbol ` to
no avail ... finally I found the symbol ' which was in a
very inconspicuous place.
Thanks,
Dave

-Original Message-
From: Spencer Graves [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 11, 2005 9:05 PM
To: Afshartous, David
Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED]
Subject: Re: [R] "symbol print-name too long"


  Have you received a reply or otherwise resolved this issue?  If no, 
have you tried to construct the simplest possible example that comes to 
your mind.  Sometimes in the course of trying that, I often figure out 
what the error message means.  If you try this without getting the 
answer yourself, please send the resulting simple example to this list. 
  If someone reading your email can copy a few lines of code from your 
message into R and get the same problem, you are more likely to get a 
quick, informative reply.  (Please also specify which version of R on 
which platform.)

  spencer graves

Afshartous, David wrote:

> All, 
> 
> I've coded a function and it works manually if I copy it line by line into R.
> However, when I try to "load" (copy and paste) the entire function into 
> R, I get the following error after the listed line of code:
> 
> + N.j.list = lapply(rej.hyp, length)   
> Error: symbol print-name too long
> 
> Does anyone you know what this error means?  Strangely, when I copy the 
> same line verbatim into R manually apart from the whole function, 
> no error message results.
> 
> I've checked the manuals and don't see anything RE print-name too long.  I 
> also 
> tried google and saw an old message on this error message, but it doesn't 
> seem to
> apply here.
> 
> Thanks,
> Dave
> ps - please respond directly to [EMAIL PROTECTED] please.
> 
> 
> David Afshartous, PhD
> University of Miami
> Department of Management Science
> School of Business
> Coral Gables, FL 33124
> phone: 305-284-8005
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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

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


Re: [R] Hmisc latex function

2005-10-12 Thread Rick Bilonick
Charles Dupont wrote:

> Marc Schwartz (via MN) wrote:
>
>> On Tue, 2005-10-11 at 10:01 -0400, Rick Bilonick wrote:
>>
>>> I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the
>>> latest version of Hmisc. When I run an example from the latex 
>>> function I
>>> get the following:
>>>
>>>
 x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine
>>>
>>>
>>> 2')))
>>>
 x
>>>
>>>
>>>  c d enLine 2
>>> a 1 35
>>> b 2 46
>>>
 latex(x)   # creates x.tex in working directory
>>>
>>>
>>> sh: line 0: cd: “/tmp/Rtmpl10983”: No such file or directory
>>> This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>>> entering extended mode
>>> ! I can't find file `“/tmp/Rtmpl10983/file643c9869”'.
>>> <*> “/tmp/Rtmpl10983/file643c9869”
>>>
>>> Please type another input file name: q
>>> (/usr/share/texmf/tex/latex/tools/q.tex
>>> LaTeX2e <2003/12/01>
>>> Babel  and hyphenation patterns for american, french, german,
>>> ngerman, b
>>> ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
>>> esperanto, e
>>> stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
>>> norsk, polis
>>> h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
>>> swedish, tur
>>> kish, ukrainian, nohyphenation, loaded.
>>> File ignored
>>> xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such
>>> file.
>>>
>>>
>>> How can I fix this?
>>>
>>> Rick B.
>>
>>
>>
>> I get the same results, also on FC4 with R 2.2.0.
>>
>> I am cc:ing Frank here for his input, but a quick review of the code and
>> created files suggests that there may be conflict between the locations
>> of some of the resultant files during the latex system call. Some files
>> appear in a temporary R directory, while others appear in the current R
>> working directory.
>>
>> For example, if I enter the full filename:
>>  
>>   /tmp/RtmpC12100/file643c9869.tex
>>
>> at the latex prompt, I get:
>>
>>
>>> latex(x)
>>
>>
>> sh: line 0: cd: “/tmp/RtmpC12100”: No such file or directory
>> This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
>> entering extended mode
>> ! I can't find file `“/tmp/RtmpC12100/file643c9869”'.
>> <*> “/tmp/RtmpC12100/file643c9869”
>>
>> Please type another input file name: *** loading the extensions
>> datasource
>> /tmp/RtmpC12100/file643c9869.tex
>> (/tmp/RtmpC12100/file643c9869.tex
>> LaTeX2e <2003/12/01>
>> Babel  and hyphenation patterns for american, french, german,
>> ngerman, b
>> ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
>> esperanto, e
>> stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
>> norsk, polis
>> h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
>> swedish, tur
>> kish, ukrainian, nohyphenation, loaded.
>> (/usr/share/texmf/tex/latex/base/report.cls
>> Document Class: report 2004/02/16 v1.4f Standard LaTeX document class
>> (/usr/share/texmf/tex/latex/base/size10.clo))
>> (/usr/share/texmf/tex/latex/geometry/geometry.sty
>> (/usr/share/texmf/tex/latex/graphics/keyval.sty)
>> (/usr/share/texmf/tex/latex/geometry/geometry.cfg))
>> No file file643c9869.aux.
>> [1] (./file643c9869.aux) )
>> Output written on file643c9869.dvi (1 page, 368 bytes).
>> Transcript written on file643c9869.log.
>> xdvi-motif.bin: Fatal error: /tmp/RtmpC12100/file643c9869.dvi
>
>
>
> H,  It works for me.  Interesting.
>
> It almost looks like the temp dir is not being created, but thats not 
> possible because R does that.  It might be a Unicode issue with you 
> system shell.  Can you run this statement in R
>
> sys(paste('cd',dQuote(tempdir()),";",
> "echo Hello BOB > test.test",
> ";","cat test.test"))
>
>
> What version of Hmisc are you using?  What local are you using?
>
> Charles
>
I'm using Hmisc 3.0-7 (2005-09-15). I did an update.packages right after 
installing R 2.2.0. Here is the output I get:

sh: line 0: c: "/tmp/RtmpSp4207": No such file or directory
[1] "Hello BOB"

Thanks.

Rick B.

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

[R] Variance explained in regression trees?

2005-10-12 Thread Alexander J. Pries
I apologize for what may be novice questions but I am new to program R and
need a bit of assistance. I am using R to create regression trees to explain
how various environmental predictors influence coastal dune loss as a result
of hurricane activity. 

First question is as follows; how do I interpret the complexity plots that
the rpart package will produce. What do the X and Y axis represent (e.g.,
X-val relative error and cp). My understanding is that "cp" is similar to a
complexity penalty for having a tree with many branches when a simpler one
would be just as robust. How can I use the values and error bars to
interpret what is the "optimal" sized tree?

My other question is as follows; other statistical packages (I'm thinking
specifically of DTREG) that build regression trees are able to produce a
model summary that explains initial variance, amount of variance explained
by the tree, and unexplained variance. From this information, an estimated
R-sqr is calculated that provides some indication of how well the tree
"fits."

Does R produce, or have the ability, to produce information like this? If
anyone has specifics on how I might be able to evaluate the fit of my
regression trees.

Thank you in advance for any helpful guidance!

Alex Pries


Alexander Pries
Graduate Student
Wildlife Ecology and Conservation
University of Florida
P.O. Box 110430
Gainesville, FL 32605
[EMAIL PROTECTED]
http://plaza.ufl.edu/apries
(352) 246-9621

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


Re: [R] Hmisc latex function

2005-10-12 Thread Peter Dalgaard
Charles Dupont <[EMAIL PROTECTED]> writes:

> H,  It works for me.  Interesting.
> 
> It almost looks like the temp dir is not being created, but thats not 
> possible because R does that.  It might be a Unicode issue with you 
> system shell.  Can you run this statement in R

It's a Unicode issue alright. dQuote is intended for textual output,
and in UTF-8 locales it will use Unicode codepoints 0x201c and 0x201d,
which the shell is not expected to make head or tails of.

The help page would have told you, and pointed you to shQuote() as
well...
 
> sys(paste('cd',dQuote(tempdir()),";",
> "echo Hello BOB > test.test",
> ";","cat test.test"))
> 
> 
> What version of Hmisc are you using?  What local are you using?
> 
> Charles
> 
> -- 
> Charles DupontComputer System Analyst School of Medicine
>   Department of Biostatistics Vanderbilt University
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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


Re: [R] Hmisc latex function

2005-10-12 Thread David Whiting
Charles Dupont wrote:
[...]

> 
> 
> H,  It works for me.  Interesting.
> 
> It almost looks like the temp dir is not being created, but thats not 
> possible because R does that.  It might be a Unicode issue with you 
> system shell.  Can you run this statement in R
> 
> sys(paste('cd',dQuote(tempdir()),";",
> "echo Hello BOB > test.test",
> ";","cat test.test"))
> 
> 
> What version of Hmisc are you using?  What local are you using?
> 
> Charles
> 

I've had similar problems latex() which I tracked down to dQuote() that
I think are related to unicode and locales on Ubuntu 5.04. I think the
problem is with Ubuntu (because I get funny little boxes now and then
with various applications), but have not managed to get my head around
unicode sufficiently well to be able to write a sensible post about this
or work out how to fix it. My current way of getting around this in R is
to change the locale:

> Sys.getlocale()
[1]
"LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
> tempdir()
[1] "/tmp/RtmpWL64Z2"
> dQuote(tempdir())
[1] "“/tmp/RtmpWL64Z2”"  [I get funny little boxes here]
> Sys.setlocale("LC_CTYPE", "C")
[1] "C"
> Sys.getlocale()
[1]
"LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
> dQuote(tempdir())
[1] "\"/tmp/RtmpWL64Z2\"" [No funny boxes this time]
>
> version
 _
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor1.1
year 2005
month06
day  20
language R
>

[Hmmm, I need to update my R installation]

-- 
David Whiting
School of Clinical Medical Sciences, The Medical School
University of Newcastle upon Tyne, NE2 4HH, UK.

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

[R] loop for plot function

2005-10-12 Thread KOITA Lassana - STAC/ACE




Hello all R users,
I would like to add another loop to my following R code ( it works for the
moment correctly) , which will be able to me to vary n (see the code) from
1 to 4 or 5.
And I also would like apply the plot function in this case, eg all four or
five figures in the same graphic (n= 1, 2, ..., 4 ou 5)
I have tested one, but unsuccessfully.
I need you to solve this problems

Thank you


###"

simulation <- function(k, n){

conc <- seq(0,100,by=0.5)
#choixg <- seq(1, length(conc))
choixg <- rep(0,length(conc))
for (i in 1:length(conc)){
choixg[i] <- (k + conc[i])^n/((k+conc[i])^n + (k+1)^n)

}
   #return(data.frame(choixg, conc))
   return(list(choixg=choixg, conc = conc))

}

#choixg <- simulation(5,2)
#mydf<-simulation(5,1)
simResult <- simulation (5,5)
#plot(mydf$conc, log10(1-mydf$choixg), main ="fonction de choix", col=
#"blue", pch=20,
#xlab = " concentration", ylab="proba de choisir la gauche")

plot(simResult$conc, log10(1-simResult$choixg), main ="fonction de choix",
col=
"blue", pch=20, lwd = 3,
xlab = " concentration", ylab="proba de choisir la gauche")

lines(simResult$conc, log10(1-simResult$choixg), col= "red", lwd = 3)

#cbind(simResult$conc, simResult$choixg, format(Sys.time(),"%H:%M:%S"))

Lassana KOITA
Etude Sécurité et Exploitation aéroportuaires / Aerodrome Safety &
Statistical analysis
Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical
Department
Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation
Tel: 01 49 56 80 60
Fax: 01 49 56 82 14
E-mail: [EMAIL PROTECTED]

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


Re: [R] Hmisc latex function

2005-10-12 Thread Marc Schwartz (via MN)
On Wed, 2005-10-12 at 08:33 -0500, Charles Dupont wrote:
> Marc Schwartz (via MN) wrote:
> > On Tue, 2005-10-11 at 10:01 -0400, Rick Bilonick wrote:
> > 
> >>I'm using R 2.2.0 on an up-to-date version of Fedora Core 4 with the
> >>latest version of Hmisc. When I run an example from the latex function I
> >>get the following:
> >>
> >>
> >>>x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine
> >>
> >>2')))
> >>
> >>>x
> >>
> >>  c d enLine 2
> >>a 1 35
> >>b 2 46
> >>
> >>>latex(x)   # creates x.tex in working directory
> >>
> >>sh: line 0: cd: “/tmp/Rtmpl10983”: No such file or directory
> >>This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
> >>entering extended mode
> >>! I can't find file `“/tmp/Rtmpl10983/file643c9869”'.
> >><*> “/tmp/Rtmpl10983/file643c9869”
> >>
> >>Please type another input file name: q
> >>(/usr/share/texmf/tex/latex/tools/q.tex
> >>LaTeX2e <2003/12/01>
> >>Babel  and hyphenation patterns for american, french, german,
> >>ngerman, b
> >>ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
> >>esperanto, e
> >>stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
> >>norsk, polis
> >>h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
> >>swedish, tur
> >>kish, ukrainian, nohyphenation, loaded.
> >>File ignored
> >>xdvi-motif.bin: Fatal error: /tmp/Rtmpl10983/file643c9869.dvi: No such
> >>file.
> >>
> >>
> >>How can I fix this?
> >>
> >>Rick B.
> > 
> > 
> > I get the same results, also on FC4 with R 2.2.0.
> > 
> > I am cc:ing Frank here for his input, but a quick review of the code and
> > created files suggests that there may be conflict between the locations
> > of some of the resultant files during the latex system call. Some files
> > appear in a temporary R directory, while others appear in the current R
> > working directory.
> > 
> > For example, if I enter the full filename:
> >  
> >   /tmp/RtmpC12100/file643c9869.tex
> > 
> > at the latex prompt, I get:
> > 
> > 
> >>latex(x)
> > 
> > sh: line 0: cd: “/tmp/RtmpC12100”: No such file or directory
> > This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
> > entering extended mode
> > ! I can't find file `“/tmp/RtmpC12100/file643c9869”'.
> > <*> “/tmp/RtmpC12100/file643c9869”
> > 
> > Please type another input file name: *** loading the extensions
> > datasource
> > /tmp/RtmpC12100/file643c9869.tex
> > (/tmp/RtmpC12100/file643c9869.tex
> > LaTeX2e <2003/12/01>
> > Babel  and hyphenation patterns for american, french, german,
> > ngerman, b
> > ahasa, basque, bulgarian, catalan, croatian, czech, danish, dutch,
> > esperanto, e
> > stonian, finnish, greek, icelandic, irish, italian, latin, magyar,
> > norsk, polis
> > h, portuges, romanian, russian, serbian, slovak, slovene, spanish,
> > swedish, tur
> > kish, ukrainian, nohyphenation, loaded.
> > (/usr/share/texmf/tex/latex/base/report.cls
> > Document Class: report 2004/02/16 v1.4f Standard LaTeX document class
> > (/usr/share/texmf/tex/latex/base/size10.clo))
> > (/usr/share/texmf/tex/latex/geometry/geometry.sty
> > (/usr/share/texmf/tex/latex/graphics/keyval.sty)
> > (/usr/share/texmf/tex/latex/geometry/geometry.cfg))
> > No file file643c9869.aux.
> > [1] (./file643c9869.aux) )
> > Output written on file643c9869.dvi (1 page, 368 bytes).
> > Transcript written on file643c9869.log.
> > xdvi-motif.bin: Fatal error: /tmp/RtmpC12100/file643c9869.dvi
> 
> 
> H,  It works for me.  Interesting.
> 
> It almost looks like the temp dir is not being created, but thats not 
> possible because R does that.  It might be a Unicode issue with you 
> system shell.  Can you run this statement in R
> 
> sys(paste('cd',dQuote(tempdir()),";",
> "echo Hello BOB > test.test",
> ";","cat test.test"))
> 
> 
> What version of Hmisc are you using?  What local are you using?
> 
> Charles

Hmisc version 3.0-7, Dated 2005-09-15, which is the latest according to
CRAN.

> sys(paste('cd',dQuote(tempdir()),";",
+ "echo Hello BOB > test.test",
+ ";","cat test.test"))
sh: line 0: cd: “/tmp/RtmpGY5553”: No such file or directory
[1] "Hello BOB"


>From a bash console:

$ cd /tmp/RtmpGY5553
$ pwd
/tmp/RtmpGY5553


$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
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="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


On the creation of the sys() call, it looks like the backquotes are
causing the problem:

> paste('cd',dQuote(tempdir()))
[1] "cd “/tmp/RtmpGY5553”"


>From a bash shell:

$ cd “/tmp/RtmpGY5553”
bash: cd: “/tmp/RtmpGY5553”: No such file or directory
$ cd "/tmp/RtmpGY5553"
$ pwd
/tmp/RtmpGY5553


According to ?dQuote:

By default, sQuote and dQuote provide undirectional ASCII quotation
style. In a UTF-8 locale (see l10n_info), the Unicode directional quotes
are used.

The See Als

Re: [R] font=5 (Was: greek symbols using pch)

2005-10-12 Thread Earl F. Glynn
"ecatchpole" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Earl,
>
> I don't think that's a bug. Try
>
> pdf("font5.pdf", onefile=FALSE)
>
> and similarly for postscript().

Mea culpa. The onefile=FALSE wasn't necessary (and caused Ghostscript not to
open the postscript file).

The 2nd page was caused by an erroneous second plot statement in ShowFont5,
which I put there for a one time test and then I failed to remove it.  I was
getting two pages because I had two plot statements.  Sorry for the
confusion.

All works fine with this code, which has only one plot statement, even with
postscript and pdf files:

ShowFont5 <- function()
{
  oldpar <- par(font=5, las=1)
  plot(0:15,0:15,type="n",ylim=c(15,0),
main="Symbols in Font=5",
xlab="", ylab="",xaxt="n", yaxt="n")
  axis(BOTTOM<-1, at=0:15)
  axis(LEFT  <-2, at=0:15, 16*0:15)
  abline(v=0.5 + 0:14,
 h=0.5 + 0:14, col="grey", lty="dotted")
  for(i in 0:255)
  {
x <- i %%16;
y <- i %/% 16;
points(x,y,pch=i)
  }
  par(oldpar)
}


efg

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


Re: [R] Hmisc latex function

2005-10-12 Thread Charles Dupont

Peter Dalgaard wrote:

Charles Dupont <[EMAIL PROTECTED]> writes:



H,  It works for me.  Interesting.

It almost looks like the temp dir is not being created, but thats not 
possible because R does that.  It might be a Unicode issue with you 
system shell.  Can you run this statement in R



It's a Unicode issue alright. dQuote is intended for textual output,
and in UTF-8 locales it will use Unicode codepoints 0x201c and 0x201d,
which the shell is not expected to make head or tails of.

The help page would have told you, and pointed you to shQuote() as
well...
 




Well There be the problem.

First I have heard about shQuote.  When I last looked at the help file 
it didn't have the shQuote entry.


For a temporary fix source the attached file after loading the Hmisc 
library.  I will fix this in source for the next version.



--
Charles Dupont  Computer System Analyst School of Medicine
Department of Biostatistics Vanderbilt University
##!!WRONG ARG x in !.SV4. def latex generic!
##Changed x to object inside latex() for !.SV4. (Thanks David Lovell)

##Thanks to David R. Lovell <[EMAIL PROTECTED]> CSIRO
##for scientific=8Feb2000

first.word <- function(x, i=1, expr=substitute(x))
{
  words <-
if(!missing(x))
  as.character(x)[1]
else
  as.character(unlist(expr))[1]
  
  ## Added !missing(x) as.char(x) 25May01
  ##first.letters <- substring(words, 1, 1)
  ##word.selector <- (match(first.letters, c(letters,LETTERS,"."), 0) > 0)
  ##words <- words[word.selector][i]
  ##if(!under.unix) {
  ##  words <- sedit(words,'.','')
  ##  words <- substring(words,1,8)
  ##}
  ## 8Nov00 FEH:
  
  if(i > 1)
stop('i > 1 not implemented')
  
  chars <- substring(words, 1:nchar(words), 1:nchar(words))
  legal.chars <- c(letters,LETTERS,'.',
   '0','1','2','3','4','5','6','7','8','9')
  non.legal.chars <- (1:length(chars))[chars %nin% legal.chars]
  if(!any(non.legal.chars))
return(words)
  
  if(non.legal.chars[1]==1)
return(character(0))
  
  substring(words, 1, non.legal.chars[1]-1)
}


##1. if x is a data.frame, then do each component separately.
##2. if x is a matrix, but not a data.frame, make it a data.frame
##   with individual components for the columns.
##3. if a component x$x is a matrix, then do all columns the same.
##4. Use right justify by default for numeric columns.
##5. Use left justify for non-numeric columns.

## The following are made complicated by matrix components of data.frames:
##6. vector cdec must have number of items equal to number of columns
##   of input x.
##7. matrix dec must have number of columns equal to number of columns
##   of input x.
##8. scalar dec is expanded to a vector cdec with number of items equal
##   to number of columns of input x.
##9. vector rdec must have number of items equal to number of rows of input x.
##   rdec is expanded to matrix dec.
##10. col.just must have number of columns equal to number of columns
##of output cx.

## Value:
## character matrix with character images of properly rounded x.
## matrix components of input x are now just sets of columns of character 
matrix.
## attr(,col.just) repeats input col.just when provided.
##  Otherwise, recommended justification for columns of output.
##  Default is "l" for characters and factors, "r" for numeric.
##  When dcolumn==T, numerics will have ".".


## FEH 21May96 - changed default for numeric.dollar to cdot
## FEH  5Jun96 - re-written to not rely on as.data.frame,
##   converted data frames to matrices the slow way
##   added matrix.sep 
## 12Aug99 - allowed # decimal places=NA (no rounding, just use format())
##27May02 - added booktabs FEH
## 13Dec02 - added ctable   FEH
## arguments included check.names=TRUE 23jan03

format.df <- function(x,
  digits, dec=NULL, rdec=NULL, cdec=NULL,
  numeric.dollar=cdot, na.blank=FALSE,
  na.dot=FALSE, blank.dot=FALSE, col.just=NULL,
  cdot=FALSE, dcolumn=FALSE, matrix.sep=' ', 
scientific=c(-4,4), ...)
{
  if(cdot && dcolumn)
stop('cannot have both cdot=T and dcolumn=T')
  
  if(missing(digits))
digits <- NULL
  
  if((!length(digits))+(!length(dec))+(!length(rdec))+(!length(cdec)) < 3)
stop('only one of digits, dec, rdec, cdec may be given')
  
  ##if(length(digits)) .Options$digits6Aug00 what was that?
  
  if(length(digits)) {
oldopt <- options(digits=digits)
on.exit(options(oldopt))
  }

  ## For now nsmall and scientific are ignored in R  25May01
  formt <-
if(!.R.)
  format.default
else function(x, decimal.mark='.', nsmall=0, scientific=c(-4,4))
{
  x <- format(x)
  if(decimal.mark!='.')
x <- gsub('\\.',decimal.mark,x)
  
  x
}
  
  dot <-
if(cdot)
  (if(.R.)
 'cdotp!'
   else
 '\\cdotp\\!')
else
  '.'

  if(is.data.frame(

Re: [R] adding 1 month to a date

2005-10-12 Thread Jim Porzak
 OTOH,

 > seq(as.Date("2004-01-31"), by = "month", length = 14)
  [1] "2004-01-31" "2004-03-02" "2004-03-31" "2004-05-01" "2004-05-31"
  [6] "2004-07-01" "2004-07-31" "2004-08-31" "2004-10-01" "2004-10-31"
 [11] "2004-12-01" "2004-12-31" "2005-01-31" "2005-03-03"

 I would prefer to see dates forced to be within each month, not
 "leaking" into next month.

 IOW:
  [1] "2004-01-31" "2004-02-29" "2004-03-31" "2004-04-30" "2004-05-31", etc


 --
 Jim Porzak
 Loyalty Matrix Inc.
 San Francisco, CA


> On 10/12/05, Marc Schwartz <[EMAIL PROTECTED]> wrote:
> > Thanks to Prof. Ripley for pointing this out.
> >
> > One of the approaches that I had considered here was to set up a vector
> > of the number of days in each month (adjusting of course for leap
> > years), and use "day arithmetic" to add/subtract the appropriate number
> > of days.
> >
> > However, it was easier to use seq.Date() and to further consider putting
> > a wrapper around it to make it yet even easier to use.
> >
> > Marc
> >
> > On Wed, 2005-10-12 at 13:23 +0100, Prof Brian Ripley wrote:
> > > On Wed, 12 Oct 2005, bogdan romocea wrote:
> > >
> > > > Simple addition and subtraction works as well:
> > > >  as.Date("1995/12/01",format="%Y/%m/%d") + 30
> > > > If you have datetime values you can use
> > > >  strptime("1995-12-01 08:00:00",format="%Y-%m-%d %H:%M:%S") + 30*24*3600
> > > > where 30*24*3600 = 30 days expressed in seconds.
> > >
> > > Sorry, not in general, as a month is not generally of 30 days (including
> > > in your example).
> > >
> > > seq.Date is a good way to do this.
> > >
> > > >
> > > >
> > > >> -Original Message-
> > > >> From: Marc Schwartz [mailto:[EMAIL PROTECTED]
> > > >> Sent: Tuesday, October 11, 2005 10:16 PM
> > > >> To: t c
> > > >> Cc: r-help@stat.math.ethz.ch
> > > >> Subject: Re: [R] adding 1 month to a date
> > > >>
> > > >>
> > > >> On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
> > > >>> Within an R dataset, I have a date field called date_.
> > > >> (The dates are
> > > >>> in the format -MM-DD, e.g. 1995-12-01.)
> > > >>
> > > >>> How can I add or subtract 1 month from this date, to get
> > > >> 1996-01-01 or
> > > >>> 1995-11-01.
> > > >>
> > > >> There might be an easier way to do this, but using seq.Date(), you can
> > > >> increment or decrement from a Time 0 by months:
> > > >>
> > > >> Add 1 month:
> > > >>
> > > >> This takes your Time 0, generates a 2 element sequence (which begins
> > > >> with Time 0) and then takes the second element:
> > > >>
> > > >>> seq(as.Date("1995-12-01"), by = "month", length = 2)[2]
> > > >> [1] "1996-01-01"
> > > >>
> > > >>
> > > >>
> > > >> Subtract 1 month:
> > > >>
> > > >> Same as above, but we use 'by = "-1 month"' and take the
> > > >> second element:
> > > >>
> > > >>> seq(as.Date("1995-12-01"), by = "-1 month", length = 2)[2]
> > > >> [1] "1995-11-01"
> > > >>
> > > >>
> > > >> See ?as.Date and ?seq.Date for more information. The former
> > > >> function is
> > > >> used to convert from a character vector to a Date class object. Note
> > > >> that in your case, the date format is consistent with the default. Pay
> > > >> attention to the 'format' argument in as.Date() if your dates
> > > >> should be
> > > >> in other formats.
> > > >>
> > > >> HTH,
> > > >>
> > > >> Marc Schwartz
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> >
>

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


Re: [R] adding 1 month to a date

2005-10-12 Thread David Forrest
On Wed, 12 Oct 2005, Jim Porzak wrote:

>  OTOH,
>
>  > seq(as.Date("2004-01-31"), by = "month", length = 14)
>   [1] "2004-01-31" "2004-03-02" "2004-03-31" "2004-05-01" "2004-05-31"
>   [6] "2004-07-01" "2004-07-31" "2004-08-31" "2004-10-01" "2004-10-31"
>  [11] "2004-12-01" "2004-12-31" "2005-01-31" "2005-03-03"
>
>  I would prefer to see dates forced to be within each month, not
>  "leaking" into next month.
>
>  IOW:
>   [1] "2004-01-31" "2004-02-29" "2004-03-31" "2004-04-30" "2004-05-31", etc

It depends how you intend "1 month after 2004-01-31".  Is the the same
number of days before the beginning of the next month or after the end of
the stated month?

   seq(as.Date("2004-02-01"), by = "month", length = 14)-1

   [1] "2004-01-31" "2004-02-29" "2004-03-31" "2004-04-30" "2004-05-31"

Dave
-- 
 Dr. David Forrest
 [EMAIL PROTECTED](804)684-7900w
 [EMAIL PROTECTED] (804)642-0662h
   http://maplepark.com/~drf5n/

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


[R] Memory allocation

2005-10-12 Thread Rod Staggs
I am trying to work with 75 affymetrix U133plus2 chips and am running into
memory allocation errors when trying to merge or convert probe level data to
expression values.

I keep getting - Error: cannot allocate vector of size 561011 Kb and that is
simply with a data subset.

Is there a way around this limitation?

-- 
Rodney A. Staggs
Cancer Center Informatics Shared Resource
425 Delaware St S.E. MMC 806
University of Minnesota
Minneapolis, MN  55455
 
Office: Room B532 Mayo
Telephone: (612)624-2445
Email: [EMAIL PROTECTED]

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


Re: [R] Memory allocation

2005-10-12 Thread James W. MacDonald
Rod Staggs wrote:
> I am trying to work with 75 affymetrix U133plus2 chips and am running into
> memory allocation errors when trying to merge or convert probe level data to
> expression values.

You don't say what package(s) you are using to do this, but assuming you 
are using the affy package, this is not the correct list - you should be 
using the BioC list ([EMAIL PROTECTED]).

To answer your question, there are several possibilities.

1.) Get more RAM (if on windows, start R with --max-mem-size=)

2.) Use justRMA()

3.) If on Windows, switch to *nix. The memory allocation is better, so 
you can analyze more chips with the same amount of RAM. Probably the 
easisest way to do this is with Quantian, which runs off a CD.


Best,

Jim



> 
> I keep getting - Error: cannot allocate vector of size 561011 Kb and that is
> simply with a data subset.
> 
> Is there a way around this limitation?
> 


-- 
James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

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


Re: [R] step.gam- question

2005-10-12 Thread Trevor Hastie
This is covered in the helpfile, but perhaps not clearly enough.
The gam chapter in the "white book" has more details.

step.gam moves around the terms in the scope aregumnet in an ordered 
fashion.
So if  a scope element is

~ 1 + x +s(x,4) + s(x,8)

and the formula at some stage is  ~ x + 

then if direction="both",  the routine checks both "1" and "s(x,4)" (i.e 
up or down the hierarchy by one move),
and does not check "s(x,8)"

If direction="forward", it will only look at "(s(x,4)", and so on.

This ordered behaviour was imposed in order to put some structure on the 
search,
and reduce the computational and variance overhead of a complete search.

[EMAIL PROTECTED] wrote:

>Dear Professor Hastie,
>
>
>I asked a question on r-help@stat.math.ethz.ch and I was told it'd be better to
>contact you aboutmy problem.
>
>I'm working with step.gam in gam package. I'm interested both in spline and
>loess functions and when I define all the models that I'm interested in I get
>something like that:
>
>  
>
>>gam.object.ALC<-gam(X143S~ALC,data=dane,family=binomial)
>>
>>
>>
>step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC+s(ALC,2)+s(ALC,3)+s(ALC,4)+s(ALC,6)+s(ALC,8)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))
> Start:  X143S ~ ALC; AIC= 104.0815
> Trial:  X143S ~  1; AIC= 111.1054
> Trial:  X143S ~  s(ALC, 2); AIC= 103.3325
> Step :  X143S ~ s(ALC, 2) ; AIC= 103.3325
>
> Trial:  X143S ~  s(ALC, 3); AIC= 102.9598
> Step :  X143S ~ s(ALC, 3) ; AIC= 102.9598
>
> Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
> Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103
>
> Trial:  X143S ~  s(ALC, 6); AIC= 102.4548
>
>I have impression that the algorithm stops when the next trial gives higher AIC
>without examining further functions. When I deleted some of the spline 
>functions
>that were worse than s(ALC,4) I got:
>
>  
>
>step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC++s(ALC,4)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))
> Start:  X143S ~ ALC; AIC= 104.0815
> Trial:  X143S ~  1; AIC= 111.1054
> Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
> Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103
>
> Trial:  X143S ~  lo(ALC, degree = 1, span = 0.5); AIC= 99.8127
> Step :  X143S ~ lo(ALC, degree = 1, span = 0.5) ; AIC= 99.8127
>
> Trial:  X143S ~  lo(ALC, degree = 2, span = 0.5); AIC= 100.5275
>
>Loess turned out to be better in this situation. Is there any way to examine
>all the models without stopping when AIC is higher in the next trial? How to
>handle this problem?
>
>I'd be grateful for any advise
>
>best regards
>
>Agnieszka Strzelczak, MSC
>
>PhD fellow
>Ministry of the Environment
>National Environmental Research Institute
>Velsøvej 25
>P.O. Box 314
>DK-8600 Silkeborg
>Denmark
>Phone +45 89 20 14 00
>Fax +45 89 20 14 14
>e-mail: [EMAIL PROTECTED]
>
>PhD student
>Institute of Chemistry and Environmental Protection
>Szczecin University of Technology
>Aleja Piastow 42
>71-065 Szczecin
>Phone +48 91 449 45 35
>e-mail: [EMAIL PROTECTED]
>  
>

-- 

  Trevor Hastie  [EMAIL PROTECTED]
  Professor, Department of Statistics, Stanford University
  Phone: (650) 725-2231 (Statistics) Fax: (650) 725-8977
 (650) 498-5233 (Biostatistics)  Fax: (650) 725-6951
  URL: http://www-stat.stanford.edu/~hastie
  address: room 104, Department of Statistics, Sequoia Hall
  390 Serra Mall, Stanford University, CA 94305-4065



[[alternative HTML version deleted]]

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

[R] Nonclinical Biostatistics Job Opening at Genentech in South San Francisco, CA

2005-10-12 Thread Berton Gunter
I hope that this job posting does not offend anyone. My sincere apologies if
it is inappropriate -- blame me, not my company. 

-- Bert Gunter
Genentech Nonclinical Statistics
South San Francisco, CA
 


Genentech has an opening for a fulltime position in its nonclinical
biostatistics department, located in South San Francisco, CA.

The nonclinical group currently consists of  seven MS and PhD level
statisticians and mathematicians who work with approximately 800 scientists,
engineers, and others in drug discovery, preclinical testing, process and
product development, manufacturing,  and quality control, among other areas
- essentially everything but clinical trials. Statistical activities are
commensurately diverse. Some "typical" ones are design and analysis of
animal testing for drug efficacy, pharmacokinetics, and toxicity; microarray
experiment design and data analysis; bioanalytical assay development; and
optimization of robust antibody fermentation and purification processes.

We are seeking individuals with a broad knowledge of statistical methodology
who are eager to work in an exciting collaborative environment to apply
their knowledge to drug discovery and development. Because we are a science
driven company on the cutting edge of technology, we also expect our members
to devote effort to learning about and staying current with our science and
technology so that they can better communicate and work with our scientists.
Basic qualifications that we seek include:

> MS or PhD in statistics or closely related discipline

>  Broad and deep understanding of statistical experimental design and
analysis   techniques, particularly in the areas of linear models and
regression

> Excellent problem-solving abilities

> Familiarity with statistical software packages such as SAS, R, S-Plus,
MATLAB

> Strong interpersonal skills 

> Ability to function effectively on interdisciplinary project teams

> Excellent oral and written communication skills   

> Experience teaching statistics or working as a statistical consultant

If you are interested in joining us, please email your CV and a cover letter
to Dr. David Giltinan,  [EMAIL PROTECTED]  .

Genentech, the founder of the biotechnology industry, has a 25-year track
record of translating the promise of biotechnology to medicines that help
seriously ill patients. The company is perennially rated among the
industry's most innovative and one of the best to work for. This strong
commitment to scientific research has  resulted in an unprecedented sequence
of successful clinical trials, an excellent pipeline, and remarkable growth.
To learn more, please go to  http://www.gene.com/gene/index.jsp

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


Re: [R] adding 1 month to a date

2005-10-12 Thread t c
Thanks.  How do I se thsi to calculate a new variable (e.g."data$next_month") 
from an existing variable (e.g."Data$date_").  
 
I tried : ,
 
but get the following error message:   "Error in seq.Date(as.Date(data$date), 
len = 2, by = "1 month") : 'from' must be of length 1"
 
Thanks.



Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
Try this:

seq(as.Date("2005-01-15"), len = 2, by = "month")[2]

or here is another approach:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/61570.html

On 10/11/05, t c wrote:
>
> Within an R dataset, I have a date field called "date_". (The dates are in 
> the format "-MM-DD", e.g. "1995-12-01".)
>
>
>
> How can I add or subtract "1 month" from this date, to get "1996-01-01" or " 
> "1995-11-01".
>
>
>
>
>
> -
>
> [[alternative HTML version deleted]]
>
>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>


-

[[alternative HTML version deleted]]

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


Re: [R] adding 1 month to a date

2005-10-12 Thread t c
Thanks.  How do I use this to calculate a new variable (e.g."data$next_month") 
from an existing variable (e.g."Data$date_").  
 
I tried : ,
 
but get the following error message:   "Error in seq.Date(as.Date(data$date), 
len = 2, by = "1 month") : 'from' must be of length 1"
 
Thanks.



Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
Try this:

seq(as.Date("2005-01-15"), len = 2, by = "month")[2]

or here is another approach:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/61570.html

On 10/11/05, t c wrote:
>
> Within an R dataset, I have a date field called "date_". (The dates are in 
> the format "-MM-DD", e.g. "1995-12-01".)
>
>
>
> How can I add or subtract "1 month" from this date, to get "1996-01-01" or " 
> "1995-11-01".
>
>
>
>
>
> -
>
> [[alternative HTML version deleted]]
>
>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>


-



-

[[alternative HTML version deleted]]

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


[R] functions available for use with aggregate?

2005-10-12 Thread t c

What are the functions available for use with “aggregate”?  Where can a 
reference to them be found?

 

 


-

[[alternative HTML version deleted]]

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

Re: [R] functions available for use with aggregate?

2005-10-12 Thread Sundar Dorai-Raj


t c wrote:
> What are the functions available for use with “aggregate”?  Where can a 
> reference to them be found?
> 
>  

Since aggregate is a S3 generic, you can use

methods(aggregate)

to see what objects have an "aggregate" method. For me, I have the 
following:

 > methods(aggregate)
[1] aggregate.data.frame aggregate.defaultaggregate.frm*
[4] aggregate.ts

Non-visible functions are asterisked
 >

See ?methods for more details.

HTH,

--sundar

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


[R] R training/"tutor"

2005-10-12 Thread t c

Can anyone recommend a place to post/look for someone to help me with R?  I'm 
looking for a consultant/trainer/tutor that knows R well, and can help me over 
the phone or via email. Thanks.

 



-

[[alternative HTML version deleted]]

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


[R] Mixed model for negative binomial distribution (glmm.ADMB)

2005-10-12 Thread nflynn
Dear R-list,

I thought that I would let some of you know of a free R package, glmm.ADMB, that
can handle mixed models for overdispersed and zero-inflated count data
(negativebinomial and poisson).
It was built using AD Model Builder software (Otter Research) for random effects
modeling and is available (for free and runs in R) at:

 http://otter-rsch.com/admbre/examples/glmmadmb/glmmADMB.html

I have been using this package for a split plot design along streams
(my  M.Sc thesis).  My response data was best described by a negative binomial
distribution (without zero-inflation) (beaver dam counts).

The model worked very well for my dataset and appeared to handle the
random effect (stream section).  Although I only had one random effect, 
glmm.ADMB can handle at least two nested random effects.  The output and
functions  available in glmm.ADMB are similar to those available in GLM.

One of my criteria for a mixed-model was that is provided the correct estimate
of the log-likelihood so that I could use an information theoretic approach for
 model selection, based on AIC values.  To my knowledge the maximum likelihood 
estimate for glmm.ADMB is appropriate for AIC model selection (*see comment
below), unlike glmmPQL.

Other packages that correctly estimate the log likelihood estimate,
such  as, Lindsey´s Repeated Measures Package (glmm)  and glmmML
do not accept the negative binomial family.  However glmm and glmmML do
accept the poisson family to describe the distribution of the response variable,
which may be adequate for modeling negative binomial data. The glmmML does not
allow for more than one random effect but glmmADMB is more flexible, in terms
of both random effects (allows nesting) and model output.

If any of you try glmm.ADMB, I would be very interested in your
feedback, especially in the realm of model verification, i.e. how is
the random effect really being handled.

You can also contact the creators at [EMAIL PROTECTED]  I found
them to be very helpful in explaining their software, both its benefits and 
limitations. They have also run some tests comparing glmm.ADMB to other 
software packages like SAS NLMIXED and arrived at similar solutions.

If any of you are interested in my model comparisons (glmm.admb,
glmm and glmmML)  I can send you some of my test data and results.

 Best Regards, Nadele Flynn

 *  "maximizing is the approximate likelihood obtained by integrating
out the random effects via the laplace approximation."
  (Otter Research Ltd)  This is not the exact maximum likelihood
   estimate, but I accepted any small error in the estimate and used
   it to calculate AIC values.

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


Re: [R] Correlation, by date, of two variables?

2005-10-12 Thread t c

I have a dataset with three variables: date, var1, var2

 

How can I calculate the correlation, by date, between var1 and var2?

e.g.


datevar1var2
1/1/200154
1/1/200185
1/1/200197

 

2/1/200172
2/1/200121
2/1/200146

 

3/1/200135
3/1/200143
3/1/200169
3/1/20017-1

 

the results I want:
1/1/2001 0.891042111
2/1/2001 0.075093926
3/1/2001 -0.263117406




-

[[alternative HTML version deleted]]

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


[R] linear mixed effect model with ordered logit/probit link?

2005-10-12 Thread byoung-inn bai
Hello,

I'm working on the multiple categorical data (5-points scale) using linear 
mixed effect model and wondering if anyone knows about or works on the 
linear mixed effect model with ordered logit or probit link.
I found that the "lmer" function in R is very flexible and supports 
various models, but not ordered logit/probit models. I may conduct my 
analysis by turning my DVs into nested dichotonomies, but just wonder if 
there is anyway that I can do this without transforming my DVs. Any help 
or suggestion will be greatly appreciated.

Thanks,

Byoung-Inn



Byoung-Inn Bai
Ph.D. Candidate
University of Washington
Department of Political Science
Box 353530
e-mail: [EMAIL PROTECTED]

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


Re: [R] linear mixed effect model with ordered logit/probit link?

2005-10-12 Thread Arturo Coral Alamo
Hi friends, I have a question.

I have this piece of my program and how you see, that's ok (whit > num<-
0.002)

num<-0.002
factor1<-1;
while(1)
{
if (num*factor1<1)
factor1<-factor1*10
else
{
print("out ok!!");
break;
}
}

[1] "out ok!!"


but when I change (whit > num<-0) R show this:

Error in if (num * factor1 < 1) factor1 <- factor1 * 10 else { :
missing value where TRUE/FALSE needed


I can't understand that error, can somebody help, please
thanks
 Jac

[[alternative HTML version deleted]]

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


Re: [R] Correlation, by date, of two variables?

2005-10-12 Thread Marc Schwartz (via MN)
On Wed, 2005-10-12 at 12:01 -0700, t c wrote:
> I have a dataset with three variables: date, var1, var2

> How can I calculate the correlation, by date, between var1 and var2?
> 
> e.g.
> 
> 
> datevar1var2
> 1/1/200154
> 1/1/200185
> 1/1/200197
> 
>  
> 
> 2/1/200172
> 2/1/200121
> 2/1/200146
> 
>  
> 
> 3/1/200135
> 3/1/200143
> 3/1/200169
> 3/1/20017-1
> 
>  
> 
> the results I want:
> 1/1/2001 0.891042111
> 2/1/2001 0.075093926
> 3/1/2001 -0.263117406

t c,

Given your series of posts here, I would highly recommend that before
you consider spending money on a tutor or other similar resource, you
take the time to read the freely available documentation that both R
Core and useRs have kindly provided to the Community. The R Core manuals
are all available with your downloaded installation of R and/or from the
main R web site under Documentation as are the Contributed documents.
You will find that your time will be well invested in that effort.

If you read the Posting Guide for the e-mail lists, a link to which is
provided at the bottom of every e-mail that comes through, you will find
an excellent guide to the resources that are available to assist you in
using R.

Trying to learn R (as with any technical endeavor) without reading at
least a basic set of the growing list of documents, books and
publications on R is going to be problematic.

A hint for you here:

See ?by, ?tapply, ?split and ?lapply for guidance on how to generate
summary statistics on subsets of data.

HTH,

Marc Schwartz

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


Re: [R] aligning column of xyplots and removing space between them

2005-10-12 Thread Deepayan Sarkar
On 10/11/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> On 10/11/05, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> > On 10/11/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> > > Thanks.  That works although the alignment is still not perfect.
> > > I am attaching the saved image in both .png and .emf formats
> > > so you can see what I mean.  Its not far off but its noticeable.
> > >
> > > In .emf format a portion of the bounding box does not come out
> > > either and it comes out bluish rather than white.  Not sure if such
> > > attachments can survive the list but I have sent you a copy too just
> > > in case.
> >
> > [I have no way to easily view the emf file, but] I can't see any
> > reason for the misalignment in the PNG file (other than a driver or
> > rendering bug). Do you see it in PDF output as well?
>
> Yes, it can be seen on the PDF version too (see attached).

Right. Looks like the horizontal paddings are to blame now. The
defaults are in terms of  "snpc" units, which produce different
physical units. The simplest workaround is to set them to 0 too, e.g.

theme.novpadding <-
  list(layout.heights =
   list(top.padding = 0,
main.key.padding = 0,
key.axis.padding = 0,
axis.xlab.padding = 0,
xlab.key.padding = 0,
key.sub.padding = 0,
bottom.padding = 0),
   layout.widths =
   list(left.padding = 0,
key.ylab.padding = 0,
ylab.axis.padding = 0,
axis.key.padding = 0,
right.padding = 0))

-Deepayan

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


Re: [R] adding 1 month to a date

2005-10-12 Thread Gabor Grothendieck
The chron package will do that:

> library(chron)
> seq(chron("01/31/00"), by = "months", len = 2)[2]
[1] 02/29/00


On 10/12/05, Jim Porzak <[EMAIL PROTECTED]> wrote:
>  OTOH,
>
>  > seq(as.Date("2004-01-31"), by = "month", length = 14)
>  [1] "2004-01-31" "2004-03-02" "2004-03-31" "2004-05-01" "2004-05-31"
>  [6] "2004-07-01" "2004-07-31" "2004-08-31" "2004-10-01" "2004-10-31"
>  [11] "2004-12-01" "2004-12-31" "2005-01-31" "2005-03-03"
>
>  I would prefer to see dates forced to be within each month, not
>  "leaking" into next month.
>
>  IOW:
>  [1] "2004-01-31" "2004-02-29" "2004-03-31" "2004-04-30" "2004-05-31", etc
>
>
>  --
>  Jim Porzak
>  Loyalty Matrix Inc.
>  San Francisco, CA
>
>
> > On 10/12/05, Marc Schwartz <[EMAIL PROTECTED]> wrote:
> > > Thanks to Prof. Ripley for pointing this out.
> > >
> > > One of the approaches that I had considered here was to set up a vector
> > > of the number of days in each month (adjusting of course for leap
> > > years), and use "day arithmetic" to add/subtract the appropriate number
> > > of days.
> > >
> > > However, it was easier to use seq.Date() and to further consider putting
> > > a wrapper around it to make it yet even easier to use.
> > >
> > > Marc
> > >
> > > On Wed, 2005-10-12 at 13:23 +0100, Prof Brian Ripley wrote:
> > > > On Wed, 12 Oct 2005, bogdan romocea wrote:
> > > >
> > > > > Simple addition and subtraction works as well:
> > > > >  as.Date("1995/12/01",format="%Y/%m/%d") + 30
> > > > > If you have datetime values you can use
> > > > >  strptime("1995-12-01 08:00:00",format="%Y-%m-%d %H:%M:%S") + 
> > > > > 30*24*3600
> > > > > where 30*24*3600 = 30 days expressed in seconds.
> > > >
> > > > Sorry, not in general, as a month is not generally of 30 days (including
> > > > in your example).
> > > >
> > > > seq.Date is a good way to do this.
> > > >
> > > > >
> > > > >
> > > > >> -Original Message-
> > > > >> From: Marc Schwartz [mailto:[EMAIL PROTECTED]
> > > > >> Sent: Tuesday, October 11, 2005 10:16 PM
> > > > >> To: t c
> > > > >> Cc: r-help@stat.math.ethz.ch
> > > > >> Subject: Re: [R] adding 1 month to a date
> > > > >>
> > > > >>
> > > > >> On Tue, 2005-10-11 at 16:26 -0700, t c wrote:
> > > > >>> Within an R dataset, I have a date field called date_.
> > > > >> (The dates are
> > > > >>> in the format -MM-DD, e.g. 1995-12-01.)
> > > > >>
> > > > >>> How can I add or subtract 1 month from this date, to get
> > > > >> 1996-01-01 or
> > > > >>> 1995-11-01.
> > > > >>
> > > > >> There might be an easier way to do this, but using seq.Date(), you 
> > > > >> can
> > > > >> increment or decrement from a Time 0 by months:
> > > > >>
> > > > >> Add 1 month:
> > > > >>
> > > > >> This takes your Time 0, generates a 2 element sequence (which begins
> > > > >> with Time 0) and then takes the second element:
> > > > >>
> > > > >>> seq(as.Date("1995-12-01"), by = "month", length = 2)[2]
> > > > >> [1] "1996-01-01"
> > > > >>
> > > > >>
> > > > >>
> > > > >> Subtract 1 month:
> > > > >>
> > > > >> Same as above, but we use 'by = "-1 month"' and take the
> > > > >> second element:
> > > > >>
> > > > >>> seq(as.Date("1995-12-01"), by = "-1 month", length = 2)[2]
> > > > >> [1] "1995-11-01"
> > > > >>
> > > > >>
> > > > >> See ?as.Date and ?seq.Date for more information. The former
> > > > >> function is
> > > > >> used to convert from a character vector to a Date class object. Note
> > > > >> that in your case, the date format is consistent with the default. 
> > > > >> Pay
> > > > >> attention to the 'format' argument in as.Date() if your dates
> > > > >> should be
> > > > >> in other formats.
> > > > >>
> > > > >> HTH,
> > > > >>
> > > > >> Marc Schwartz
> > >
> > > __
> > > R-help@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide! 
> > > http://www.R-project.org/posting-guide.html
> > >
> >
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] adding 1 month to a date

2005-10-12 Thread Gabor Grothendieck
Try this:

seq(as.Date("2005-01-15"), len = 2, by = "month")[2]

or here is another approach:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/61570.html

On 10/11/05, t c <[EMAIL PROTECTED]> wrote:
>
> Within an R dataset, I have a date field called "date_".  (The dates are in 
> the format "-MM-DD", e.g. "1995-12-01".)
>
>
>
> How can I add or subtract "1 month" from this date, to get "1996-01-01" or " 
> "1995-11-01".
>
>
>
>
>
> -
>
>[[alternative HTML version deleted]]
>
>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

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


[R] running JPEG device on R 1.9.1 using xvfb-run on Linux

2005-10-12 Thread David Zhao
Hi there,
 Does anybody have experience in running jpeg device using xvfb-run on
linux? I've been having sporadic problem with: /usr/X11/bin/xvfb-run
/usr/bin/R --no-save < Rinput.txt, with error saying: error in X11
connection. Especially when I run it from a perl script.
Is there a better way of doing this? or how can I fix the problem.
 Thanks in advance!
 David

[[alternative HTML version deleted]]

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


Re: [R] adding 1 month to a date

2005-10-12 Thread Gabor Grothendieck
Try this. Note that mapply strips off the class which is why we
set up dd with the correct class and then just replaced the values.

# test data
d <- as.Date("2005-1-1") + seq(0,90,30)

# calculations, dd is the result
next.month <- function(x) seq(x, len = 2, by = "months")[2]
dd <- d
dd[] <- mapply(next.month, dd)


On 10/12/05, t c <[EMAIL PROTECTED]> wrote:
> Thanks.  How do I use this to calculate a new variable 
> (e.g."data$next_month") from an existing variable (e.g."Data$date_").
>
> I tried :  "month")[2]>,
>
> but get the following error message:   "Error in seq.Date(as.Date(data$date), 
> len = 2, by = "1 month") : 'from' must be of length 1"
>
> Thanks.
>
>
>
> Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> Try this:
>
> seq(as.Date("2005-01-15"), len = 2, by = "month")[2]
>
> or here is another approach:
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/61570.html
>
> On 10/11/05, t c wrote:
> >
> > Within an R dataset, I have a date field called "date_". (The dates are in 
> > the format "-MM-DD", e.g. "1995-12-01".)
> >
> >
> >
> > How can I add or subtract "1 month" from this date, to get "1996-01-01" or 
> > " "1995-11-01".
> >
> >
> >
> >
> >
> > -
> >
> > [[alternative HTML version deleted]]
> >
> >
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> > http://www.R-project.org/posting-guide.html
> >
> >
>
>
> -
>
>
>
> -
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


[R] How to install R 2.2.0 Debian 'unstable' package in otherwise 'sarge' system

2005-10-12 Thread Dan Davison
I would like to install the latest version of R (the statistical computing 
software). This is package r-base version 2.2.0 and is in the debian 
'unstable' repository. Otherwise my system has 'sarge' packages, including 
r-base 2.1.0. What is the best way to do this? If I don't want to upgrade 
to unstable, must I compile R myself, or is there some way to install this 
as a debian package?

I have tried:

(i) pointing /etc/apt/sources.list at unstable, apt-get updating and then 
apt-get install r-base. This results in

[... full output at bottom of email ...]

E: This installation run will require temporarily removing the essential
package e2fsprogs due to a Conflicts/Pre-Depends loop. This is often bad,
but if you really want to do it, activate the APT::Force-LoopBreak option.
E: Internal Error, Could not early remove e2fsprogs

which scares me into desisting with this course of action.

(ii) apt-get install -t unstable r-base, but it replies that 
r-base is already the newest version. Have I not invoked this command 
correctly, or does the -t switch not do what I was thinking it did?


Thanks very much for any help,

Dan


dd:/home/dan# apt-get install r-base
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
   e2fslibs e2fsprogs gcc-3.4-base libblkid1 libc6 libc6-dev libg2c0 
libgcc1 libss2
   libuuid1 locales r-base-core r-base-dev r-recommended
Suggested packages:
   gpart parted e2fsck-static glibc-doc ess libpaper-utils
The following NEW packages will be installed:
   e2fslibs gcc-3.4-base libblkid1 libss2 libuuid1
The following packages will be upgraded:
   e2fsprogs libc6 libc6-dev libg2c0 libgcc1 locales r-base r-base-core 
r-base-dev
   r-recommended
10 upgraded, 5 newly installed, 0 to remove and 536 not upgraded.
Need to get 0B/21.4MB of archives.
After unpacking 5886kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
E: This installation run will require temporarily removing the essential 
package e2fsprogs due to a Conflicts/Pre-Depends loop. This is often bad, 
but if you really want to do it, activate the APT::Force-LoopBreak option.
E: Internal Error, Could not early remove e2fsprogs

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


[R] subsetting with by() or other function??

2005-10-12 Thread Brian S Cade
I think I must be missing something obvious, but I'm having trouble 
getting a data transformation to work on groupings of data within a data 
frame (csss3) as defined by 2 factors (population, locid).  The data are 
sorted by year within locid within population and I want to lag another 
variable (dbc), i.e, shift them down by 1 row replacing the first row with 
NA, within groups defined by locid nested within population.  I thought I 
could do something using by(csss3,list(locid, population), function) but 
don't seem to be having any success.  Any suggestions??

Brian

Brian S. Cade

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO  80526-8818

email:  [EMAIL PROTECTED]
tel:  970 226-9326
[[alternative HTML version deleted]]

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


Re: [R] How to install R 2.2.0 Debian 'unstable' package in otherwise 'sarge' system

2005-10-12 Thread Christian T. Steigies
On Wed, Oct 12, 2005 at 04:04:50PM -0500, Dan Davison wrote:
> I would like to install the latest version of R (the statistical computing 
> software). This is package r-base version 2.2.0 and is in the debian 
> 'unstable' repository. Otherwise my system has 'sarge' packages, including 
> r-base 2.1.0. What is the best way to do this? If I don't want to upgrade 
> to unstable, must I compile R myself, or is there some way to install this 
> as a debian package?

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Are-there-Unix-binaries-for-R_003f

I haven't build 2.2.0 yet, but I will probably do it next weekend. R 2.1.1
is available and you should be able to install it without too many problems
(you might have to remove a lot of r-cran packages which I all put into the
r-recommended package for the backport, I'll try to fix that for the next
version).

Christian

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


Re: [R] aligning column of xyplots and removing space between them

2005-10-12 Thread Gabor Grothendieck
On 10/11/05, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> On 10/11/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> > Thanks.  That works although the alignment is still not perfect.
> > I am attaching the saved image in both .png and .emf formats
> > so you can see what I mean.  Its not far off but its noticeable.
> >
> > In .emf format a portion of the bounding box does not come out
> > either and it comes out bluish rather than white.  Not sure if such
> > attachments can survive the list but I have sent you a copy too just
> > in case.
>
> [I have no way to easily view the emf file, but] I can't see any
> reason for the misalignment in the PNG file (other than a driver or
> rendering bug). Do you see it in PDF output as well?

Yes, it can be seen on the PDF version too (see attached).


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

Re: [R] bug checking

2005-10-12 Thread Gabor Grothendieck
Yes, its a bug.  The calls to axis.times in plot.times use the same
col variable as the points do.  This shows it more compactly:

library(chron)
x <- seq.dates(from="09/30/2005", len = 10)
plot(x, 1:10, col = "red")

A workaround would be to plot the X axis separately:

plot(x, 1:10, col = "red", xaxt = "n")
axis.times(1, x)

or use plot.Date:

library(zoo)  # needed for as.Date.numeric
plot(as.Date(as.numeric(x)), 1:length(x), col = "red")



On 10/12/05, Parlamis Franklin <[EMAIL PROTECTED]> wrote:
> ## Code was long, so I simplified it by creating vectors from scratch
> so it would run as is.  Putative "bug" is still evidenced on the x axis
>
> discount.factors.dates <- seq.dates(from="09/30/2005", to="09/30/2035")
> rates<-seq(4.4, 5.2, by=0.0025);
> plot(discount.factors.dates[1:length(rates)], rates,
>  pch=18, las=1, bty="n",
>  col="red", col.main="red",
>  xlab="Date", ylab="Rate",
>  ylim=c(min(rates)-(max(rates)-min(rates))/10,max(rates)+(max
> (rates)-min(rates))/10))
>
> ## This is the output:
>
>
>
>
> ## Hopefully you all see the red x axis.
>
> ## I am running R Cocoa GUI 1.1.2 with R 2.1.1 framework on a dual
> proc 2.7 Ghz Power Mac.  A Quartz device is opened when 'plot' is
> called.  X11User and X11SDK are installed on t he computer, as well
> as xCode 2.1 (in case that's relevant).
>
>
> On Oct 11, 2005, at 4:47 PM, Marc Schwartz wrote:
>
> > On Tue, 2005-10-11 at 16:07 -1000, Parlamis Franklin wrote:
> >
> >> I have observed the following behavior, wondering if it is a bug
> >> before I submit a report.
> >>
> >> I am using the plot function with call:  plot(X, Y,
> >> col="red", . . . ) where X is an object that inherits from classes
> >> 'dates' and 'times' (created with the 'dates' function from package
> >> 'chron') and y is a numeric vector.  The color red is applied to the
> >> area from the first to the last tick mark on the x axis (even if I
> >> don't set col="red" and only set, say col.main="red").
> >>
> >> If instead of feeding the function X, I feed it unclass(X) or
> >> as.vector(X) the red color is not applied to the area between the
> >> first and last ticks on the x axis.
> >>
> >> Is this a bug, or just a consequence of there not being a plot method
> >> for the class I am trying to feed the function?
> >>
> >> Franklin Parlamis
> >>
> >
> > As per the Posting Guide, it would be immensely helpful in the attempt
> > to help you, if you would provide the exact code you are using and
> > some
> > sample data here, so that we can exactly replicate what you are
> > experiencing.
> >
> > Lacking that, it would be difficult to assist as we can only guess. It
> > does sound like there is an _appropriate_ change in the plot method
> > behavior as a direct consequence of your modifying the class of the
> > argument(s), which is of course how methods are dispatched. Thus, if I
> > were to guess, this is not a bug.
> >
> > I would however, certainly recommend that you submit an example
> > here to
> > confirm the behavior, before you post a bug report, as that would
> > avoid
> > a more energetic response.
> >
> > Marc Schwartz
> >
> >
> >
>
>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>

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


[R] Problem with a barplot...

2005-10-12 Thread Steven Hamblin
Hello,

I'm having a bit of a problem with a plot, and I'm hoping that someone might
be able to help.  I'm running the R Cocoa Gui v1.12 on OS X 10.4.2, and I'm
doing a stacked bar plot.  The plot itself is quite simple:

barplot(as.matrix(s.strats.in),main="Strategy when strong", col=strat.col)

where s.strats.in is a matrix with a number of rows that define the height
of each stacked bar.  However, ever since I expanded the number of columns
from 100 to 500, the borders of the bars are overwhelming the plot (the bars
are proportionally smaller, and thus the colours are getting muddied by the
black borders).  Changing the border colour doesn't help at all, and I was
hoping that there was a way to remove the borders of the bars (i.e. have
each bar snug right up against the next).  I've tried varying any parameter
that seems to have the slightest relation, but no luck.

Can someone point how to remove the borders or perhaps suggest an equivalent
way to do this with another function?  I would appreciate any and all help.

Cheers,

Steven Hamblin
-- 
Master of Arts student
Department of Psychology, University of Alberta.
Office: P-319F, Biological Sciences
Phone:  492-6681  e-mail: [EMAIL PROTECTED]

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


Re: [R] How to install R 2.2.0 Debian 'unstable' package in otherwise 'sarge' system

2005-10-12 Thread Dirk Eddelbuettel
Dan,

First off, there is even a r-sig-debian list in the universe of R mailing
lists (c.f. the R FAQ). That probably provides a more focused readership
than the union of r-help (where many won't know Debian) and debian-user
(where many won't know R).

On Wed, Oct 12, 2005 at 04:04:50PM -0500, Dan Davison wrote:
> I would like to install the latest version of R (the statistical computing 
> software). This is package r-base version 2.2.0 and is in the debian 
> 'unstable' repository. Otherwise my system has 'sarge' packages, including 
> r-base 2.1.0. What is the best way to do this? 

Short answers: 

i) In general, and especially between 'testing' and 'unstable', use
apt-pinning, explained in the apt-howto packages, esp apt-howto-en for
English; and on various places across the Net; try Google'ing for
apt-pinning.

That way you get the option of installing selected parts of unstable without
being forced to upgrade wholesale.  Myself and countless other have used
this for years between testing and unstable.  However, I am not so sure how
well it works between stable and unstable. It may work now as stable is
fairly recent, but may fail further down the road.

ii) In this particular case, and as explained in the R FAQ, the CRAN
archives have an apt-get'able section for Debian stable. However, Christian,
the (CC'ed) maintainer of this backport was traveling between conferences in
the US and has not yet provided R 2.2.0 (which was released less than a week
ago, after all).  It should appear shortly.

> to unstable, must I compile R myself, or is there some way to install this 
> as a debian package?

You can also recompile locally using one of two ways:

iii) as a local Debian package, and apt-get source makes that almost automatic
(provided you have source URIs in /etc/apt/sources.list, and that the
Build-Depends are actually satisfiable under Debian stable), or

iv) as non-Debian compile into /usr/local

If you're in a hurry, iv) is your way.  If you're intrigued by iii), try it.
If you can wait a few days, ii) is probably your best bet.

> I have tried:
> 
> (i) pointing /etc/apt/sources.list at unstable, apt-get updating and then 
> apt-get install r-base. This results in
> 
> [... full output at bottom of email ...]
> 
> E: This installation run will require temporarily removing the essential
> package e2fsprogs due to a Conflicts/Pre-Depends loop. This is often bad,
> but if you really want to do it, activate the APT::Force-LoopBreak option.
> E: Internal Error, Could not early remove e2fsprogs
> 
> which scares me into desisting with this course of action.

I'd agree. Don't force things against warnings like this.

> (ii) apt-get install -t unstable r-base, but it replies that 
> r-base is already the newest version. Have I not invoked this command 
> correctly, or does the -t switch not do what I was thinking it did?

Did you run 'apt-get update' after altering /etc/apt/sources.list ?

Try 'apt-cache policy r-base-core' which will tell you about the versions it
knows, where they are from, and how they are prioritized (aka "pinned").

> Thanks very much for any help,

Pleasure. Let me know in private mail if this is clear enough, and we could
even follow up on a local phone call.

Greetings from across town to Hyde Park,  Dirk


> 
> Dan
> 
> 
> dd:/home/dan# apt-get install r-base
> Reading Package Lists... Done
> Building Dependency Tree... Done
> The following extra packages will be installed:
>e2fslibs e2fsprogs gcc-3.4-base libblkid1 libc6 libc6-dev libg2c0 
> libgcc1 libss2
>libuuid1 locales r-base-core r-base-dev r-recommended
> Suggested packages:
>gpart parted e2fsck-static glibc-doc ess libpaper-utils
> The following NEW packages will be installed:
>e2fslibs gcc-3.4-base libblkid1 libss2 libuuid1
> The following packages will be upgraded:
>e2fsprogs libc6 libc6-dev libg2c0 libgcc1 locales r-base r-base-core 
> r-base-dev
>r-recommended
> 10 upgraded, 5 newly installed, 0 to remove and 536 not upgraded.
> Need to get 0B/21.4MB of archives.
> After unpacking 5886kB of additional disk space will be used.
> Do you want to continue? [Y/n] Y
> E: This installation run will require temporarily removing the essential 
> package e2fsprogs due to a Conflicts/Pre-Depends loop. This is often bad, 
> but if you really want to do it, activate the APT::Force-LoopBreak option.
> E: Internal Error, Could not early remove e2fsprogs
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Statistics: The (futile) attempt to offer certainty about uncertainty.
 -- Roger Koenker, 'Dictionary of Received Ideas of Statistics'

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

Re: [R] How to install R 2.2.0 Debian 'unstable' package in otherwise 'sarge' system

2005-10-12 Thread Thomas Schönhoff
Hi,

2005/10/12, Christian T. Steigies <[EMAIL PROTECTED]>:
> On Wed, Oct 12, 2005 at 04:04:50PM -0500, Dan Davison wrote:
> > I would like to install the latest version of R (the statistical computing
> > software). This is package r-base version 2.2.0 and is in the debian
> > 'unstable' repository. Otherwise my system has 'sarge' packages, including
> > r-base 2.1.0. What is the best way to do this? If I don't want to upgrade
> > to unstable, must I compile R myself, or is there some way to install this
> > as a debian package?
>
> http://cran.r-project.org/doc/FAQ/R-FAQ.html#Are-there-Unix-binaries-for-R_003f

I used the line proposed in this linked document (cut and paste) and
got an error of missformed line by apt get. Anything wrong with this?
>
> I haven't build 2.2.0 yet, but I will probably do it next weekend. R 2.1.1
> is available and you should be able to install it without too many problems
> (you might have to remove a lot of r-cran packages which I all put into the
> r-recommended package for the backport, I'll try to fix that for the next
> version).

Regards
Thomas

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


Re: [R] How to install R 2.2.0 Debian 'unstable' package in otherwise 'sarge' system

2005-10-12 Thread Kjetil Kjernsmo
On onsdag 12 oktober 2005, 23:04, Dan Davison wrote:
> What is the best way to do this? If I don't want to upgrade
> to unstable, must I compile R myself, or is there some way to install
> this as a debian package?

Then, I'd recommend using the R's own backports, this line would 
probably do the trick:
deb http://cran.us.r-project.org/bin/linux/debian stable/
and allthough it isn't there yet, it'll probably be there soon.

However, I played with apt-build the other day, and produced my own 
build. It was quite fun, so reading up on apt-build can be a nice 
exercise.

Cheers,

Kjetil
-- 
Kjetil Kjernsmo
Programmer / Astrophysicist / Ski-orienteer / Orienteer / Mountaineer
[EMAIL PROTECTED]   
Homepage: http://www.kjetil.kjernsmo.net/ OpenPGP KeyID: 6A6A0BBC

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


Re: [R] Problem with a barplot...

2005-10-12 Thread Jim Lemon
Steven Hamblin wrote:
> Hello,
> 
> I'm having a bit of a problem with a plot, and I'm hoping that someone might
> be able to help.  I'm running the R Cocoa Gui v1.12 on OS X 10.4.2, and I'm
> doing a stacked bar plot.  The plot itself is quite simple:
> 
> barplot(as.matrix(s.strats.in),main="Strategy when strong", col=strat.col)
> 
> where s.strats.in is a matrix with a number of rows that define the height
> of each stacked bar.  However, ever since I expanded the number of columns
> from 100 to 500, the borders of the bars are overwhelming the plot (the bars
> are proportionally smaller, and thus the colours are getting muddied by the
> black borders).  Changing the border colour doesn't help at all, and I was
> hoping that there was a way to remove the borders of the bars (i.e. have
> each bar snug right up against the next).  I've tried varying any parameter
> that seems to have the slightest relation, but no luck.
> 
> Can someone point how to remove the borders or perhaps suggest an equivalent
> way to do this with another function?  I would appreciate any and all help.
> 
Hi Steven,

Try border=NA (not explained in the barplot help page, but elsewhere).

Jim

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


Re: [R] aligning column of xyplots and removing space between them

2005-10-12 Thread Gabor Grothendieck
Thanks.  That works although the alignment is still not perfect.
I am attaching the saved image in both .png and .emf formats
so you can see what I mean.  Its not far off but its noticeable.

In .emf format a portion of the bounding box does not come out
either and it comes out bluish rather than white.  Not sure if such
attachments can survive the list but I have sent you a copy too just
in case.

Regards.

P.S. My R version is the following:

> packageDescription("lattice")$Version
[1] "0.12-10"
> R.version; R.version.string
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status   alpha
major2
minor2.0
year 2005
month09
day  20
svn rev  35632
language R
[1] "R version 2.2.0, 2005-09-20"


On 10/11/05, Deepayan Sarkar <[EMAIL PROTECTED]> wrote:
> On 10/11/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> > The code below displays three graphs in three rows and one column but:
> >
> > 1. I want to remove the space between the graphs (I tried playing with 
> > position=
> > arg to print.trellis but it seems quite difficult to get the right
> > values and all
> > my attempts had space between them or had overlapping graphs.  Is
> > there a better way to do this?
>
> Define
>
> theme.novpadding <- list(layout.heights =
>list(top.padding = 0,
> main.key.padding = 0,
> key.axis.padding = 0,
> axis.xlab.padding = 0,
> xlab.key.padding = 0,
> key.sub.padding = 0,
> bottom.padding = 0))
>
> and then add
>
> par.settings = theme.novpadding
>
> to all your xyplot calls.
>
> > 2. the widths of the plots are not the same even though I specified the same
> > xlim= to them all.  How do I make them the same?
>
> They seem to be the same for me, but they might be different if the
> y-axis labels are different. See the 'panel.width' argument in
> ?print.trellis.
>
>
> > 3. how do I get rid of the ticks at the top of the bottom plot?
>
> add
>
> scales = list(x = list(relation = "free"))
>
> > 4. the bottom graph is supposed to plot 1:3 against itself but the third
> > point is not showing even though I specified ylim = c(0,3).  Must
> > I specify ylim = c(0,3+1) or is there a better way?
>
> There's no better way. This behaviour is intentionally different from
> base graphics.
>
> Here's a modified version of the last part of your code:
>
> grid.newpage()
>
> # n and nr are number of cells and rows
> n <- nr <- 3
> nc <- 1  # must be 1
>
> heights <- unit(c(2, rep(1, nr-1)), "null")
> downViewport(pushLayout(nr, nc, heights = heights))
>
> vpt <- current.vpTree(all = FALSE)
>
> ### relevant part starts here
> #
>
> xlab <- main <- function(x) if (x) "v"
> for(k in 1:n) with(vpt$children[[k]],
>   print( xyplot(v ~ v, list(v = 1:k), xlab = xlab(k == n),
>   xlim = c(0,n), ylim = c(0,n), main = main(k == 1),
>   par.settings = theme.novpadding,
>   scales = list(x = list(draw = k == n, relation = "free", c(1, 0)),
> y = list(alternating = 3))),
>   newpage = FALSE, panel.width = list(x = 4, units = "inches"))
> )
>
> -Deepayan
>


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

[R] Can R functions be implented in Matlab

2005-10-12 Thread Madhu Kishore
Hi,
 I am Madhu Kishore a Graduate student at University of Texas at El Paso in 
Electrical Engineering.  I am using R language for Normality tests and my doubt 
is can implements the R functions in Matlab.  I expect to hear from you soon.
Madhu kishore.


-

[[alternative HTML version deleted]]

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


[R] forcing a variable in a model

2005-10-12 Thread Jenny Dawson
I am interested in using polymars in R.  I will be inputting 10 X variables 
and my outcome Y variable.  I want to make sure my final model includes X1 
and any additional variables (X2-X10) chosen with the data adaptive 
regression technique.  Is this possible with polymars?

In addition, if I use the step() finction after a lm() function, can I force 
one variable to be in the final model?  I tried using the scope argument in 
the step() command, but had no luck.  I set my upper equal to my full model 
and was not sure how I tell R that my lower model must have X1 in the model.


Thank you in advance,
Jenny

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


Re: [R] functions available for use with aggregate?

2005-10-12 Thread Spencer Graves
  1.  There is also "aggregate.zoo" in the "zoo" package.

  2.  If your question is which functions can be used for the "FUN" 
argument, you can write your own.  For example:

 > set.seed(1)
 > tstDF <- data.frame(x=rep(1:4, e=2),
+ y=rnorm(8))
 > aggregate(tstDF[2], tstDF[1],
+   function(z)max(z)/min(z))
   x  y
1 1 -0.2931474
2 2 -1.9090787
3 3 -0.4016093
4 4  1.5147327
 >
  spencer graves

Sundar Dorai-Raj wrote:

> 
> t c wrote:
> 
>>What are the functions available for use with “aggregate”?  Where can a 
>>reference to them be found?
>>
>> 
> 
> 
> Since aggregate is a S3 generic, you can use
> 
> methods(aggregate)
> 
> to see what objects have an "aggregate" method. For me, I have the 
> following:
> 
>  > methods(aggregate)
> [1] aggregate.data.frame aggregate.defaultaggregate.frm*
> [4] aggregate.ts
> 
> Non-visible functions are asterisked
>  >
> 
> See ?methods for more details.
> 
> HTH,
> 
> --sundar
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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

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


Re: [R] Can R functions be implented in Matlab

2005-10-12 Thread Ted Harding
On 12-Oct-05 Madhu Kishore wrote:
> Hi,
>  I am Madhu Kishore a Graduate student at University of Texas at El
> Paso in Electrical Engineering.  I am using R language for Normality
> tests and my doubt is can implements the R functions in Matlab.  I
> expect to hear from you soon.
> Madhu kishore.

Some of the simpler R functions could be implemented in MatLab with
equivalent effect; in particular, anything which depends mainly on
straightforward array (especially matrix and vector) calculations
should not be too difficult. You are also likely to find MatLab
functions which implement many of the computations in various
normality tests directly, so you should not need to rewrite these;
just use the MatLab functions.

However, don't even think of emulating anything extensive from R
in MatLab! Not only would you ever finish your studies, you would
probably never finish you R->MatLab project. They are quite
different programming languages, and even something as basic
as getting MatLab to emulate the R command

  summary(lm(y ~ A*B))

would be a major task if undertaken from scratch.

Why not just use one or the other, whichever best suits your
purpose of the moment?

Best wishes,
Ted.



E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 12-Oct-05   Time: 23:55:45
-- XFMail --

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


Re: [R] Can R functions be implented in Matlab

2005-10-12 Thread Gabor Grothendieck
The following might help:

http://cran.r-project.org/doc/contrib/R-and-octave-2.txt

On 10/12/05, Madhu Kishore <[EMAIL PROTECTED]> wrote:
> Hi,
> I am Madhu Kishore a Graduate student at University of Texas at El Paso 
> in Electrical Engineering.  I am using R language for Normality tests and my 
> doubt is can implements the R functions in Matlab.  I expect to hear from you 
> soon.
> Madhu kishore.
>
>
> -
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Problem with a barplot...

2005-10-12 Thread Steven Hamblin
Jim,

Thanks for the suggestion!  It worked great.  (I wonder why that isn't
documented in the help file for barplot...seems logical to me.  )

Cheers,

Steven Hamblin
-- 
Master of Arts student
Department of Psychology, University of Alberta.
Office: P-319F, Biological Sciences
Phone:  492-6681  e-mail: [EMAIL PROTECTED]


On 10/13/05 2:12 AM, "Jim Lemon" <[EMAIL PROTECTED]> wrote:

> Steven Hamblin wrote:
>> Hello,
>> 
>> I'm having a bit of a problem with a plot, and I'm hoping that someone might
>> be able to help.  I'm running the R Cocoa Gui v1.12 on OS X 10.4.2, and I'm
>> doing a stacked bar plot.  The plot itself is quite simple:
>> 
>> barplot(as.matrix(s.strats.in),main="Strategy when strong", col=strat.col)
>> 
>> where s.strats.in is a matrix with a number of rows that define the height
>> of each stacked bar.  However, ever since I expanded the number of columns
>> from 100 to 500, the borders of the bars are overwhelming the plot (the bars
>> are proportionally smaller, and thus the colours are getting muddied by the
>> black borders).  Changing the border colour doesn't help at all, and I was
>> hoping that there was a way to remove the borders of the bars (i.e. have
>> each bar snug right up against the next).  I've tried varying any parameter
>> that seems to have the slightest relation, but no luck.
>> 
>> Can someone point how to remove the borders or perhaps suggest an equivalent
>> way to do this with another function?  I would appreciate any and all help.
>> 
> Hi Steven,
> 
> Try border=NA (not explained in the barplot help page, but elsewhere).
> 
> Jim
>

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


[R] About Qusi-Monte carlo program

2005-10-12 Thread Zhao Yang
Dear Listers;
 
Does anybody has experience in doing simulation via Qusi-Monte carlo in R or 
S-plus, if so, could you like to send a small copy of your program to me, I 
appreciate and thanks in advance!!
 
Frankly speaking, I am struggling to write this kind of program, while I could 
not figure out, painful!
 
Best regards,
Tony
 
 


-

[[alternative HTML version deleted]]

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


[R] Optim with two constraints

2005-10-12 Thread Jens Hainmueller
Hi R-list,

I am new to optimization in R and would appreciate help on the following
question. I would like to minimize the following function using two
constraints:

##
fn <- function(par,H,F){
  
 fval <- 0.5 * t(par) %*% H %*% par + F%*% par
 fval  
  
  }

# matrix H is (n by k)
# matrix F is (n by 1) 
# par is a (n by 1) set of weights 

# I need two constraints:
# 1. each element in par needs to be between 0 and 1
# 2. sum(par)=1 i.e. the elements in par need to sum to 1

## I try to use optim
res <- optim(c(runif(16),fn, method="L-BFGS-B", H=H, F=f
,control=list(fnscale=-1), lower=0, upper=1)
##

If I understand this correctly, using L-BFGS-B with lower=0 and upper=1
should take care of constraint 1 (box constraints). What I am lacking is the
skill to include constraint no 2.

I guess I could solve this by reparametrization but I am not sure how
exactly. I could not find (i.e. wasn't able to infer) the answer to this in
the archives despite the many comments on optim and constrained optimization
(sorry if I missed it there). I am using version 2.1.1 under windows XP.

Thank you very much.

Jens

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


[R] R Linux Live On CD

2005-10-12 Thread Unung Istopo Hartanto
Dear UseR,

We've build R live on CD, you can download R iso in :

http://kambing.vlsm.org/debian-cd/renceity/

or

http://mirror.eepis-its.edu/pub/linux-iso/renciety/renciety-15092005.iso

Thanks for all R project teams and we receive your critics and suggests.

Regards,
-- 
Unung Istopo Hartanto

ENCIETY Business Consult
Jl. Manyar Tirtoyoso Utara V/7
Telp. +62-31-5992340, Fax. +62-31-5994230
www.enciety.com

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


Re: [R] Can R functions be implented in Matlab

2005-10-12 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



And additionally, there is an R-Matlab interface that may work
for you. Currently it only works for Unix.

  http://www.omegahat.org/RMatlab

 D.


Gabor Grothendieck wrote:
> The following might help:
> 
> http://cran.r-project.org/doc/contrib/R-and-octave-2.txt
> 
> On 10/12/05, Madhu Kishore <[EMAIL PROTECTED]> wrote:
> 
>>Hi,
>>I am Madhu Kishore a Graduate student at University of Texas at El Paso 
>> in Electrical Engineering.  I am using R language for Normality tests and my 
>> doubt is can implements the R functions in Matlab.  I expect to hear from 
>> you soon.
>>Madhu kishore.
>>
>>
>>-
>>
>>   [[alternative HTML version deleted]]
>>
>>__
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>>
> 
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

- --
Duncan Temple Lang[EMAIL PROTECTED]
Department of Statistics  work:  (530) 752-4782
371 Kerr Hall fax:   (530) 752-7099
One Shields Ave.
University of California at Davis
Davis, CA 95616, USA
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDTdrB9p/Jzwa2QP4RAqEMAJ4nY2wbnmmeUcJauJYklMxeGdYGsQCdGl8t
GxyYThnHgflC3GbnBdVYdBE=
=pSzz
-END PGP SIGNATURE-

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


Re: [R] running JPEG device on R 1.9.1 using xvfb-run on Linux

2005-10-12 Thread Prof Brian Ripley
On Wed, 12 Oct 2005, David Zhao wrote:

> Does anybody have experience in running jpeg device using xvfb-run on
> linux? I've been having sporadic problem with: /usr/X11/bin/xvfb-run
> /usr/bin/R --no-save < Rinput.txt, with error saying: error in X11
> connection. Especially when I run it from a perl script.

Not sure what `xvfb-run on Linux' is, as it is not on my Linux (FC3).
If you Google it you will find a number of problems reported on Debian 
lists.  Here I would suspect timing.

What I do is to run Xvfb on screen 5 by

Xvfb :5 &
setenv DISPLAY :5

and do not have a problem with the jpeg() or png() devices.  I do have a 
problem with the rgl() package, but then I often do on-screen (on both 32- 
and even more so 64-bit FC3).

> Is there a better way of doing this? or how can I fix the problem.

You really should update your 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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] About Qusi-Monte carlo program

2005-10-12 Thread Prof Brian Ripley
I suspect you mean `Quasi-Monte Carlo', but that is used to do integration 
not simulation.

Using help.search led ne to

LowDiscrepancy(fOptions)
 Low Discrepancy Sequences
QUnif(sfsmisc)  Quasi Randum Numbers via Halton Sequences

both of which generate the integration points for Quasi-Monte Carlo.


On Wed, 12 Oct 2005, Zhao Yang wrote:

> Dear Listers;
>
> Does anybody has experience in doing simulation via Qusi-Monte carlo in 
> R or S-plus, if so, could you like to send a small copy of your program 
> to me, I appreciate and thanks in advance!!
>
> Frankly speaking, I am struggling to write this kind of program, while I 
> could not figure out, painful!
>
> Best regards,
> Tony

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

PLEASE do, and not send HTML mail as it asks.


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

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


Re: [R] Optim with two constraints

2005-10-12 Thread Prof Brian Ripley
This is actually quadratic programming, so why do you want to use optim()?
There are packages specifically for QP, e.g. quadprog.

A more general approach is to eliminate one variable, which gives you an 
inequality constrained problem in n-1 variables to which you could apply 
contrOptim().  Other re-parametrizations (e.g. of weights as a 
log-linear model) will work provided none of the parameters are going to 
be zero at the optimum (one cannot be one without all the others being 
zero).

On Wed, 12 Oct 2005, Jens Hainmueller wrote:

> Hi R-list,
>
> I am new to optimization in R and would appreciate help on the following
> question. I would like to minimize the following function using two
> constraints:
>
> ##
> fn <- function(par,H,F){
>
> fval <- 0.5 * t(par) %*% H %*% par + F%*% par
> fval
>
>  }
>
> # matrix H is (n by k)
> # matrix F is (n by 1)
> # par is a (n by 1) set of weights
>
> # I need two constraints:
> # 1. each element in par needs to be between 0 and 1
> # 2. sum(par)=1 i.e. the elements in par need to sum to 1
>
> ## I try to use optim
> res <- optim(c(runif(16),fn, method="L-BFGS-B", H=H, F=f
> ,control=list(fnscale=-1), lower=0, upper=1)
> ##
>
> If I understand this correctly, using L-BFGS-B with lower=0 and upper=1
> should take care of constraint 1 (box constraints). What I am lacking is the
> skill to include constraint no 2.
>
> I guess I could solve this by reparametrization but I am not sure how
> exactly. I could not find (i.e. wasn't able to infer) the answer to this in
> the archives despite the many comments on optim and constrained optimization
> (sorry if I missed it there). I am using version 2.1.1 under windows XP.
>
> Thank you very much.
>
> Jens
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

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