Re: [R] help with combination problem

2006-06-07 Thread David Hugh-Jones
hi Srinivas

I'm not sure I understand: your example result has 10-9 for mu1 but 1
for mu2, which is not equal to 11-9. I will assume you just got the
numbers wrong. (Also J100 should be J1, no?)

I am also wondering why you want what you say. It doesn't seem very
sensible to mix the results from two data frames like this.

The simplest thing is probably to do the two data frames separately,
then intermix the rows. You can do this with for loops:


for (col1 in paste("T", 1:14, sep="")) {
  for (col2 in paste("N", 1:16, sep="")) result[[paste(col1, "-",
col2, sep="")]] = df1[[col1]] - df1[[col2]]
}

Now repeat for data frame 2 with another data frame, e.g. result2
Then intermix the rows from result and result2. I'll leave you to
figure that bit out.

David



On 07/06/06, Srinivas Iyyer <[EMAIL PROTECTED]> wrote:
> hello:
>
> I have 3 data.frame objects.
>
> First df object:
> Of dim (149,31). Columns 2:31 are marked as T1..T14
> and N1..N16.
>
> Name T1T2N1   T3   N2  N3  N4  T4
> mu1  1010910   9   9   8   10
> mu2  1111911   9   9   9   11
> ...
> muN  1212911   9   9   8   12
>
>
>
>
> Second df object:
> of Dim (5,31). Columns 2:31 are maked as T1...T14
> and N1..N16.
>
> Name T1T2N1   T3   N2  N3  N4  T4
> J1   2 3 20   222  21  29   3
> J2   4 1 20   320  21  22   4
> J3   3 1 33   131  31  33   3
> ...
> JX   3 2 20   221  22  24   2
>
> The column samples are identical in both first and
> second data frames.
>
> Third df object:
> of Dim (200,2).
>
> V1 V2
> mu1:J1 -11
> mu1:J100   -10.4
> mu2:J31 11.3
> mu2:J2  10.4
> .   .
> muN:JX 34.5
>
>
>
> I want to create a combination of Ts and Ns. Where I
> want to subtract value of T-N in all combinations(225
> combinations). Such as
> T1-N1,T1-N2,T1-N3,T1-N4,T1-N5...T14-N16
>
> The rows should be the row pairs from 3rd dataframe.
>
>
> The final resultant matrix should look like the
> following:
>
>
>  T1-N1  T1-N2  T1-N3  T1-N4  T1-N5...T14-N16
> mu1   1(10-9) 1(10-9)   12  11
> J100  -18(2-20) -20   -19  -27-20  -29
>
> mu2 1 32 2  11
> J2 -19   -21 -39-31-31 -28
>
>
>
> I am a beginner level in R.  I apologise for asking
> such a big question and subsequent help. I am unable
> to go forward as I have no idea as to how to do this.
> Could any one please help me.
> Thanks
> sri
>
> __
> R-help@stat.math.ethz.ch 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] how to analyze the following data?--anxious for the result

2006-06-07 Thread Prof Brian Ripley
Asserting `y isn't noramal' only eliminates one possibility.  Is it 
binary, a count, long-tailed, short-tailed, ...?

This is really a statistical consulting problem (and apparently about 
SAS): see the R posting guide for where to seek advice on such problems.
As the guide says, had we had sufficient information we might have been 
able to help, but as you need to ask again, please do so in a more 
appropriate place.

On Thu, 8 Jun 2006, zhijie zhang wrote:

> Dear friends,
> I have a dataset: response var--y, class var-group, and the third variable-x.
> I want to test whether there is statistical significance bewteen
> group for y with the controlled x. First, i want to use analysis of
> covariance in SAS, but i found that y isn't noramal and can't become
> normal through transformation.
> Under that condition, what should i do using R / SAS?
> Any suggestions are great appreciate!
>

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

2006-06-07 Thread Prof Brian Ripley
In non-parametric bootstrapping, you do draw a sample of the same size as 
the original.  So



D <- as.vector(WorldPhones[,1])
sample(D, replace=TRUE)

[1] 45939 64721 60423 79831 71799 45939 76036

sample(D, replace=TRUE)

[1] 45939 68484 79831 68484 76036 71799 79831

are two different bootstrap resamples.  The problem in the original code 
is that it is trying to replace 1 value by a sample.  Removing extraneous 
bracketing, it was



boot = numeric(200)
for (i in 1:200) boot [i] = sample(D,replace=T)

There were 50 or more warnings (use warnings() to see the first 50)

and those warnings are


warnings()

Warning messages:
1: number of items to replace is not a multiple of replacement length

*and* the values returned are not all the same (as claimed).

To return a set of bootstrap resamples you need something like

boot <- matrix(0,200,length(D))
for (i in 1:200) boot [i,] <- sample(D, replace=TRUE)

or you might intend to save the resampled statistic and not the sample 
itself.



On Wed, 7 Jun 2006, Clément Viel wrote:


2006/6/7, Recep Aykaya <[EMAIL PROTECTED]>:


hi.
i'm a statistics student and studying bootstrap in R.

i'm trying to draw bootstrap samples from a sample, using the following R
code:


*boot = numeric(200)*

*> {for (i in 1:200)*

*  boot [i] = (sample(data,replace=T))}*



i obtain 200 samples but all of them are the same.

i want to obtain different samples. what should i do? can you please help
me
if possible.



thank you.

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



Hi,
I think you have forgotten an parameter of the sample function. Indeed the
help page give these information:

sample(x, size, replace = FALSE, prob = NULL)

size: non-negative integer giving the number of items to choose

By default 'size' is equal to 'length(x)' so that 'sample(x)'
generates a random permutation of the elements of 'x' (or '1:x').

Therefore try to add the number of observed values with this:

nb=100  #the number of  values for each sample
boot = c()
for (i in 1:200)
  boot [i] = mean(sample(x=data,size=nb,replace=TRUE)) # if you try to
estimate the mean





--
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] how to analyze the following data?--anxious for the result

2006-06-07 Thread zhijie zhang
Dear friends,
 I have a dataset: response var--y, class var-group, and the third variable-x.
 I want to test whether there is statistical significance bewteen
group for y with the controlled x. First, i want to use analysis of
covariance in SAS, but i found that y isn't noramal and can't become
normal through transformation.
 Under that condition, what should i do using R / SAS?
 Any suggestions are great appreciate!
-- 
Kind Regards,Zhi Jie,Zhang ,PHDDepartment of EpidemiologySchool of
Public HealthFudan UniversityTel:86-21-54237149

__
R-help@stat.math.ethz.ch 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] [OFF] The "best" tool for a space-temporal analyses?

2006-06-07 Thread Spencer Graves
  Have you tried RSiteSearch("spatial ecology")?  I just got 47 hits 
from that.  Some of them might be relevant to your question.

  If that fails, you might consider providing this group with the math 
behind the automata models you are considering.  I might expect them to 
be expressed in terms of Markov chain (or Markov random field) 
probability models with parameters to be estimated.  The standard 
statistical approach is to consider a sequence of different models, with 
at least some of them nested, with increasing numbers of parameters and 
levels of complexity.  We then estimate the parameters to maximize the 
likelihood (= probability of what was observed given the data).  Testing 
typically assumes that 2*log(likelihood ratio) is approximately 
chi-square, with additional precision given by simulation if desired.

  Hope this helps.
  Spencer Graves

Ronaldo Reis-Jr. wrote:
> Hi,
> 
> I try to make an analyses to discover what is the time that an area begin to 
> have spacial autocorrelation. And after, what is the number of individuals 
> responsible for this autocorrelation.
> 
> The main idea is to discover if exist a contamination of a quadrat from 
> others 
> quadrats and how is the population needed to make this contamination.
> 
> This is very common to use automata to simulate this situation. But I try to 
> make a more statistical approach. I'm studing about, but I dont know the tool 
> for testing examples.
> 
> I make an example just for tests:
> 
> Geodata <- data.frame(X=rep(rep(c(1:10),
> (rep(10,10))),5),Y=rep(c(1:10),50),Abund=c(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 
> 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 
> 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 3, 0, 0, 2, 0, 0, 1, 2, 0, 0, 
> 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 2, 0, 0, 
> 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 5, 
> 0, 2, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 2, 3, 0, 0, 3, 0, 0, 3, 
> 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 4, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 10, 0, 0, 3, 0, 0, 0, 0, 3, 
> 3, 4, 2, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 3, 0, 
> 0, 0, 0, 4, 0, 2, 1, 0, 0, 3, 0, 0, 0, 2, 0, 1, 4, 0, 0, 4, 0, 0, 4, 0, 0, 0, 
> 0, 0, 4, 0, 0, 0, 0, 0, 3, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 4, 10, 15, 0, 0, 4, 0, 0, 0, 0, 8, 11, 9, 0, 
> 0, 0, 0, 0, 0, 0, 1, 5, 3, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 4, 0, 0, 0, 0, 
> 5, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 1, 0, 5, 0, 0, 5, 0, 0, 5, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 4, 0, 0, 6, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 3, 10, 15, 20, 0, 0, 0, 0, 0, 0, 4, 13, 16, 13, 0, 0, 0, 
> 0, 0, 0, 5, 8, 8, 10, 0, 0, 0, 0, 0, 0, 1, 2, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> 0),Time=rep(c(1:5),rep(100,5)))
> 
> X and Y are coordinates, Abund is the number of individuals and Time is the 
> date of observation. In this example the population grows from an vertice, 
> and after 10 individuals it contaminates your neighbors. I need ideas about 
> the best approach and R's tools for this problem.
> 
> I'm studing this question in these books:
> 
> W.N. Venables, B.D. Ripley. 2003.  Modern Applied Statistics with S. 
> Springer; 
> 4 edition (September 2, 2003). 512 pages.
> 
> Crawley, M. J. 2002. Statistical Computing: An Introduction to Data Analysis 
> using S-Plus. John Wiley & Sons; 1st edition (May 15, 2002). 772 pages.
> 
> Diggle, Peter J. 2003. Statistical Analysis of Spatial Point Patterns (2nd 
> ed.), Arnold, London.
> 
> Ripley, B.D. Spatial Statistics
> 
> Spatial Ecology
> 
> Thanks for all
>

__
R-help@stat.math.ethz.ch 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 do this simple integration?

2006-06-07 Thread Jianing Di
Hello,

I have a simple function in the form as follows:

> f<-function(x){sum(v^x)}

where v is a vector. I was trying to integrate f using the command

> I<-integrate(f,0,1)

However, this will not work and seems that the reason is to use
"integrate", the f must be a function that with input and output of same
length. Anyone can point out which command should I use in order to
compute this type of integration(such as a function involve sum(), prod(),
etc.)?

Thank you.

Jianing


-- 
There are three kinds of lies: lies, damned lies, and Statistics.

---Benjamin Disraeli

__
R-help@stat.math.ethz.ch 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] simplier way to import txt time-series data

2006-06-07 Thread Gabor Grothendieck
Try this which reads in the data as a data frame and appends a
chron variable datetime:

Lines <- " MM DD HH  data1  data2
2002 12 01 01 0.002 0.003"

DF <- read.table(textConnection(Lines), header = TRUE)
library(chron)
DF$datetime <- with(DF, chron(paste(MM, DD, , sep = "/")) + HH/24)
DF

On 6/7/06, Jan Schwanbeck <[EMAIL PROTECTED]> wrote:
> Hello much more experienced R-users,
>
> I have got a txt - file which contains data formated like this:
>
>  MM DD HH  data1  data2 ... data31
> 2002 12 01 01 0.002 0.003 ... 312.0
>
> The single columns are divided by at least one space.
>
> Is their an easy and fast way to make R understand that the first 4
> columns are year month day and hour  to recognize it as time series data.
>
> The time series are not complete. Single hours could be missing.
>
> Thanks a lot for answering my question. I just cannot believe that it is
> a big problem for R to handle this clean format while it even imports
> data from excel-files.
>
> Greatings
>
> 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
>

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

2006-06-07 Thread Clément Viel
2006/6/7, Recep Aykaya <[EMAIL PROTECTED]>:
>
> hi.
> i'm a statistics student and studying bootstrap in R.
>
> i'm trying to draw bootstrap samples from a sample, using the following R
> code:
>
> > *boot = numeric(200)*
> *> {for (i in 1:200)*
>
> *  boot [i] = (sample(data,replace=T))}*
>
>
>
> i obtain 200 samples but all of them are the same.
>
> i want to obtain different samples. what should i do? can you please help
> me
> if possible.
>
>
>
> thank you.
>
> [[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
>

Hi,
I think you have forgotten an parameter of the sample function. Indeed the
help page give these information:

sample(x, size, replace = FALSE, prob = NULL)

size: non-negative integer giving the number of items to choose

By default 'size' is equal to 'length(x)' so that 'sample(x)'
generates a random permutation of the elements of 'x' (or '1:x').

Therefore try to add the number of observed values with this:

nb=100  #the number of  values for each sample
boot = c()
for (i in 1:200)
   boot [i] = mean(sample(x=data,size=nb,replace=TRUE)) # if you try to
estimate the mean


-- 
Clément Viel
Student in Polytech-Lille's engineering school
http://www.polytech-lille.fr

[[alternative HTML version deleted]]

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

Re: [R] R crashes on quantreg

2006-06-07 Thread roger koenker
R-help doesn't  foward attached data files like this, but Brian
kindly forwarded it to me.

You need to restrict X so that it is full rank,  it now has
rank 19 and column dimension 29 (with intercept).  See
for example svd(cbind(1,x)).

I'll add some better checking for this, but it will basically amount
to setting singular.ok = FALSE in lm() and forcings users to do
the rank reduction themselves.


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820


On Jun 7, 2006, at 3:05 PM, Mu Tian wrote:

> I attached the data file here. I restarted the PC but it still  
> happens. It
> says a memory address could not be written. I am not sure it is a  
> problem of
> R or quantreg but I plot without problems before I load quantreg.
>
> Thank you.
>
> Tian
>
> On 6/7/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
>>
>> Without y and x we cannot reproduce this.
>>
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>> On Wed, 7 Jun 2006, Mu Tian wrote:
>>
>> > I forgot to mention my R version is 2.3.1 and quantreg is the most
>> updated
>> > too.
>>
>> It has a version number, which the posting guide tells you how to  
>> find.
>>
>> > On 6/7/06, Mu Tian <[EMAIL PROTECTED]> wrote:
>> >>
>> >>  I was trying "quantreg" package,
>> >>
>> >> lm1 <- lm(y~x)
>> >> rq1 <- rq(y~x)
>> >> plot(summary(rq1)) #then got a warning says singular value,  
>> etc. but
>> this
>> >> line can be omited
>> >> plot(lm1) #crash here
>> >>
>> >> It happened every time on my PC, Windows XP Pro Serv. Pack 1,
>> Pentium(4)
>> >> 3.00G.
>> >>
>> >
>> >   [[alternative HTML version deleted]]
>>
>>
>>
>> --
>> Brian D. Ripley,  [EMAIL PROTECTED]
>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford, Tel:  +44 1865 272861 (self)
>> 1 South Parks Road, +44 1865 272866 (PA)
>> Oxford OX1 3TG, UKFax:  +44 1865 272595
>>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting- 
> guide.html

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


[R] bootstrapping

2006-06-07 Thread Recep Aykaya
hi.
i'm a statistics student and studying bootstrap in R.

i'm trying to draw bootstrap samples from a sample, using the following R
code:

> *boot = numeric(200)*
*> {for (i in 1:200)*

*  boot [i] = (sample(data,replace=T))}*



i obtain 200 samples but all of them are the same.

i want to obtain different samples. what should i do? can you please help me
if possible.



thank you.

[[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] Using data=x or subset=y in user-defined functions

2006-06-07 Thread Prof Brian Ripley
I suggest you investigate with().

On Wed, 7 Jun 2006, Manuel Morales wrote:

> Dear list members,
>
> In some of my functions, I attach the data internally to allow subset
> commands or to specify a data frame. This works well except for cases
> where there is a "masking" conflict (which returns a warning). I see
> some alternative listed in ?attach, but I'm not sure which of them do
> what I'd like. Any suggestions?
>
> Below is how I've been setting up my functions:
>
> eg.function <- function(x, data=NULL, subset=NULL, ...) {
>
> # Set up environment
> on.exit(detach(data))
> attach(data)
> if(!is.null(subset)) {
>data<-subset(data,subset)
> detach(data)
> attach(data)
> }
> subset = NULL
>
> # Function body here
> output <- x
> return(output)
> }
>
> Thanks!
>
> Manuel
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
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] R crashes on quantreg

2006-06-07 Thread Prof Brian Ripley
On Wed, 7 Jun 2006, roger koenker wrote:

> Since the "crash" occurs plotting the lm object it is unclear what
> this has to do with quantreg, but maybe you could explain
>
>   1.  what you mean by crash,
>   2.  something about x,y,
>
> This is best addressed to the maintainer of the package rather than to
> R-help, provided, of course, that it is really a question about
> quantreg.

Agreed, but just so R-help knows how to solve such problems, I ran this 
under valgrind (see `Writing R Extensions') and got

> rq1 <- rq(y~x)
==7870== Invalid write of size 8
==7870==at 0x9ED8BDE: rqbr_ (rqbr.f:309)
...
==7870==  Address 0x92162A0 is 12,248 bytes inside a block of size 12,288 free'd
==7870==at 0x49055DD: free (vg_replace_malloc.c:235)
==7870==by 0x53D64A: build_trtable (regex.c:9618)
==7870==by 0x53AEB4: transit_state (regex.c:8393)
==7870==by 0x538977: check_matching (regex.c:7318)
==7870==by 0x537E89: re_search_internal (regex.c:7007)
==7870==by 0x53EF3D: Rregexec (regex.c:10440)
==7870==by 0x438AAF: do_gsub (character.c:1127)

and it seems object lm1 has been trashed and you soon get a segfault.

-- 
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] Using data=x or subset=y in user-defined functions

2006-06-07 Thread Manuel Morales
Dear list members,

In some of my functions, I attach the data internally to allow subset
commands or to specify a data frame. This works well except for cases
where there is a "masking" conflict (which returns a warning). I see
some alternative listed in ?attach, but I'm not sure which of them do
what I'd like. Any suggestions?

Below is how I've been setting up my functions:

eg.function <- function(x, data=NULL, subset=NULL, ...) {

# Set up environment
on.exit(detach(data))
attach(data)
if(!is.null(subset)) {
data<-subset(data,subset)
detach(data)
attach(data)
}
subset = NULL
 
# Function body here
output <- x   
return(output)
}

Thanks!

Manuel

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


Re: [R] R crashes on quantreg

2006-06-07 Thread Mu Tian

I attached the data file here. I restarted the PC but it still happens. It
says a memory address could not be written. I am not sure it is a problem of
R or quantreg but I plot without problems before I load quantreg.

Thank you.

Tian

On 6/7/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:


Without y and x we cannot reproduce this.

PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

On Wed, 7 Jun 2006, Mu Tian wrote:

> I forgot to mention my R version is 2.3.1 and quantreg is the most
updated
> too.

It has a version number, which the posting guide tells you how to find.

> On 6/7/06, Mu Tian <[EMAIL PROTECTED]> wrote:
>>
>>  I was trying "quantreg" package,
>>
>> lm1 <- lm(y~x)
>> rq1 <- rq(y~x)
>> plot(summary(rq1)) #then got a warning says singular value, etc. but
this
>> line can be omited
>> plot(lm1) #crash here
>>
>> It happened every time on my PC, Windows XP Pro Serv. Pack 1,
Pentium(4)
>> 3.00G.
>>
>
>   [[alternative HTML version deleted]]



--
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] R crashes on quantreg

2006-06-07 Thread Prof Brian Ripley
Without y and x we cannot reproduce this.

PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

On Wed, 7 Jun 2006, Mu Tian wrote:

> I forgot to mention my R version is 2.3.1 and quantreg is the most updated
> too.

It has a version number, which the posting guide tells you how to find.

> On 6/7/06, Mu Tian <[EMAIL PROTECTED]> wrote:
>>
>>  I was trying "quantreg" package,
>>
>> lm1 <- lm(y~x)
>> rq1 <- rq(y~x)
>> plot(summary(rq1)) #then got a warning says singular value, etc. but this
>> line can be omited
>> plot(lm1) #crash here
>>
>> It happened every time on my PC, Windows XP Pro Serv. Pack 1, Pentium(4)
>> 3.00G.
>>
>
>   [[alternative HTML version deleted]]



-- 
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] R crashes on quantreg

2006-06-07 Thread roger koenker
Since the "crash" occurs plotting the lm object it is unclear what
this has to do with quantreg, but maybe you could explain

1.  what you mean by crash,
2.  something about x,y,

This is best addressed to the maintainer of the package rather than to
R-help, provided, of course, that it is really a question about  
quantreg.

url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820


On Jun 7, 2006, at 2:32 PM, Mu Tian wrote:

> I was trying "quantreg" package,
>
> lm1 <- lm(y~x)
> rq1 <- rq(y~x)
> plot(summary(rq1)) #then got a warning says singular value, etc.  
> but this
> line can be omited
> plot(lm1) #crash here
>
> It happened every time on my PC, Windows XP Pro Serv. Pack 1,  
> Pentium(4)
> 3.00G.
>
>   [[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] R crashes on quantreg

2006-06-07 Thread Mu Tian
I forgot to mention my R version is 2.3.1 and quantreg is the most updated
too.

On 6/7/06, Mu Tian <[EMAIL PROTECTED]> wrote:
>
>  I was trying "quantreg" package,
>
> lm1 <- lm(y~x)
> rq1 <- rq(y~x)
> plot(summary(rq1)) #then got a warning says singular value, etc. but this
> line can be omited
> plot(lm1) #crash here
>
> It happened every time on my PC, Windows XP Pro Serv. Pack 1, Pentium(4)
> 3.00G.
>

[[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] R crashes on quantreg

2006-06-07 Thread Mu Tian
I was trying "quantreg" package,

lm1 <- lm(y~x)
rq1 <- rq(y~x)
plot(summary(rq1)) #then got a warning says singular value, etc. but this
line can be omited
plot(lm1) #crash here

It happened every time on my PC, Windows XP Pro Serv. Pack 1, Pentium(4)
3.00G.

[[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] simplier way to import txt time-series data

2006-06-07 Thread Jan Schwanbeck
Hello much more experienced R-users,

I have got a txt - file which contains data formated like this:

 MM DD HH  data1  data2 ... data31
2002 12 01 01 0.002 0.003 ... 312.0

The single columns are divided by at least one space.

Is their an easy and fast way to make R understand that the first 4 
columns are year month day and hour  to recognize it as time series data.

The time series are not complete. Single hours could be missing.

Thanks a lot for answering my question. I just cannot believe that it is 
a big problem for R to handle this clean format while it even imports 
data from excel-files.

Greatings

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] bootstrap data from groups

2006-06-07 Thread Ulrich Keller
I am not sure I understand what you want to do, but maybe some of this 
will be helpful. I first generate some data that should resemble yours:

dat<-expand.grid(Region=1:3, Species=1:4, Sex=c("M","F"))
dat<-do.call("rbind",lapply(1:10,function(x) dat))
dat$Bodysize<-rnorm(nrow(dat),10,2)

Now what the following piece of code does is this: it samples 4 of the 
10 individuals in each of the 24 subsets (region*species*sex) and 
creates a new data frame with 96 cases. It then computes the mean of 
bodysize in each of the subsets. The whole thing is done 100 times, the 
results are put in a data frame. We end up with 100 bootstrapped means 
for the 24 subsets.

groupmeans<-sapply(1:100, function(z) {
  dat.rs<-do.call("rbind",
lapply(split(dat,list(dat$Region,dat$Species,dat$Sex)),
  function(x) x[sample(10, 4, replace=TRUE),]))
  aggregate(dat.rs$Bodysize,
list(dat.rs$Region,dat.rs$Species,dat.rs$Sex),
mean)$x
  }
)
tmp<-aggregate(dat$Bodysize,
  list(dat$Region,dat$Species,dat$Sex),mean)
rownames(groupmeans)<-apply(tmp[,1:3],1,paste,collapse="")

Now we can compute the mean and sd of the means by group:

 > apply(groupmeans,1,mean)
  11M   21M   31M   12M   22M   32M   
13M   23M
 9.353095  9.267570  9.907933 10.992796  9.575841 10.412816  9.646964  
9.433724
  33M   14M   24M   34M   11F   21F   
31F   12F
10.750797  9.083630 10.573421  9.615743 10.267587 10.231126  9.329375 
10.799071
  22F   32F   13F   23F   33F   14F   
24F   34F
 9.355510 10.555705  9.919161 10.277103  9.335649  9.339544 10.023688  
9.755115
 > apply(groupmeans,1,sd)
  11M   21M   31M   12M   22M   32M   
13M   23M
0.7720758 1.5301540 1.0973516 0.8970237 1.0492995 0.9460970 0.5362957 
1.1106675
  33M   14M   24M   34M   11F   21F   
31F   12F
0.5333081 0.9259341 0.8198624 0.8061832 0.8466780 0.7052473 0.9857680 
1.1057607
  22F   32F   13F   23F   33F   14F   
24F   34F
0.8272433 1.2614559 1.2377154 1.0958545 0.9213648 0.9985215 1.1131870 
1.0572494

Milton Cezar schrieb:
> Hi R-friends.
>
>   I have a mammalŽs dataset looking like:
>
>Region   Species Sex  Bodysize
>  1   Sp1  M  10.2
>  1   Sp1  M  12.1
>  1   Sp1  M   9.1
> ...
>
>   I have three regions, four species and the body size of 10 individual. IŽd 
> like to do a bootstrap resample (100 resamples) of 4 of 10 individuals for 
> each Region, Species and Sex and compute de means and S.D. for the 
> combinations Regions-Species-Sex.
>
>   How can I do that?
>
>   Thanks a lot,
>
>   Miltinho
>
>  __
>
>
>   [[alternative HTML version deleted]]
>
>   
> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch 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] decideTests extraction of p-values

2006-06-07 Thread Vijay A Raghavan
Hello all,
 
 Here is the code that I am using for finding differentially expressed genes.
 
 #Normalization
 
 library(affy)
 library(Biobase)
 library(limma)
 library(gcrma)
 
 pd<-read.phenoData("file.txt",header=TRUE,row.names=1,as.is=TRUE,sep="\t")
 Data <- ReadAffy(filenames=pData(pd)$FileName,phenoData=pd)
 print(Data)

 eset <- gcrma(Data)
 write.exprs(eset, file="decide-test.6-6-06.txt")
 
 #Linear Model

 pData(eset)
 targets<-pData(eset)
 model.matrix(~ -1 +factor(targets$Target,levels=unique(targets$Target)))
 design <- model.matrix(~ -1 +
 factor(targets$Target,levels=unique(targets$Target)))
 unique(targets$Target)
 colnames(design) <- unique(targets$Target)
 ncol(design)
 numParameters <- ncol(design)
 colnames(design)
 parameterNames <- colnames(design)
 design
 fit <- lmFit(eset,design=design)
 names(fit)

 contrastNames <-c(paste(parameterNames[2],parameterNames[1],sep="-"),
 paste(parameterNames[3],parameterNames[1],sep="-"),
 paste(parameterNames[4],parameterNames[1],sep="-"),
 paste(parameterNames[5],parameterNames[1],sep="-"),
 paste(parameterNames[6],parameterNames[1],sep="-"),
 paste(parameterNames[7],parameterNames[1],sep="-"))
 
 contrastsMatrix <- matrix(c(
 -1,1,0,0,0,0,0,
 -1,0,1,0,0,0,0,
 -1,0,0,1,0,0,0,
 -1,0,0,0,1,0,0,
 -1,0,0,0,0,1,0,
 -1,0,0,0,0,0,1),nrow=ncol(design))
 rownames(contrastsMatrix) <- parameterNames
 colnames(contrastsMatrix) <- contrastNames
 contrastsMatrix

 fit2  <- contrasts.fit(fit,contrasts=contrastsMatrix)
 names(fit2)
 
 #ebayes
 
 fit2 <- eBayes(fit2)
 names(fit2)
 numGenes <- nrow([EMAIL PROTECTED])
 
 #decideTest
 
 results <- decideTests(fit2,method="nestedF",p=0.05);
 write.fit(fit2, results, "data.txt", adjust="BH");
 
 
 Is there any way for getting the adjusted p-values from the decideTests method 
?
 
 Thanks,
 
 Vijay
 
[[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] Edit function

2006-06-07 Thread François Pinard
[Pikounis, Bill [CNTUS]]

> view <- function(x) {
>   warnopt <- options()$warn
>   options(warn=-1)
>   on.exit({sink(); options(warn=warnopt)})
>   edit(x)
>   invisible()
> }

I'm surprised by the necessity of "sink()".  Presuming it is necessary 
indeed, the above could be simplified a bit like this (untested) code:

  view <- function(x) {
on.exit(sink())
invisible(suppressWarnings(edit(x)))
  }

The documentation for "suppressWarnings" is not overly clear about if 
the "warn" option is restored or not in case of error.  It says:

 'suppressWarnings' evaluates its expression in a context that
 ignores all warnings.

My exegesis :-) for that sentence would be that the context does not 
survive the error, and so, the "warn" option is not changed.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

__
R-help@stat.math.ethz.ch 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 read hdf files under R?

2006-06-07 Thread antonio rodriguez
Nicolas Degallier wrote:
> Hi!
> 
> I am trying to install in my R environment the rhdf5 package and  
> library but it seems to have vanished from either the CRAN or  
> BioConductors sites.
> 
> Can you tell me where it would be possible to find it or any R  
> library (or function) able to read hdf files?

hf5 it is supposed to do this, but I haven't any success trying to open 
an .hdf (V5) file (i.e: pathfinderv5 sst data) I always get some data 
format problem message. So I use to search for a netcdf format for the 
data I want and input into R with the netCDF library (old but useful)

BR,

arv


> 
> Sincerely,
> 
> Nicolas Degallier
> 
> UMR 7159 / IRD UR182
> Laboratoire d'Océanographie et du Climat, Expérimentation et  
> Approches Numériques (LOCEAN)
> Tour 45-55, 4e ét., case 100, 4 place Jussieu
> 75252  Paris Cedex 5  France
> 
> tél: (33) 01 44 27 51 57
> fax: (33) 01 44 27 38 05
> E-mail: <[EMAIL PROTECTED]>
> 
> Publications (anonymous ftp):
> 
> ftp://ftp.lodyc.jussieu.fr/LOCEAN/ndelod
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 


-- 
=
Por favor, si me mandas correos con copia a varias personas,
pon mi dirección de correo en copia oculta (CCO), para evitar
que acabe en montones de sitios, eliminando mi privacidad,
favoreciendo la propagación de virus y la proliferación del SPAM. Gracias.
-
If you send me e-mail which has also been sent to several other people,
kindly mark my address as blind-carbon-copy (or BCC), to avoid its
distribution, which affects my privacy, increases the likelihood of
spreading viruses, and leads to more SPAM. Thanks.
=

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


[R] help with combination problem

2006-06-07 Thread Srinivas Iyyer
hello:

I have 3 data.frame objects.

First df object:
Of dim (149,31). Columns 2:31 are marked as T1..T14 
and N1..N16.

Name T1T2N1   T3   N2  N3  N4  T4
mu1  1010910   9   9   8   10
mu2  1111911   9   9   9   11
...
muN  1212911   9   9   8   12




Second df object:
of Dim (5,31). Columns 2:31 are maked as T1...T14
and N1..N16.

Name T1T2N1   T3   N2  N3  N4  T4
J1   2 3 20   222  21  29   3
J2   4 1 20   320  21  22   4
J3   3 1 33   131  31  33   3
...
JX   3 2 20   221  22  24   2

The column samples are identical in both first and
second data frames. 

Third df object:
of Dim (200,2).  

V1 V2
mu1:J1 -11
mu1:J100   -10.4
mu2:J31 11.3
mu2:J2  10.4
.   .
muN:JX 34.5



I want to create a combination of Ts and Ns. Where I
want to subtract value of T-N in all combinations(225
combinations). Such as
T1-N1,T1-N2,T1-N3,T1-N4,T1-N5...T14-N16

The rows should be the row pairs from 3rd dataframe. 


The final resultant matrix should look like the
following:


  T1-N1  T1-N2  T1-N3  T1-N4  T1-N5...T14-N16
mu1   1(10-9) 1(10-9)   12  11
J100  -18(2-20) -20   -19  -27-20  -29

mu2 1 32 2  11 
J2 -19   -21 -39-31-31 -28



I am a beginner level in R.  I apologise for asking
such a big question and subsequent help. I am unable
to go forward as I have no idea as to how to do this.
Could any one please help me. 
Thanks
sri

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

2006-06-07 Thread Pedro Ramirez
>Not a direct answer to your question, but if you use a logspline density
>estimate rather than a kernal density estimate then the logspline
>package will help you and it has built in functions for dlogspline,
>qlogspline, and plogspline that do the integrals for you.
>
>If you want to stick with the KDE, then you could find the area under
>each of the kernals for the range you are interested in (need to work
>out the standard deviation used from the bandwidth, then use pnorm for
>the default gaussian kernal), then just sum the individual areas.
>
>Hope this helps,

Thanks a lot for your quick help! I think I will follow your first 
suggestion (logspline
density estimation) instead of summing over the kernel areas because at the
boundaries of the range truncated kernel areas can occur, so I think it is
easier to do it with logsplines. Thanks again for your help!!

Pedro



>
>--
>Gregory (Greg) L. Snow Ph.D.
>Statistical Data Center
>Intermountain Healthcare
>[EMAIL PROTECTED]
>(801) 408-8111
>
>
>-Original Message-
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of Pedro Ramirez
>Sent: Wednesday, June 07, 2006 11:00 AM
>To: r-help@stat.math.ethz.ch
>Subject: [R] Density Estimation
>
>Dear R-list,
>
>I have made a simple kernel density estimation by
>
>x <- c(2,1,3,2,3,0,4,5,10,11,12,11,10)
>kde <- density(x,n=100)
>
>Now I would like to know the estimated probability that a new
>observation falls into the interval 0
>How can I integrate over the corresponding interval?
>In several R-packages for kernel density estimation I did not found a
>corresponding function. I could apply Simpson's Rule for integrating,
>but perhaps somebody knows a better solution.
>
>Thanks a lot for help!
>
>Pedro
>
>_
>
>__
>R-help@stat.math.ethz.ch 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] Density Estimation

2006-06-07 Thread Rolf Turner

Pedro wrote:

> I have made a simple kernel density estimation by
> 
> x <- c(2,1,3,2,3,0,4,5,10,11,12,11,10)
> kde <- density(x,n=100)
> 
> Now I would like to know the estimated probability that a
> new observation falls into the interval 0 
> How can I integrate over the corresponding interval?
> In several R-packages for kernel density estimation I did
> not found a corresponding function. I could apply
> Simpson's Rule for integrating, but perhaps somebody
> knows a better solution.

One possibility is to use splinefun():

> spiffy <- splinefun(kde$x,kde$y)
> integrate(spiffy,0,3)
0.2353400 with absolute error < 2e-09

cheers,

Rolf Turner
[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] use of R in big companies (references) & R-support esp in Germany

2006-06-07 Thread Thomas Adams
Spencer,

I agree that there exist biases within large organizations toward 
commercial software packages, but I humbly disagree that this can be 
reduced to geopolitical differences. I work for a US Government Agency 
and while there is some truth to the feeling "[they] refuse to believe 
that anything free can be any good", it has little-to-nothing to do with 
Capitalism vs whatever… I think the feeling has to do more with the 
*perceived* issues related to support and what is "tried & true" — it's 
a very conservative approach, one that I face on nearly a daily basis. 
Apart from my use of R, I am also a heavy user of the open source 
Geographic Information System (GIS) called GRASS, in which the 
*dominant* GIS company internationally is ESRI and their very expensive 
software called ArcGIS. There is very little that ArcGIS can do that 
GRASS can not do. What is especially troublesome is that ArcGIS is 
restricted to the MS-Windows platform, whereas GRASS runs on Linux, 
MacOS X, UNIX, and MS-Windows with Cygwin.

Thank you for your references as I hope to use them.

Regards,
Tom



Spencer Graves wrote:
> The best rebuttal I've heard recently to arguments like that is Linux 
> (www.linux.org):  It's distributed under the same general public license 
> (GNU) license as R.
>
> A perspective that I don't recall having seen on this list is that 
> the cost of producing and distributing software has become too cheap to 
> meter, unless you want to charge for it.  Open source projects like 
> Linux and R (and Mozilla, Subversion, and others) were much more 
> difficult and less common before the Internet, just because the costs of 
> coordinating development plus producing and distributing the product 
> made such efforts much more difficult.  For a discussion of these 
> phenomena by two Economics professors at UC-Berkeley, see Shapiro and 
> Varian (1998) Information Rules (Harvard Business School Pr.).  A newer, 
> similar title by these same authors is "The Economics of Information 
> Technology";  I haven't read this newer book, but it looks like it could 
> be relevant also.
>
> I mention this, because I suspect some of the opposition to open 
> source, "free" software is ideology:  Rabid capitalists refuse to 
> believe that anything free can be any good.  (We could talk about air 
> and water, but that might be a digression.)  Books like this backed by 
> solid research might help counter such opposition.
>
> Hope this helps.
> Spencer Graves
>
> Armin Roehrl wrote:
>   
>> Dear R users,
>>
>> sorry for this general email and I am sure it has been asked
>> way too many times.
>>
>> IT departements in big companies only want to support the big
>> standards. Whatever big standards means apart from being expensive.
>>
>> We are in the process of trying to get a risk management project
>> for a big conservative company in Germany. As part of the project
>> we would use R to run simulations, but the company is afraid of R.
>>
>> 1) If anybody has any reference projects using R I can quote, please
>> drop me an email. Best would be companies like Siemens, Allianz,
>> Munich Re, Daimler Chrysler, Credit Suisse etc.
>>
>> 2) Are there any software companies around with R know-how and are
>> interested in paid R-projects? The bigger the company, the better
>> as this client seems to be scared of software companies with less
>> than 200 developers.
>>
>>
>> Thanks,
>>   -Armin
>>
>> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>   


-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:  [EMAIL PROTECTED]

VOICE:  937-383-0528
FAX:937-383-0033

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

2006-06-07 Thread Greg Snow
Not a direct answer to your question, but if you use a logspline density
estimate rather than a kernal density estimate then the logspline
package will help you and it has built in functions for dlogspline,
qlogspline, and plogspline that do the integrals for you.

If you want to stick with the KDE, then you could find the area under
each of the kernals for the range you are interested in (need to work
out the standard deviation used from the bandwidth, then use pnorm for
the default gaussian kernal), then just sum the individual areas. 

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pedro Ramirez
Sent: Wednesday, June 07, 2006 11:00 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Density Estimation

Dear R-list,

I have made a simple kernel density estimation by

x <- c(2,1,3,2,3,0,4,5,10,11,12,11,10)
kde <- density(x,n=100)

Now I would like to know the estimated probability that a new
observation falls into the interval 0https://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] Density Estimation

2006-06-07 Thread Pedro Ramirez
Dear R-list,

I have made a simple kernel density estimation by

x <- c(2,1,3,2,3,0,4,5,10,11,12,11,10)
kde <- density(x,n=100)

Now I would like to know the estimated probability that a
new observation falls into the interval 0https://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 do multiple comparison in the nonparametric statis tical analysis?

2006-06-07 Thread Barker, Chris [SCIUS]


Also Consider Bonferroni Hochberg Holm type procedures or .

Dunn OJ. Multiple contrasts using rank sum tests. Technometrics
1964;6:241#/52.

[[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 do multiple comparison in the nonparametric statistical analysis?

2006-06-07 Thread Marc Schwartz (via MN)
On Thu, 2006-06-08 at 00:10 +0800, zhijie zhang wrote:
> Dear Rusers,
>  As we all know , there are many methods to do multiple comparison in the
> parametric statistical analysis, But i can't find some in nonparametric
> statistical analysis.
>  Could anybody give some suggestions?

Have you looked at the "npmc" package on CRAN?

As a text reference, there is also:

Multiple Comparisons: Theory and methods
by Jason C. Hsu
Chapman & Hall 1996

More information here:

  http://www.stat.ohio-state.edu/~jch/mc.html

Amazon.com link:

  http://www.amazon.com/gp/product/0412982811

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] Fw: Help needed using lattice for area plots lpolygon, xyplot.

2006-06-07 Thread toby_marks
Perfect.  Thank-you!



"Deepayan Sarkar" <[EMAIL PROTECTED]> 
06/07/2006 11:19 AM





To
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
cc
r-help@stat.math.ethz.ch
Subject
Re: [R] Fw: Help needed using lattice for area plots lpolygon, xyplot.






On 6/7/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I am trying to learn how to use the graphics from the lattice package (
> and am very new to R).
>
> I am trying to replicate the example plot referenced below, by using the
> lattice xyplot & lpolygon to create panels.  I get what appears to be 
the
> correct shape of the filled region, but cannot get the position to 
overlay
> properly.  I have attempted with various settings of position.  ( i.e.
> position = c(0,0,1,1)  etc settings as well.   I am not understanding
> something about the positioning panels.  I am missing some subtle
> difference between polygon & lpolygon, or am missing something about 
panel
> overlays &/or panel postions.
>
> #http://addictedtor.free.fr/graphiques/graphcode.php?graph=7.
> par(bg="white")
> n <- 100
> set.seed(43214) #just so we have the same exact graph
> x <- c(0,cumsum(rnorm(n)))
> y <- c(0,cumsum(rnorm(n)))
> xx <- c(0:n, n:0)
> yy <- c(x, rev(y))
> plot(xx, yy, type="n", xlab="Time", ylab="Distance")
> polygon(xx, yy, col="gray")
> title("Distance Between Brownian Motions")
>
>
>
> # using lattice.
> p1 <- xyplot( yy~xx,type='l');
> p2 <- lpolygon(xx,yy,col='blue');
> print(p1,position=c(0,0,1,1), more=TRUE);
> print(p2,position=c(0,0,1,1));

You are missing a fundamental concept in lattice, namely that of panel
functions. A literal translation of that example would be

xyplot(yy ~ xx, panel = lpolygon, col = "gray")

which is more or less equivalent to

xyplot(yy ~ xx,
   panel = function(x, y, ...) {
   # panel.xyplot(x, y, ...) # unnecessary
   lpolygon(x, y, col = "gray")
   })

The line commented out is the equivalent of plot(...type='n'), but is
unnecessary here.

Deepayan



CONFIDENTIALITY NOTICE: This electronic mail transmission (i...{{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] Fw: Help needed using lattice for area plots lpolygon, xyplot.

2006-06-07 Thread Deepayan Sarkar
On 6/7/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I am trying to learn how to use the graphics from the lattice package (
> and am very new to R).
>
> I am trying to replicate the example plot referenced below, by using the
> lattice xyplot & lpolygon to create panels.  I get what appears to be the
> correct shape of the filled region, but cannot get the position to overlay
> properly.  I have attempted with various settings of position.  ( i.e.
> position = c(0,0,1,1)  etc settings as well.   I am not understanding
> something about the positioning panels.  I am missing some subtle
> difference between polygon & lpolygon, or am missing something about panel
> overlays &/or panel postions.
>
> #http://addictedtor.free.fr/graphiques/graphcode.php?graph=7.
> par(bg="white")
> n <- 100
> set.seed(43214) #just so we have the same exact graph
> x <- c(0,cumsum(rnorm(n)))
> y <- c(0,cumsum(rnorm(n)))
> xx <- c(0:n, n:0)
> yy <- c(x, rev(y))
> plot(xx, yy, type="n", xlab="Time", ylab="Distance")
> polygon(xx, yy, col="gray")
> title("Distance Between Brownian Motions")
>
>
>
> # using lattice.
> p1 <- xyplot( yy~xx,type='l');
> p2 <- lpolygon(xx,yy,col='blue');
> print(p1,position=c(0,0,1,1), more=TRUE);
> print(p2,position=c(0,0,1,1));

You are missing a fundamental concept in lattice, namely that of panel
functions. A literal translation of that example would be

xyplot(yy ~ xx, panel = lpolygon, col = "gray")

which is more or less equivalent to

xyplot(yy ~ xx,
   panel = function(x, y, ...) {
   # panel.xyplot(x, y, ...) # unnecessary
   lpolygon(x, y, col = "gray")
   })

The line commented out is the equivalent of plot(...type='n'), but is
unnecessary here.

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


[R] how to do multiple comparison in the nonparametric statistical analysis?

2006-06-07 Thread zhijie zhang
Dear Rusers,
 As we all know , there are many methods to do multiple comparison in the
parametric statistical analysis, But i can't find some in nonparametric
statistical analysis.
 Could anybody give some suggestions?

[[alternative HTML version deleted]]

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


Re: [R] multiple data sets on one plot

2006-06-07 Thread Marc Schwartz (via MN)
On Wed, 2006-06-07 at 10:30 -0500, Mark L Sessing wrote:
> Hello,
> 
> I am learning how to use R, and I cannot figure out how to plot more 
> than one data set on a single plot.  Can you help me out?
> 
> Cheers,
> Mark

It depends upon the type of plot (scatter, lines, bar, etc.) and whether
or not you are using R's base graphics or lattice graphics.

With more information, we can offer specific guidance.

For example, with base graphics, you can add additional plot components
with:

?lines
?points
?segments
?matpoints (Note also matplot() on the same page)
?curve
?arrows

A good starting place would be Chapter 12 "Graphical Procedures" in An
Introduction to R, which is available within your R installation (on
Windows from the GUI menus) or from the Documentation links on the R
home page.

An additional resource is the R Graph Gallery:

  http://addictedtor.free.fr/graphiques/index.php

and Chapter 3 "From Data to Graphics" by Vincent Zoonekynd here:

  http://zoonek2.free.fr/UNIX/48_R/all.html

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] Edit function

2006-06-07 Thread Pikounis, Bill [CNTUS]
I use a simple-minded, dirty wrapper on edit:

view <- function(x) {
  warnopt <- options()$warn
  options(warn=-1)
  on.exit({sink(); options(warn=warnopt)})
  edit(x)
  invisible()
}

I say "dirty", because sometimes the output is re-directed from stdout
somewhere else as an unintended side effect, which is why I have the first
sink() statement in there. (Note the help file on sink() advises in numerous
places on using sink()-related calls with care.) I have not been ambitious
enough to make the above version robust and well-understood, as it works
well for me nearly every time, and when it does not, the side effect and
cleanup is neither damaging nor annoying enough.

Also, I have only really used this under Windows R GUI.

Hope that helps,
Bill

---
Bill Pikounis, PhD
Nonclinical Statistics
Centocor, Inc.


>   > edit(data)
>
>   But when I close the window then again the materials 
> contained in data is displayed in the command window. But I 
> do not want to see these materials again. Can anyone give me 
> any idea on how to do this?


Hope that helps,
Bill


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of stat stat
> Sent: Wednesday, June 07, 2006 8:36 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Edit function
> 
> 
> Dear all R users,
>
>   I have a query on "Edit" function. Suppose I have a data 
> frame named "data". I can use EDIT function to see the 
> materials contained in data, by using the command: 
>
>   > edit(data)
>
>   But when I close the window then again the materials 
> contained in data is displayed in the command window. But I 
> do not want to see these materials again. Can anyone give me 
> any idea on how to do this?
>
>   Thanks and regards,
>   stat
> 
>  Send instant messages to your online friends 
http://in.messenger.yahoo.com 

 Stay connected with your friends even when away from PC.  Link:
http://in.mobile.yahoo.com/new/messenger/  
[[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] multiple data sets on one plot

2006-06-07 Thread Sarah Goslee
Without more inormation about what you are specifically trying
to do, see
?line
?points

Sarah

On 6/7/06, Mark L Sessing <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I am learning how to use R, and I cannot figure out how to plot more
> than one data set on a single plot.  Can you help me out?
>
> Cheers,
> Mark
>
>
>

-- 
Sarah Goslee

[[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] use of R in big companies (references) & R-support esp in Germany

2006-06-07 Thread Spencer Graves
  The best rebuttal I've heard recently to arguments like that is Linux 
(www.linux.org):  It's distributed under the same general public license 
(GNU) license as R.

  A perspective that I don't recall having seen on this list is that 
the cost of producing and distributing software has become too cheap to 
meter, unless you want to charge for it.  Open source projects like 
Linux and R (and Mozilla, Subversion, and others) were much more 
difficult and less common before the Internet, just because the costs of 
coordinating development plus producing and distributing the product 
made such efforts much more difficult.  For a discussion of these 
phenomena by two Economics professors at UC-Berkeley, see Shapiro and 
Varian (1998) Information Rules (Harvard Business School Pr.).  A newer, 
similar title by these same authors is "The Economics of Information 
Technology";  I haven't read this newer book, but it looks like it could 
be relevant also.

  I mention this, because I suspect some of the opposition to open 
source, "free" software is ideology:  Rabid capitalists refuse to 
believe that anything free can be any good.  (We could talk about air 
and water, but that might be a digression.)  Books like this backed by 
solid research might help counter such opposition.

  Hope this helps.
  Spencer Graves

Armin Roehrl wrote:
> Dear R users,
> 
> sorry for this general email and I am sure it has been asked
> way too many times.
> 
> IT departements in big companies only want to support the big
> standards. Whatever big standards means apart from being expensive.
> 
> We are in the process of trying to get a risk management project
> for a big conservative company in Germany. As part of the project
> we would use R to run simulations, but the company is afraid of R.
> 
> 1) If anybody has any reference projects using R I can quote, please
> drop me an email. Best would be companies like Siemens, Allianz,
> Munich Re, Daimler Chrysler, Credit Suisse etc.
> 
> 2) Are there any software companies around with R know-how and are
> interested in paid R-projects? The bigger the company, the better
> as this client seems to be scared of software companies with less
> than 200 developers.
> 
> 
> Thanks,
>   -Armin
>

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


[R] multiple data sets on one plot

2006-06-07 Thread Mark L Sessing

Hello,

I am learning how to use R, and I cannot figure out how to plot more 
than one data set on a single plot.  Can you help me out?


Cheers,
Mark

--
Mark Sessing
CIMMS Research Fellow Meteorologist
NWS Warning Decision Training Branch
3200 Marshall Ave Ste. 202
Norman, OK 73072
Phone: 405-573-3332
Fax: 405-573-3462
[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] error bars in lattice xyplot *with groups*

2006-06-07 Thread Manuel Morales
Hi Mike,

If you're not committed to using a panel function, another option is to
use the function lineplot.CI, available in the package sciplot at
http://mutualism.williams.edu/sciplot

E.g.
# Define and generate variables in "long" format
range <- vector()
voice <- vector()

string <- strsplit(as.character(singer$voice.part)," ")
for(i in 1:dim(singer)[1]) {
  range[i] <- string[[i]][1] 
  voice[i] <- string[[i]][2]
}

# Define function for CI
conf.int <- function(x) {
  st <- boxplot.stats(x)
  c((st$conf[2]-st$conf[1])/2)
  }

# Plot
library(sciplot)
lineplot.CI(response=height, x.factor=voice, trace.factor=range,
data=singer, fun=median, ci.fun=conf.int)

lineplot.CI(response=height, x.factor=voice.part, data=singer,
fun=median, ci.fun=conf.int)


Manuel


On Tue, 2006-06-06 at 00:20 -0300, Mike Lawrence wrote:
> Hi all,
> 
> I'm trying to plot error bars in a lattice plot generated with xyplot. 
> Deepayan
> Sarkar has provided a very useful solution for simple circumstances
> (https://stat.ethz.ch/pipermail/r-help/2005-October/081571.html), yet I am
> having trouble getting it to work when the "groups" setting is enabled in
> xyplot (i.e. multiple lines). To illustrate this, consider the singer data
> generated by the above linked solution previously submitted:
> 
> #
> library(lattice)
> singer.split <-
> with(singer,
>  split(height, voice.part))
> 
> singer.ucl <-
> sapply(singer.split,
>function(x) {
>st <- boxplot.stats(x)
>c(st$stats[3], st$conf)
>})
> 
> singer.ucl <- as.data.frame(t(singer.ucl))
> names(singer.ucl) <- c("median", "lower", "upper")
> singer.ucl$voice.part <-
> factor(rownames(singer.ucl),
>levels = rownames(singer.ucl))
> 
> #now let's split up the voice.part factor into two factors,
> singer.ucl$voice=factor(rep(c(1,2),4))
> singer.ucl$range=factor(rep(c("Bass","Tenor","Alto","Soprano"),each=2))
> 
> #here's Deepayan's previous solution, slightly modified to depict
> #  the dependent variable (median) and the error bars on the y-axis
> #  and the independent variable (voice.part) on the x-axis
> prepanel.ci <- function(x, y, ly, uy, subscripts, ...)
> {
> x <- as.numeric(x)
> ly <- as.numeric(ly[subscripts])
> uy <- as.numeric(uy[subscripts])
> list(ylim = range(y, uy, ly, finite = TRUE))
> }
> panel.ci <- function(x, y, ly, uy, subscripts, pch = 16, ...)
> {
> x <- as.numeric(x)
> y <- as.numeric(y)
> ly <- as.numeric(ly[subscripts])
> uy <- as.numeric(uy[subscripts])
> panel.arrows(x, ly, x, uy, col = "black",
>  length = 0.25, unit = "native",
>  angle = 90, code = 3)
> panel.xyplot(x, y, pch = pch, ...)
> }
> 
> 
> #this graph works
> xyplot(median ~ voice.part,
>   data=singer.ucl,
>   ly = singer.ucl$lower,
>   uy = singer.ucl$upper,
>   prepanel = prepanel.ci,
>   panel = panel.ci,
>   type="b"
> )
> 
> #this one does not (it will plot, but will not seperate the groups)
> xyplot(median ~ voice,
>   groups=range,
>   data=singer.ucl,
>   ly = singer.ucl$lower,
>   uy = singer.ucl$upper,
>   prepanel = prepanel.ci,
>   panel = panel.ci,
>   type="b"
> )
> 
> 
> 
> Any suggestions?
>

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


Re: [R] Help with sample function

2006-06-07 Thread Austin, Matt
I couldn't help but respond to this one, it's not often I see my own name.

Using data from the survival library:

library(survival)
lung[1:10, c('time', 'status')]
Surv(lung$time, lung$status)[1:10]

--Matt

Matt Austin
Statistician
Amgen, Inc
800 9AMGEN9 x77431
805-447-7431




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Matthew Austin
Sent: Wednesday, June 07, 2006 6:57 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Help with sample function


I have generated some some survival times and censoring indicators. 
Thus I have an ordered pair for each observation. How do I sample these 
ordered paris? I only know how to sample from a vector? I would 
appreciate any help I could get.

Thanks
Matt

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

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


Re: [R] Help with sample function

2006-06-07 Thread Dimitris Rizopoulos
try something like:

surv.data <- data.frame(times = rexp(100, 1/10), events = rbinom(100, 
1, 0.7))
surv.data[sample(nrow(surv.data), replace = TRUE), ]


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: "Matthew Austin" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, June 07, 2006 3:57 PM
Subject: [R] Help with sample function


>I have generated some some survival times and censoring indicators.
> Thus I have an ordered pair for each observation. How do I sample 
> these
> ordered paris? I only know how to sample from a vector? I would
> appreciate any help I could get.
>
> Thanks
> Matt
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 


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

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


[R] Help with sample function

2006-06-07 Thread Matthew Austin
I have generated some some survival times and censoring indicators. 
Thus I have an ordered pair for each observation. How do I sample these 
ordered paris? I only know how to sample from a vector? I would 
appreciate any help I could get.

Thanks
Matt

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

2006-06-07 Thread ronggui
If you want to change the data,_fix_ will be a good option.But if you
just want to browse the data ,then invisible(edit(data)) is better
one.

I remember this question showed up some time ago.


2006/6/7, Ulrich Keller <[EMAIL PROTECTED]>:
> fix(data)
>
> will invoke edit(data) and store changes you make in data without
> displaying anything.
>
> stat stat schrieb:
> > Dear all R users,
> >
> >   I have a query on "Edit" function. Suppose I have a data frame named 
> > "data". I can use EDIT function to see the materials contained in data, by 
> > using the command:
> >
> >   > edit(data)
> >
> >   But when I close the window then again the materials contained in data is 
> > displayed in the command window. But I do not want to see these materials 
> > again. Can anyone give me any idea on how to do this?
> >
> >   Thanks and regards,
> >   stat
> >
> >  Send instant messages to your online friends http://in.messenger.yahoo.com
> >
> >  Stay connected with your friends even when away from PC.  Link: 
> > http://in.mobile.yahoo.com/new/messenger/
> >   [[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
>


-- 
ronggui huang
Deparment of Sociology
Fudan 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] Building packages in R - 'private' functions

2006-06-07 Thread Seth Falcon
"Antonio, Fabio Di Narzo" <[EMAIL PROTECTED]> writes:

> 1. If you have time to change internal functions naming, you can rename
> internal functions by putting a leading '.'.
> Even without namespace, I have noticed there is no check for corresponding
> docs for such functions.
>
> 2. If you don't want to rename all internal functions, the best way is
> writing an 'internals.Rd' file with an alias for each internal function
> (documented in 'writing R extensions').
>
> 3.Finally, you can add a NAMESPACE (see writing R extensions). However, if
> you use S3/S4 classes, this can be much more tedious to do.
>
> I think the no. 2 to be the fastest/safer way.

I think adding a NAMESPACE file is the best solution and I don't think
that the process needs to be particularly tedious.

Having a naming convention for private functions is fine and you can
still do that with a NAMESPACE.  Non-exported functions do not get
checked for documentation, so there is no need for an internals.Rd (of
course, it doesn't hurt to give yourself some documentation for when
you return to the project 3 months later :-)

Besides hiding your private functions, a NAMESPACE protects you from
users or other packages redefining functions that you rely on.  As an
extreme example, if a user redefined length(), many packages without
namespaces would break.

+ seth

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

2006-06-07 Thread Ulrich Keller
fix(data)

will invoke edit(data) and store changes you make in data without 
displaying anything.

stat stat schrieb:
> Dear all R users,
>
>   I have a query on "Edit" function. Suppose I have a data frame named 
> "data". I can use EDIT function to see the materials contained in data, by 
> using the command: 
>
>   > edit(data)
>
>   But when I close the window then again the materials contained in data is 
> displayed in the command window. But I do not want to see these materials 
> again. Can anyone give me any idea on how to do this?
>
>   Thanks and regards,
>   stat
>
>  Send instant messages to your online friends http://in.messenger.yahoo.com 
>
>  Stay connected with your friends even when away from PC.  Link: 
> http://in.mobile.yahoo.com/new/messenger/  
>   [[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] Fw: Help needed using lattice for area plots lpolygon, xyplot.

2006-06-07 Thread toby_marks
I am trying to learn how to use the graphics from the lattice package ( 
and am very new to R). 

I am trying to replicate the example plot referenced below, by using the 
lattice xyplot & lpolygon to create panels.  I get what appears to be the 
correct shape of the filled region, but cannot get the position to overlay 
properly.  I have attempted with various settings of position.  ( i.e. 
position = c(0,0,1,1)  etc settings as well.   I am not understanding 
something about the positioning panels.  I am missing some subtle 
difference between polygon & lpolygon, or am missing something about panel 
overlays &/or panel postions.

#http://addictedtor.free.fr/graphiques/graphcode.php?graph=7. 
par(bg="white") 
n <- 100
set.seed(43214) #just so we have the same exact graph
x <- c(0,cumsum(rnorm(n))) 
y <- c(0,cumsum(rnorm(n))) 
xx <- c(0:n, n:0)
yy <- c(x, rev(y)) 
plot(xx, yy, type="n", xlab="Time", ylab="Distance") 
polygon(xx, yy, col="gray") 
title("Distance Between Brownian Motions") 



# using lattice.
p1 <- xyplot( yy~xx,type='l');
p2 <- lpolygon(xx,yy,col='blue');
print(p1,position=c(0,0,1,1), more=TRUE);
print(p2,position=c(0,0,1,1));






CONFIDENTIALITY NOTICE: This electronic mail transmission (i...{{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] how to read hdf files under R?

2006-06-07 Thread Prof Brian Ripley
On Wed, 7 Jun 2006, Nicolas Degallier wrote:

> I am trying to install in my R environment the rhdf5 package and
> library but it seems to have vanished from either the CRAN or
> BioConductors sites.
>
> Can you tell me where it would be possible to find it or any R
> library (or function) able to read hdf files?

How about the hdf5 package on CRAN?  Works for me.

-- 
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] x y averaging thanks

2006-06-07 Thread Randy Zelick

I have three completely different(!) but workable solutions. Thanks much 
for your help.

=Randy=

R. Zelick   email: [EMAIL PROTECTED]
Department of Biology   voice: 503-725-3086
Portland State University   fax:   503-725-3888

mailing:
P.O. Box 751
Portland, OR 97207

shipping:
1719 SW 10th Ave, Room 246
Portland, OR 97201

__
R-help@stat.math.ethz.ch 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 read hdf files under R?

2006-06-07 Thread Nicolas Degallier
Hi!

I am trying to install in my R environment the rhdf5 package and  
library but it seems to have vanished from either the CRAN or  
BioConductors sites.

Can you tell me where it would be possible to find it or any R  
library (or function) able to read hdf files?

Sincerely,

Nicolas Degallier

UMR 7159 / IRD UR182
Laboratoire d'Océanographie et du Climat, Expérimentation et  
Approches Numériques (LOCEAN)
Tour 45-55, 4e ét., case 100, 4 place Jussieu
75252  Paris Cedex 5  France

tél: (33) 01 44 27 51 57
fax: (33) 01 44 27 38 05
E-mail: <[EMAIL PROTECTED]>

Publications (anonymous ftp):

ftp://ftp.lodyc.jussieu.fr/LOCEAN/ndelod

__
R-help@stat.math.ethz.ch 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 needed using lattice for area plots lpolygon, xyplot.

2006-06-07 Thread toby_marks
I am trying to learn how to use the graphics from the lattice package ( 
and am very new to R). 

I am trying to replicate the example plot referenced below, by using the 
lattice xyplot & lpolygon to create panels.  I get what appears to be the 
correct shape of the filled region, but cannot get the position to overlay 
properly.  I have attempted with various settings of position.  ( i.e. 
position = c(0,0,1,1)  etc settings as well.   I am not understanding 
something about the positioning panels.  I am missing some subtle 
difference between polygon & lpolygon, or am missing something about panel 
overlays &/or panel postions.

#http://addictedtor.free.fr/graphiques/graphcode.php?graph=7. 
par(bg="white") 
n <- 100
set.seed(43214) #just so we have the same exact graph
x <- c(0,cumsum(rnorm(n))) 
y <- c(0,cumsum(rnorm(n))) 
xx <- c(0:n, n:0)
yy <- c(x, rev(y)) 
plot(xx, yy, type="n", xlab="Time", ylab="Distance") 
polygon(xx, yy, col="gray") 
title("Distance Between Brownian Motions") 



# using lattice.
p1 <- xyplot( yy~xx,type='l');
p2 <- lpolygon(xx,yy,col='blue');
print(p1,position=c(0,0,1,1), more=TRUE);
print(p2,position=c(0,0,1,1));






CONFIDENTIALITY NOTICE: This electronic mail transmission (i...{{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] Edit function

2006-06-07 Thread Prof Brian Ripley
On Wed, 7 Jun 2006, stat stat wrote:

> Dear all R users,
>
>  I have a query on "Edit" function. Suppose I have a data frame named 
> "data". I can use EDIT function to see the materials contained in data, 
> by using the command:
>
>  > edit(data)
>
>  But when I close the window then again the materials contained in data 
> is displayed in the command window. But I do not want to see these 
> materials again. Can anyone give me any idea on how to do this?

?invisible

>
>  Thanks and regards,
>  stat

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

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


Re: [R] Help with selecting data from irregular time series {its} objects

2006-06-07 Thread Gabor Grothendieck
See: ?itsSubset

On 6/7/06, Ivan Kalafatic <[EMAIL PROTECTED]> wrote:
> If I understood correctly in irregular time series (its) objects, values are
> indexed by time stamps in POSIX format.
> But if I try to select the value of my time series corresponding to specific
> time stamp in the following way:
> x - its object
>
> i <- as.POSIXct("2006-05-19 15:30:00")
> x[i,] or x[i] or x[i,1] I get the error message: subscript out of bounds.
>
> If I use integers: x[1,1] it is ok I get the first element of time series.
>
> Is there a way to select elements by their corresponding dates?
>
>[[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] making matrix monotonous

2006-06-07 Thread Michael Friendly
[Presuming you mean monotone; many matrices are already monotonous.]

General solutions to this problem are discussed in

@ARTICLE{Friendly:02:corrgram,
   author = {M. Friendly},
   title = {Corrgrams: Exploratory displays for correlation matrices},
   journal = {The American Statistician},
   year = {2002},
   volume = {56},
   pages = {316--324},
   number = {4},
   url = {http://www.math.yorku.ca/SCS/Papers/corrgram.pdf},
}
and implemented (in SAS)
http://www.math.yorku.ca/SCS/sasmac/corrgram.html

Rather than just the first principal component, it is usually better
to order the variables by the angles between the first 2 PC, 
corresponding to their order around a 2D biplot, using
sort(atan(V2/V1))

-Michael



[EMAIL PROTECTED] wrote:

> Spencer Graves a écrit :
> 
> 
>>  I agree it would be great to sort the variables in a correlation 
>>matrix to make it easier to read and see patterns.  I don't know any 
>>functions for doing that.  If it were my problem, I might "order" the 
>>variables by their first principal component.  There may also be some 
>>cluster analysis way to do that, but I don't know it well enough to say.
>>  Hope this helps.
>>  Spencer Graves
> 
> 
> Thanks for your answer Spencer.
> 
> Here is a first result of a very simple and naive approach.
> http://7d4.com/r/
> 
> Of course, there is no assumption the sorting is "optimal",
> but on this little example it helps the matrix being
> more readable.
> 
> Vincent
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

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

2006-06-07 Thread stat stat
Dear all R users,
   
  I have a query on "Edit" function. Suppose I have a data frame named "data". 
I can use EDIT function to see the materials contained in data, by using the 
command: 
   
  > edit(data)
   
  But when I close the window then again the materials contained in data is 
displayed in the command window. But I do not want to see these materials 
again. Can anyone give me any idea on how to do this?
   
  Thanks and regards,
  stat

 Send instant messages to your online friends http://in.messenger.yahoo.com 

 Stay connected with your friends even when away from PC.  Link: 
http://in.mobile.yahoo.com/new/messenger/  
[[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 with selecting data from irregular time series {its} objects

2006-06-07 Thread Ivan Kalafatic
If I understood correctly in irregular time series (its) objects, values are
indexed by time stamps in POSIX format.
But if I try to select the value of my time series corresponding to specific
time stamp in the following way:
x - its object

i <- as.POSIXct("2006-05-19 15:30:00")
x[i,] or x[i] or x[i,1] I get the error message: subscript out of bounds.

If I use integers: x[1,1] it is ok I get the first element of time series.

Is there a way to select elements by their corresponding dates?

[[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] smoothing plot(x, type ='l')

2006-06-07 Thread Jim Lemon
Federico Calboli wrote:
> Hi All,
> 
> I am using plot(x, type = 'l') for some plotting, but I would like rounded 
> edges 
> rather than jagged edges in the plot (purely for aestetic reasons).
> 
> How could I achieve that?
> 
Perhaps you want something like:
x<-rnorm(50)
plot(spline(1:50,x),type="l")

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] smoothing plot(x, type ='l')

2006-06-07 Thread Federico Calboli
Prof Brian Ripley wrote:
  > It I understand you aright, that is done by par(lend) but the default is
> "round".  So maybe your graphics device (unstated) on your OS (unstated) 
> does not support this.

graphics device = X11 (xserver-xorg)
OS = Debian GNU/Linux, Kernel 2.4.27-2-686-smp

> 
> We need more details, and preferably a simple reproducible example.

s.off.dist
   [1] 27 26 15  7 32 50 31 19  1 11  8  4  4  5 11 28  4 32  5 39 15 32  3  3  
4
  [26]  1  2  2 22  1 23  4  2  8 40 14 42  3  1  4  3  4  4  6  2 29  4  8  5  
9
  [51] 37  2  1 13 13 35  6  9  2  5 31 10  7  1  4 22  3 23  4 10  8 57  1  6  
1
  [76]  1  4 10 16  3 12  3 10  8 10 11 16 19  5  5  9  9  3  4  1  8  3 12  3 
65
[101]  1  7 21  7  2  4 35 15  6  2  6  4  1 14  4 10 24  3  4  3  2  4 11  4  7
[126] 13  7  1  6  2  4 16  3 13 66 10  4  7  2 17  6  4  3  5  6  8  3  3 10 19
[151]  7  3 17  6  6  6  2  9  5  4  4 18  2  3 17 43 22 12  1  3  1  9  3  5  1
[176]  2  5 36 12 23  1  8 10  6  7 19  5 13  2  5  3  9  3  1 12  4  5  3  6  3
[201]  5  1  1 16  6 12  1  5  4  2  2  4  9  9  3 11  7  4  8 14  5 17  3  3 15
[226]  2  4  2 11 13  1 19  7  4  3 20  2  8  5  2  3  4  2  5  5 10  1  9 10  8
[251]  4  4  2  1  3  5  3  1  4  5 13 12  6  5  4  3 10  5  4  1

plot(hist(s.off.dist, breaks = 'fd')$counts ~ hist(s.off.dist, breaks = 
'fd')$m, 
type = 'l')

I want the edges to look round, if at all possible.

Cheers,

Federico



-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.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] making matrix monotonous

2006-06-07 Thread Gabor Grothendieck
On 6/7/06, Romain Francois <[EMAIL PROTECTED]> wrote:
> Le 07.06.2006 11:20, [EMAIL PROTECTED] a écrit :
> > Spencer Graves a écrit :
> >
> >
> >>   I agree it would be great to sort the variables in a correlation
> >> matrix to make it easier to read and see patterns.  I don't know any
> >> functions for doing that.  If it were my problem, I might "order" the
> >> variables by their first principal component.  There may also be some
> >> cluster analysis way to do that, but I don't know it well enough to say.
> >>   Hope this helps.
> >>   Spencer Graves
> >>
> >
> > Thanks for your answer Spencer.
> >
> > Here is a first result of a very simple and naive approach.
> > http://7d4.com/r/
> >
> > Of course, there is no assumption the sorting is "optimal",
> > but on this little example it helps the matrix being
> > more readable.
> >
> > Vincent
> >
> Hello Vincent,
>
> Ahhh, the double for loop, the semicolon, the return call. you still
> believe in R code looking like C don't you.
> Try this one :
>
> matrix.sort2 <- function(M, fun = function(m) colSums(abs(m)) ){
>  M[or <- order(fun(M) , decreasing=T), or]
> }

Even if this works I don't think its guaranteed since one cannot
be sure the first argument, or<-..., is evaluated before the second, or.
Also use TRUE in case there is a T variable in workspace:

matrix.sort3 <- function(M, fun = function(m) colSums(abs(m)) ) {
  or <- order(fun(M), decreasing = TRUE)
  M[or, or]
}

__
R-help@stat.math.ethz.ch 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] smoothing plot(x, type ='l')

2006-06-07 Thread Prof Brian Ripley
On Wed, 7 Jun 2006, Federico Calboli wrote:

> Hi All,
>
> I am using plot(x, type = 'l') for some plotting, but I would like 
> rounded edges rather than jagged edges in the plot (purely for aestetic 
> reasons).
>
> How could I achieve that?

It I understand you aright, that is done by par(lend) but the default is 
"round".  So maybe your graphics device (unstated) on your OS (unstated) 
does not support this.

We need more details, and preferably a simple reproducible example.

-- 
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] making matrix monotonous

2006-06-07 Thread Romain Francois
Le 07.06.2006 11:20, [EMAIL PROTECTED] a écrit :
> Spencer Graves a écrit :
>
>   
>>   I agree it would be great to sort the variables in a correlation 
>> matrix to make it easier to read and see patterns.  I don't know any 
>> functions for doing that.  If it were my problem, I might "order" the 
>> variables by their first principal component.  There may also be some 
>> cluster analysis way to do that, but I don't know it well enough to say.
>>   Hope this helps.
>>   Spencer Graves
>> 
>
> Thanks for your answer Spencer.
>
> Here is a first result of a very simple and naive approach.
> http://7d4.com/r/
>
> Of course, there is no assumption the sorting is "optimal",
> but on this little example it helps the matrix being
> more readable.
>
> Vincent
>   
Hello Vincent,

Ahhh, the double for loop, the semicolon, the return call. you still 
believe in R code looking like C don't you.
Try this one :

matrix.sort2 <- function(M, fun = function(m) colSums(abs(m)) ){
  M[or <- order(fun(M) , decreasing=T), or]
}

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

__
R-help@stat.math.ethz.ch 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] smoothing plot(x, type ='l')

2006-06-07 Thread Federico Calboli
Dimitris Rizopoulos wrote:
> probably you want to use the `lend' argument of ?par(); I hope it helps.

Does not seem to work in my case.

F

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.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] smoothing plot(x, type ='l')

2006-06-07 Thread Dimitris Rizopoulos
probably you want to use the `lend' argument of ?par(); I hope it 
helps.

Best,
Dimitris


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

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


- Original Message - 
From: "Federico Calboli" <[EMAIL PROTECTED]>
To: "r-help" 
Sent: Wednesday, June 07, 2006 12:40 PM
Subject: [R] smoothing plot(x, type ='l')


> Hi All,
>
> I am using plot(x, type = 'l') for some plotting, but I would like 
> rounded edges
> rather than jagged edges in the plot (purely for aestetic reasons).
>
> How could I achieve that?
>
> Cheers,
>
> Federico
>
> -- 
> Federico C. F. Calboli
> Department of Epidemiology and Public Health
> Imperial College, St Mary's Campus
> Norfolk Place, London W2 1PG
>
> Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193
>
> f.calboli [.a.t] imperial.ac.uk
> f.calboli [.a.t] gmail.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
> 


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

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


[R] smoothing plot(x, type ='l')

2006-06-07 Thread Federico Calboli
Hi All,

I am using plot(x, type = 'l') for some plotting, but I would like rounded 
edges 
rather than jagged edges in the plot (purely for aestetic reasons).

How could I achieve that?

Cheers,

Federico

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.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] making matrix monotonous

2006-06-07 Thread vincent
Spencer Graves a écrit :

>   I agree it would be great to sort the variables in a correlation 
> matrix to make it easier to read and see patterns.  I don't know any 
> functions for doing that.  If it were my problem, I might "order" the 
> variables by their first principal component.  There may also be some 
> cluster analysis way to do that, but I don't know it well enough to say.
>   Hope this helps.
>   Spencer Graves

Thanks for your answer Spencer.

Here is a first result of a very simple and naive approach.
http://7d4.com/r/

Of course, there is no assumption the sorting is "optimal",
but on this little example it helps the matrix being
more readable.

Vincent

__
R-help@stat.math.ethz.ch 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 create list of objects?

2006-06-07 Thread Rainer M Krug
Thanks everybody - it's working

Rainer

Dimitris Rizopoulos wrote:
> try something like:
> 
> lapply(f, summary)
> sapply(f, function(x) AIC(logLik(x)))
> 
> 
> Best,
> Dimitris
> 
> 
> Dimitris Rizopoulos
> Ph.D. Student
> Biostatistical Centre
> School of Public Health
> Catholic University of Leuven
> 
> Address: Kapucijnenvoer 35, Leuven, Belgium
> Tel: +32/(0)16/336899
> Fax: +32/(0)16/337015
> Web: http://med.kuleuven.be/biostat/
>  http://www.student.kuleuven.be/~m0390867/dimitris.htm
> 
> 
> - Original Message - 
> From: "Rainer M Krug" <[EMAIL PROTECTED]>
> To: "R help list" 
> Sent: Tuesday, June 06, 2006 4:38 PM
> Subject: [R] How to create list of objects?
> 
> 
>> Hi
>>
>> I am doing several mle and want to store them in a list (or whatever 
>> is
>> the right construct) to be able to analyse them later.
>>
>> at the moment I am doing:
>>
>> f <- list()
>> f$IP <- mle(...)
>> f$NE <- mle(...)
>>
>> but when I say:
>>> summary(f)
>> I get:
>>
>> Length Class Mode
>> IP   0  mle   list
>> NE   0  mle   list
>>
>> I don't get the output I would have, i.e. the one from
>>> summary(f$IP)
>> summary(f$IP)
>> Maximum likelihood estimation
>>
>> Call:
>> mle(minuslogl = IPNeglogPoisL, method = "L-BFGS-B", fixed = list(),
>>control = list(maxit = 1e+08, factr = 1e-20))
>>
>> Coefficients:
>>  Estimate  Std. Error
>> a 1242.0185506 44.92341097
>> b0.8802538  0.01685811
>>
>> -2 log L: 145.3509
>>
>>
>> What I want to do is something like:
>>
>> AICs <- AIC(logLik(f))
>>
>> and then have all the AICs in the vector AICs.
>>
>> It must be possible or is this again a namespace issue?
>>
>> Rainer
>>
>> -- 
>> Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
>> Biology (UCT)
>>
>> Department of Conservation Ecology and Entomology
>> University of Stellenbosch
>> Matieland 7602
>> South Africa
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>>
> 
> 
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

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

email:  [EMAIL PROTECTED]
[EMAIL PROTECTED]

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


Re: [R] Building packages in R - 'private' functions

2006-06-07 Thread Antonio, Fabio Di Narzo
1. If you have time to change internal functions naming, you can rename
internal functions by putting a leading '.'.
Even without namespace, I have noticed there is no check for corresponding
docs for such functions.

2. If you don't want to rename all internal functions, the best way is
writing an 'internals.Rd' file with an alias for each internal function
(documented in 'writing R extensions').

3.Finally, you can add a NAMESPACE (see writing R extensions). However, if
you use S3/S4 classes, this can be much more tedious to do.

I think the no. 2 to be the fastest/safer way.
Antonio.

2006/6/7, Dan Rabosky <[EMAIL PROTECTED]>:
>
>
> Hello.
>
> I am creating an R package that I'd like to submit to CRAN (OS Windows
> XP).  How do I distinguish among 'public' functions, e.g., those that are
> intended to be called by users of the package and for which I am providing
> documentation & examples, and 'private' functions, which are used
> internally by the 'public' functions, but for which I do not wish to
> provide documentation?  The private functions are all coded in R (nothing
> in C or Fortran) and are essential to the operation of several public
> functions.
>
> I have been unable to find any documentation on this in the 'writing r
> extensions' manual', on previous posts to R-help, or through any other
> source.  One possibility is to include the source code for the 'private'
> functions within the public functions.  However, since multiple public
> functions utilize the same core set of 'private' functions, this seems
> unwieldy and redundant at best.
>
> If I simply include the source for the 'private' functions in the "R"
> directory (without corresponding *.Rd and *.html documentation in /man),
> then check the package with "R CMD check', it does appear to process the
> private functions (and successfully builds with R CMD build).  However, I
> do receive a warning for including undocumented code objects.  Is this the
> recommended approach and/or is there a better way to do this?  One
> potential problem with this approach is that - should an error occur
> within
> a private function, it may be very difficult for the user to decipher the
> nature of the problem.
>
> Any suggestions will be greatly appreciated.
> ~Dan Rabosky
>
>
>
> Dan Rabosky
> Department of Ecology and Evolutionary Biology
> 237 Corson Hall
> Cornell University
> Ithaca, NY14853-2701 USA
> [EMAIL PROTECTED]
> web: http://www.birds.cornell.edu/evb/Graduates_Dan.htm
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

[[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] Building packages in R - 'private' functions

2006-06-07 Thread Joerg van den Hoff
Dan Rabosky wrote:
> Hello.
> 
> I am creating an R package that I'd like to submit to CRAN (OS Windows 
> XP).  How do I distinguish among 'public' functions, e.g., those that are 
> intended to be called by users of the package and for which I am providing 
> documentation & examples, and 'private' functions, which are used 
> internally by the 'public' functions, but for which I do not wish to 
> provide documentation?  The private functions are all coded in R (nothing 
> in C or Fortran) and are essential to the operation of several public 
> functions.
> 
> I have been unable to find any documentation on this in the 'writing r 
> extensions' manual', on previous posts to R-help, or through any other 
> source.  One possibility is to include the source code for the 'private' 
> functions within the public functions.  However, since multiple public 
> functions utilize the same core set of 'private' functions, this seems 
> unwieldy and redundant at best.
> 
> If I simply include the source for the 'private' functions in the "R" 
> directory (without corresponding *.Rd and *.html documentation in /man), 
> then check the package with "R CMD check', it does appear to process the 
> private functions (and successfully builds with R CMD build).  However, I 
> do receive a warning for including undocumented code objects.  Is this the 
> recommended approach and/or is there a better way to do this?  One 
> potential problem with this approach is that - should an error occur within 
> a private function, it may be very difficult for the user to decipher the 
> nature of the problem.
> 
> Any suggestions will be greatly appreciated.
> ~Dan Rabosky
> 
> 
> 
> Dan Rabosky
> Department of Ecology and Evolutionary Biology
> 237 Corson Hall
> Cornell University
> Ithaca, NY14853-2701 USA
> [EMAIL PROTECTED]
> web: http://www.birds.cornell.edu/evb/Graduates_Dan.htm
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

it's in the 'extensions' manual, including an example I believe:

1.
create a file `NAMESPACE' in the package top level dir (beside `R' and 
`man') containing the single line

exportPattern("^[^\\.]")

2.
name all private functions with a leading `.' (more precisely: all 
functions starting with a `.' are private in this setting).


of course, you can modify the pattern to suit another naming convention.

joerg

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


Re: [R] x y averaging

2006-06-07 Thread Prof Brian Ripley
It's confusing to have time values that are different but `match', so 
first you want to reduce your times to hh:mm  (e.g. with substr).

Then you can cbind() the data frames, and use tapply() to do the 
averaging. E.g.

d1 <- read.table("foo1")
d2 <- read.table("foo2")
d <- cbind(d1, d2)
d$time <- factor(substr(as.character(d$x), 1, 5))
tapply(d$y, d$time, mean)
  14:56  14:62  14:68  15:59  16:05  16:11  16:17  16:23  16:33  16:39
0.3250 0.1110 0.2140 0.2575 0.2545 0.3040 0.2550 0.2630 0.2630 0.3000

There are other ways, e.g.

aggregate(d["y"], list(d$time), mean)

or via ave().


On Tue, 6 Jun 2006, Randy Zelick wrote:

> Hello,
>
> I am trying to average a number of data sets where the x vector contains
> times and the Y data are instrument readings. The vectors all have
> different numbers of values, but many X time values match. For example:
>
> A fragment of the first data set:
>
> x vectvalue
> 14:56:10  0.325
> 14:62:11  0.111
> 14:68:11  0.214
> .
> .
> .
> this can go on for 100's of values, spaced by 6 minutes, but there can be
> gaps too, like:
>
> 16:05:18  0.245
> 16:11:09  0.266
> 16:17:05  0.271
> 16:33:00  0.304
> 16:39:05  0.300
>
>
> A fragment of the second data set:
>
> 15:59:08  0.255
> 16:05:44  0.281
> 16:11:25  0.249
> 16:17:39  0.238
> 16:23:51  0.288
>
>
> ...and the result I am looking for is a new vector that looks like this:
>
> 14:56:10  0.325
> 14:62:11  0.111
> 14:68:11  0.214
> .
> .
> .
> 15:59:08  0.255
> 16:05:18  0.2630  * matches, so average
> 16:11:09  0.2575  * matches, so average
> 16:17:05  0.2545  * matches, so average
> 16:33:00  0.304
> 16:39:05  0.300
>
>
> The times values in the new X vector are properly interleaved taking data
> across the datasets, but when there is a match the Y values are averaged.
> Note that the seconds don't matter.
>
> I am using R Version 2.2.1 on a PC
>
> Thanks for thinking about it,
>
> =Randy=
>
> R. Zelick email: [EMAIL PROTECTED]
> Department of Biology voice: 503-725-3086
> Portland State University fax:   503-725-3888
>
> mailing:
> P.O. Box 751
> Portland, OR 97207
>
> shipping:
> 1719 SW 10th Ave, Room 246
> Portland, OR 97201
>
> __
> R-help@stat.math.ethz.ch 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