Re: [R] I never made any assumption athat anyone had any obligation to do anything

2005-05-27 Thread Gabor Grothendieck
Perhaps the list would work better if posters who do not follow
the posting guide are nicely told that they will more likely get
helpful replies if they read and follow the posting guide and,
in particular, provide a reproducible example.

If the poster does not follow that advice then the poster can just 
be ignored.   

This thread pointed out that even though the original poster
did not follow the guide and ignored direct suggestions that he 
still got his answer.  The problem is that he felt insulted in the 
process.  If the above procedure were followed he might not have 
received an answer to his problem but there would have been less 
animosity all around and maybe that's more important. 

Perhaps the posting guide could even suggest such an approach.


On 5/27/05, James MacDonald <[EMAIL PROTECTED]> wrote:
> To add to Spencer's reply, I have two things.
> 
> First, if you look back at your earlier list entries, Uwe asked you
> politely at least twice to read the posting guide. The reason for this
> is that the posting guide gives guidance to allow you to post questions
> that are clear enough to answer, and points you to other sources of
> information that you might not already know about. It was only after you
> appeared to ignore his advice that he 'yelled' at you.
> 
> Second, you ultimately learned several things. As far as I can tell, Uwe
> did answer your questions, but more importantly, you learned how to
> interact on a list where you get free advice on how to use free software
> (the operative term here being *free*). Isn't that better than being
> ignored and not learning anything?
> 
> Best,
> 
> Jim
> 
> 
> 
> James W. MacDonald
> Affymetrix and cDNA Microarray Core
> University of Michigan Cancer Center
> 1500 E. Medical Center Drive
> 7410 CCGC
> Ann Arbor MI 48109
> 734-647-5623
> >>> Spencer Graves <[EMAIL PROTECTED]> 05/27/05 5:34 PM >>>
> Hello, Erithid:
> 
>  I'm very sorry you feel you got yelled at first thing in the
> morning.
>  Please try not to take it personally, though I know that may be
> difficult.  After one superficially insulting reply, I just laughed and
> told my manager, "Look what I learned for exposing myself to ridicule!"
> 
>  My philosophy on this was expressed last December and
> subsequently
> added to the "fortunes" pacakage, from which I will quote for you now:
> 
>  > library(fortunes)
>  > fortune("Graves")
> 
> Our great-great grandchilren as yet unborn may read some of the stupid
> questions
> and/or answers that I and perhaps others give from time to time. I'd
> rather get
> flamed for saying something stupid in public on this list than to
> continue to
> provide substandard service to the people with whom I work because I
> perpetrated
> the same mistake in an environment in which no one questioned so
> effectively my
> errors.
>-- Spencer Graves (in a discussion on whether answers on R-help
> should be more
>   polite)
>   R-help (December 2004)
> 
>  I've heard from some of the best on this listserve that it
> happens to
> everyone.  That doesn't make it right.  If you can learn to accept this
> as a different subculture operating by different rules of diplomacy, you
> 
> might get more out of this list, do better work with whatever you are
> attempting to do, and enjoy life more.  (My wife's middle name is Rose.
>  When she gives me a hard time about something, I just try to listen
> and console myself with the thought that, "If I want to sleep in a bed
> of roses, I must get used to the thorns.")
> 
>  Best Wishes,
>  spencer graves
> 
> BJ wrote:
> 
> > I just asked a question. If I was too vague, then i am sorry. I dont
> > expect anyone to help me, but I thought that it was ok to put the
> > question out there in case someone wanted to help me. I didnt expect
> > abject hostility for it. Human decency was the only thing I did
> expect.
> > If my question was a pain,badly formatted, or too juvinile, then i
> have
> > no problem being ignored.I asked a question that the archives did not
> > satisfactorily answer. I appreciate the help of the poeple on this
> list
> > as they are an invaluable resource, especially since the R
> documentation
> > is sketchy at times. I am sorry for wasting everyones time. I just
> dont
> > like being yelled at first thing in the morning for asking for help on
> a
> > help list. See you all around  ~Erithid
> >
> > __
> > R-help@stat.math.ethz.ch 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
> 
> 
> 
> **
> Electronic Mail is not secure, may not be

Re: [R] I never made any assumption athat anyone had any obligation to do anything

2005-05-27 Thread James MacDonald
To add to Spencer's reply, I have two things.

First, if you look back at your earlier list entries, Uwe asked you
politely at least twice to read the posting guide. The reason for this
is that the posting guide gives guidance to allow you to post questions
that are clear enough to answer, and points you to other sources of
information that you might not already know about. It was only after you
appeared to ignore his advice that he 'yelled' at you.

Second, you ultimately learned several things. As far as I can tell, Uwe
did answer your questions, but more importantly, you learned how to
interact on a list where you get free advice on how to use free software
(the operative term here being *free*). Isn't that better than being
ignored and not learning anything?

Best,

Jim



James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
>>> Spencer Graves <[EMAIL PROTECTED]> 05/27/05 5:34 PM >>>
Hello, Erithid:

  I'm very sorry you feel you got yelled at first thing in the
morning. 
  Please try not to take it personally, though I know that may be 
difficult.  After one superficially insulting reply, I just laughed and 
told my manager, "Look what I learned for exposing myself to ridicule!"

  My philosophy on this was expressed last December and
subsequently 
added to the "fortunes" pacakage, from which I will quote for you now:

 > library(fortunes)
 > fortune("Graves")

Our great-great grandchilren as yet unborn may read some of the stupid 
questions
and/or answers that I and perhaps others give from time to time. I'd 
rather get
flamed for saying something stupid in public on this list than to 
continue to
provide substandard service to the people with whom I work because I 
perpetrated
the same mistake in an environment in which no one questioned so 
effectively my
errors.
-- Spencer Graves (in a discussion on whether answers on R-help 
should be more
   polite)
   R-help (December 2004)

  I've heard from some of the best on this listserve that it
happens to 
everyone.  That doesn't make it right.  If you can learn to accept this 
as a different subculture operating by different rules of diplomacy, you

might get more out of this list, do better work with whatever you are 
attempting to do, and enjoy life more.  (My wife's middle name is Rose. 
  When she gives me a hard time about something, I just try to listen 
and console myself with the thought that, "If I want to sleep in a bed 
of roses, I must get used to the thorns.")

  Best Wishes,
  spencer graves

BJ wrote:

> I just asked a question. If I was too vague, then i am sorry. I dont 
> expect anyone to help me, but I thought that it was ok to put the 
> question out there in case someone wanted to help me. I didnt expect 
> abject hostility for it. Human decency was the only thing I did
expect. 
> If my question was a pain,badly formatted, or too juvinile, then i
have 
> no problem being ignored.I asked a question that the archives did not 
> satisfactorily answer. I appreciate the help of the poeple on this
list 
> as they are an invaluable resource, especially since the R
documentation 
> is sketchy at times. I am sorry for wasting everyones time. I just
dont 
> like being yelled at first thing in the morning for asking for help on
a 
> help list. See you all around  ~Erithid
> 
> __
> R-help@stat.math.ethz.ch 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



**
Electronic Mail is not secure, may not be read every day, and should not be 
used for urgent or sensitive issues.

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

2005-05-27 Thread Thomas Lumley

On Fri, 27 May 2005 [EMAIL PROTECTED] wrote:


Sorry, still confused. If I dont have fpc's ready in my dataset (calculate
myself?) that means that R will use the weight of an individual for each of his
repeated observations. But is that then still correct? The "cluster" individual
is ignored and each observation of an individual has the same weight.



Well, it depends to some extent on what inferences you are making, but 
yes, you probably do want each observation to have the same weight.


Suppose you have 4 measurements on each person, and you are working with a 
simple random sample of 1000 people from a population of 1,000,000. If you 
had done these 4 measurements on the whole population you would have 
4,000,000 measurements, so the 4000 measurements you have are 1/1000 of 
the population.  This is the same weighting as if you had a single 
measurement person person, giving 1000 measurements in the sample and 
1,000,000 in the population.


If different individuals have different numbers of measurements then 
things get a bit trickier. It depends then on why there are different 
numbers of measurements.If they are the result of non-response you might 
want to rescale the weights at later time points to give the right 
population totals.  If they are part of the sampling design then the 
design will specify what to do with them.



-thomas

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


Re: [R] images and maps in R

2005-05-27 Thread Don MacQueen
This is is not difficult from the online help for the map() function. 
Here is an example.


map('state', region = c('new york', 'new jersey', 'penn'),fill=TRUE,col=1:4)

There is also an example there in how to add text to the map.

Another way uses the maptools package.

require(maptools)
?plot.Map

and then follow the examples given in the help page for plot.Map().

At 2:42 PM -0700 5/27/05, yyan liu wrote:

Hi:
  I have a question arising from my project.
  A sample of the data is below. The first row stands
for the names of state in USA. The second row stand
for some numeric value in that state. Some of them are
NA. I can use the commands "data(stateMapEnv)" and
"map('state', fill = F)" in library "maps" to make a
plot of USA states. What I want to do is: 1. put the
corresponding state name on the Map 2. give different
state different colors which is related to their
value. For example, "red" for values ranging from
0-30, "green" for values from 80-90, etc. 3. if
possible, put the value of each state within the state
on the map. here, take the numeric value as some text.

Thank you very much!

AB  AK  AL  AR  AZ  CT   CA
91  80  NA  NA  17  33   20

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



--
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

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


[R] installing spatstat in OSX

2005-05-27 Thread R JC


Friends, 

I am trying to install the current version of spatstat
on Mac OS 10.3.9, but the compilation fails with the
following messages at the end: 


ld: warning -L: directory name
(/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2)
does not exist
ld: can't locate file for: -lg2c
make: *** [spatstat.so] Error 1
ERROR: compilation failed for package 'spatstat'

The current version of sm (which spatstat needs) also
fails to compile when I try that separately, with the
same error message. I remember that binaries of these
packages were formerly available for OSX, but not
anymore. 

I would appreciate your help with installing these.

Thanks,

-Robert

__
R-help@stat.math.ethz.ch 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] images and maps in R

2005-05-27 Thread yyan liu
Hi:
  I have a question arising from my project. 
  A sample of the data is below. The first row stands
for the names of state in USA. The second row stand
for some numeric value in that state. Some of them are
NA. I can use the commands "data(stateMapEnv)" and
"map('state', fill = F)" in library "maps" to make a
plot of USA states. What I want to do is: 1. put the
corresponding state name on the Map 2. give different
state different colors which is related to their
value. For example, "red" for values ranging from
0-30, "green" for values from 80-90, etc. 3. if
possible, put the value of each state within the state
on the map. here, take the numeric value as some text.

Thank you very much!

AB  AK  AL  AR  AZ  CT   CA
91  80  NA  NA  17  33   20

__
R-help@stat.math.ethz.ch 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] I never made any assumption athat anyone had any obligation to do anything

2005-05-27 Thread Spencer Graves

Hello, Erithid:

	  I'm very sorry you feel you got yelled at first thing in the morning. 
 Please try not to take it personally, though I know that may be 
difficult.  After one superficially insulting reply, I just laughed and 
told my manager, "Look what I learned for exposing myself to ridicule!"


	  My philosophy on this was expressed last December and subsequently 
added to the "fortunes" pacakage, from which I will quote for you now:


> library(fortunes)
> fortune("Graves")

Our great-great grandchilren as yet unborn may read some of the stupid 
questions
and/or answers that I and perhaps others give from time to time. I'd 
rather get
flamed for saying something stupid in public on this list than to 
continue to
provide substandard service to the people with whom I work because I 
perpetrated
the same mistake in an environment in which no one questioned so 
effectively my

errors.
   -- Spencer Graves (in a discussion on whether answers on R-help 
should be more

  polite)
  R-help (December 2004)

	  I've heard from some of the best on this listserve that it happens to 
everyone.  That doesn't make it right.  If you can learn to accept this 
as a different subculture operating by different rules of diplomacy, you 
might get more out of this list, do better work with whatever you are 
attempting to do, and enjoy life more.  (My wife's middle name is Rose. 
 When she gives me a hard time about something, I just try to listen 
and console myself with the thought that, "If I want to sleep in a bed 
of roses, I must get used to the thorns.")


  Best Wishes,
  spencer graves

BJ wrote:

I just asked a question. If I was too vague, then i am sorry. I dont 
expect anyone to help me, but I thought that it was ok to put the 
question out there in case someone wanted to help me. I didnt expect 
abject hostility for it. Human decency was the only thing I did expect. 
If my question was a pain,badly formatted, or too juvinile, then i have 
no problem being ignored.I asked a question that the archives did not 
satisfactorily answer. I appreciate the help of the poeple on this list 
as they are an invaluable resource, especially since the R documentation 
is sketchy at times. I am sorry for wasting everyones time. I just dont 
like being yelled at first thing in the morning for asking for help on a 
help list. See you all around  ~Erithid


__
R-help@stat.math.ethz.ch 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] Windows binary version of port_0.1-1 available

2005-05-27 Thread Douglas Bates
In an earlier message today I mentioned that a source package with a
version of nlminb for R was available as

http://www.stat.wisc.edu/~bates/port_0.1-1.tar.gz

Thanks to Kjetil Halvorsen there is now a Windows binary version
available as

http://www.stat.wisc.edu/~bates/port_0.1-1.zip

__
R-help@stat.math.ethz.ch 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] Soil texture triangle in R?

2005-05-27 Thread Sander Oom

Cleaned up the class divisions and created a full function.

Still to do:
- rotate axis labels;
- correct the partial covering of the bottom tick labels;
- rotate ticks in order to simplify viewing the graph.
See: 
http://soil.scijournals.org/content/vol65/issue4/images/large/1038f2.jpeg


Wonder whether triangle.plot{ade4} will give more flexibility!?

Anyway, hopefully the result so far is useful for other people.

Cheers,

Sander.

plot.soiltexture <- function(x,pch,col) {
  ## triangle plots:
  ##   triangle.plot {ade4}
  ##   triplot{klaR}
  ##   ternaryplot {vcd}
  require(vcd)
  require(Zelig)
  ternaryplot(x,
grid=FALSE,
dimnames.position = "none",
pch=pch, col=col,
scale=1, main=NULL,
prop.size=FALSE
  )
  oldpar <- par(no.readonly=TRUE)

  ticlength <- 0.01
  ## now the bottom internal ticks
  x1<-seq(0.1,0.9,by=0.1)
  x2<-x1
  y1<-rep(0,9)
  y2<-rep(ticlength,9)
  segments(x1,y1,x2,y2)
  text(x1,y1-0.03,as.character(rev(seq(10,90,by=10 #, cex=0.8)
  ## now the left internal ticks
  y1<-x1*sin60
  x1<-x1*0.5
  x2<-x1+ticlength*sin60
  y2<-y1-ticlength*0.5
  segments(x1,y1,x2,y2)
  text(x1-0.03,y1+0.015,as.character(seq(10,90,by=10)))
  ## now the right internal ticks
  x1<-rev(x1+0.5-ticlength*sin60)
  x2<-x1+ticlength*sin60
  segments(x1,y2,x2,y1)
  text(x2+0.03,y1+0.015,as.character(rev(seq(10,90,by=10

  ## the labels at the corners
  par(xpd=TRUE)
#   text(0.5,0.9,"100% clay")
#   text(-0.1,0,"100% sand")
#   text(1.1,0,"100% loam")

  ## the axis labels
  text(0.09,0.43,"% Clay")
  text(0.90,0.43,"% Silt")
  text(0.5,-0.1,"% Sand")

  # boundary of clay with extensions
  x1<-c(0.275,0.355,0.6)
  x2<-c(0.415,0.8,0.7)
  y1<-c(0.55*sin60,0.4*sin60,0.4*sin60)
  y2<-c(0.285*sin60,0.4*sin60,0.6*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.5,0.57,"Clay", col="grey")
  # lower bound of clay loam & silty divider
  x1<-c(0.415,0.66)
  x2<-c(0.856,0.6)
  y1<-c(0.285*sin60,0.285*sin60)
  y2<-c(0.285*sin60,0.40*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.7,0.49*sin60,"Silty", col="grey")
  text(0.7,0.44*sin60,"clay", col="grey")
  text(0.72,0.36*sin60,"Silty clay", col="grey")
  text(0.73,0.32*sin60,"loam", col="grey")
  text(0.5,0.35*sin60,"Clay loam", col="grey")
  x1<-c(0.185,0.1,0.37)
  x2<-c(0.37,0.37,0.415)
  y1<-c(0.37*sin60,0.2*sin60,0.2*sin60)
  y2<-c(0.37*sin60,0.2*sin60,0.285*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.28,0.43*sin60,"Sandy", col="grey")
  text(0.27,0.39*sin60,"clay", col="grey")
  text(0.27,0.3*sin60,"Sandy clay", col="grey")
  text(0.27,0.26*sin60,"loam", col="grey")
  # sand corner
  x1<-c(0.05,0.075)
  x2<-c(0.15,0.3)
  y1<-c(0.1*sin60,0.15*sin60)
  y2<-c(0,0)
  segments(x1,y1,x2,y2, col="grey")
  text(0.25,0.13*sin60,"Sandy loam", col="grey")
  text(0.14,0.07*sin60,"Loamy", col="grey")
  text(0.18,0.03*sin60,"sand", col="grey")
  text(0.06,0.021,"Sand", col="grey")
  x1<-c(0.37,0.435,0.5,0.8,0.86)
  x2<-c(0.435,0.537,0.64,0.86,0.94)
  y1<-c(0.2*sin60,0.08*sin60,0,0,0.12*sin60)
  y2<-c(0.08*sin60,0.08*sin60,0.285*sin60,0.12*sin60,0.12*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.49,0.18*sin60,"Loam", col="grey")
  text(0.72,0.15*sin60,"Silt loam", col="grey")
  text(0.9,0.06*sin60,"Silt", col="grey")

  ternarypoints(x, pch = pch, col = col)

  par(oldpar)
}

tmp <- array(dim=c(10,3))
tmp[,2] <- abs(rnorm(10)*20)
tmp[,3] <- abs(rnorm(10)*10)
tmp[,1] <- 100-tmp[,2]-tmp[,3]
col <- rep("black",10)
pch <- rep(1, 10)
plot.soiltexture(tmp,pch,col="black")


Sander Oom wrote:

Right,

Got the data points plotted on top of the soil texture background, 
thanks to Jim and ternaryplot{vcd}! See code below.


Now there is some fine tuning to do, as it should really look like this 
graph:

http://soil.scijournals.org/content/vol65/issue4/images/large/1038f2.jpeg

Things to do:
- rotate axis labels;
- correct small errors in class divisions;
- correct the partial covering of the bottom tick labels;
- rotate ticks in order to simplify viewing the graph.

Any help still appreciated!

Cheers,

Sander.


soil.triangle <- function() {
  oldpar <- par(no.readonly=TRUE)
  ## now the bottom internal ticks
  x1<-seq(0.1,0.9,by=0.1)
  x2<-x1
  y1<-rep(0,9)
  y2<-rep(-0.02,9)
  segments(x1,y1,x2,y2)
  text(x1,y1-0.03,as.character(rev(seq(10,90,by=10 #, cex=0.8)
  ## now the left internal ticks
  y1<-x1*sin60
  x1<-x1*0.5
  x2<-x1+0.02*sin60
  y2<-y1-0.02*0.5
  segments(x1,y1,x2,y2)
  text(x1-0.03,y1+0.015,as.character(seq(10,90,by=10)))
  ## now the right internal ticks
  x1<-rev(x1+0.5-0.02*sin60)
  x2<-x1+0.02*sin60
  segments(x1,y2,x2,y1)
  text(x2+0.03,y1+0.015,as.character(rev(seq(10,90,by=10
  ## the labels at the corners
  par(xpd=TRUE)
#   text(0.5,0.9,"100% clay")
#   text(-0.1,0,"100% sand")
#   text(1.1,0,"100% loam")
  text(0.09,0.43,"% Clay")
  text(0.90,0.43,"% Silt")
  text(0.5,-0.1,"% Sand")
  # boundary of clay with extensions
  x1<-c(0.275,0.35,0.6)
  x2<-c(0.4,0.79,0.7)
  y1<-c(0.55*sin60,0.41*sin60,0.41*sin60)
  

Re: [R] longitudinal survey data

2005-05-27 Thread h . brunschwig
Sorry, still confused. If I dont have fpc's ready in my dataset (calculate
myself?) that means that R will use the weight of an individual for each of his
repeated observations. But is that then still correct? The "cluster" individual
is ignored and each observation of an individual has the same weight.

Thanks a lot.

Dassy

Quoting Thomas Lumley <[EMAIL PROTECTED]>:

> On Fri, 27 May 2005 [EMAIL PROTECTED] wrote:
> 
> >
> > Thank you for your reply.
> >
> > Does that mean that in order to take in account the repeated measures I
> denote
> > these as another cluster in R?
> >
> 
> Yes, but unless you have multistage finite population corrections to put 
> in the design object only the first stage of clustering affects the 
> results, so you may not need to bother.
> 
>   -thomas
> 
>

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


Re: [R] nlminb to optmin

2005-05-27 Thread Douglas Bates
Stefan Pohl wrote:
> Hi!
> 
> I want to convert S-Plus 6.2 code to R 2.1.0. Instead of the function nlminb 
> I use the function optmin
> 
> optmin(start,fn,gr,method="L-BFGS-B", lower, upper, hess,...)
> 
> But then I get the Error in optmin ...: L-BFGS-B needs finite values of fn
> 
> Then I used optmin(start,fn,gr,method="BFGS", hess, ...)
> 
> But then I get the Error in optmin ...: initial value in vmmin is not finite
> 
> I know the final parameter estimates from S-Plus which I use as starting 
> values in R.
> The upper and lower bounds are close around the final estimates.
> So there is not much to maximize.
> 
> What can I do?
> 
> Thank you for help,

I have a test version of a package available as

http://www.stat.wisc.edu/~bates/port_0.1-1.tar.gz

that provides nlminb for R.  If you can install packages from source
code then you may want to try that.  If you are running under Windows
and only install binary packages then we will need to ask for a
volunteer to create a Windows binary from the source package.

I do not plan to upload this package to CRAN.  Instead I plan to
incorporate nlminb into r-devel in time to have it become part of R-2.2.0

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

2005-05-27 Thread Sundar Dorai-Raj



Stefan Pohl wrote:

Hi!

I want to convert S-Plus 6.2 code to R 2.1.0. Instead of the function nlminb I 
use the function optmin

optmin(start,fn,gr,method="L-BFGS-B", lower, upper, hess,...)

But then I get the Error in optmin ...: L-BFGS-B needs finite values of fn

Then I used optmin(start,fn,gr,method="BFGS", hess, ...)

But then I get the Error in optmin ...: initial value in vmmin is not finite

I know the final parameter estimates from S-Plus which I use as starting values 
in R.
The upper and lower bounds are close around the final estimates.
So there is not much to maximize.

What can I do?

Thank you for help,

Peter




What is "optmin"? Do you mean "optim"?

Either way, you can always try your function at the initial values 
outside of optim. If it returns Inf, you have a problem with your 
objective function. Have you considered that your objective function in 
S-PLUS didn't port the way you expected to R? I.e. if you call your 
objective function in S-PLUS and then in R, using the same inputs, do 
you get identical outputs?


--sundar

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


Re: [R] R commandline editor question

2005-05-27 Thread A.J. Rossini
Of course it should be in ESS.  In fact, it is for me, anyway
(different colors depending on whether they match or not).

Check out the paren-hilit or paren-match (or something like that)
customize options.

I.e. 

M-x customize-groups  paren 

(which ought to complete on names of groups/options starting with
paren)  or blink-paren.

(I'm not on an Emacs-enabled computer right now).

On 5/27/05, Robin Hankin <[EMAIL PROTECTED]> wrote:
> Hi  Ajay
> 
> well ESS has such a facility.
> 
> However, I think Mathematica has a super scheme: unbalanced brackets
> show up
> in red, making them obvious.
> 
> This is particularly good for spotting wrongly interleaved brackets, as
> in
> 
> ([  blah di blah  )]
> 
> 
> 
> in which case both opening braces are highlighted in red: and the
> system won't
> accept a newline until the closures are all correctly matched.
> 
> Would anyone else find such a thing useful?
> 
> Could the ESS team make something like this happen?
> 
> 
> 
> 
> 
> On May 27, 2005, at 12:11 pm, Ajay Narottam Shah wrote:
> 
> > I am using R 2.1 on Apple OS X.
> >
> > When I get the ">" prompt, I find it works well with emacs commandline
> > editing. Keys like M-f C-k etc. work fine.
> >
> > The one thing that I really yearn for, which is missing, is bracket
> > matching When I am doing something which ends in  it is really
> > useful to have emacs or vi-style bracket matching, so as to be able
> > to visually keep track of whether I have the correct matching
> > brackets, whether ( or { or [.
> >
> > I'm sure this is possible. I will be most grateful if someone will
> > show the way :-) Thanks,
> >
> > --
> > Ajay Shah   Consultant
> > [EMAIL PROTECTED]  Department of Economic Affairs
> > http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
> >
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 


-- 
best,
-tony

"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).

A.J. Rossini
[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: [ESS] Re: [R] R commandline editor question

2005-05-27 Thread Richard M. Heiberger
If you are running R in the *R* buffer inside emacs, then you automatically
have highlighting of mismatched parentheses and brackets.

Rich

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

2005-05-27 Thread Stefan Pohl
Hi!

I want to convert S-Plus 6.2 code to R 2.1.0. Instead of the function nlminb I 
use the function optmin

optmin(start,fn,gr,method="L-BFGS-B", lower, upper, hess,...)

But then I get the Error in optmin ...: L-BFGS-B needs finite values of fn

Then I used optmin(start,fn,gr,method="BFGS", hess, ...)

But then I get the Error in optmin ...: initial value in vmmin is not finite

I know the final parameter estimates from S-Plus which I use as starting values 
in R.
The upper and lower bounds are close around the final estimates.
So there is not much to maximize.

What can I do?

Thank you for help,

Peter

[[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] Soil texture triangle in R?

2005-05-27 Thread Sander Oom

Right,

Got the data points plotted on top of the soil texture background, 
thanks to Jim and ternaryplot{vcd}! See code below.


Now there is some fine tuning to do, as it should really look like this 
graph:

http://soil.scijournals.org/content/vol65/issue4/images/large/1038f2.jpeg

Things to do:
- rotate axis labels;
- correct small errors in class divisions;
- correct the partial covering of the bottom tick labels;
- rotate ticks in order to simplify viewing the graph.

Any help still appreciated!

Cheers,

Sander.


soil.triangle <- function() {
  oldpar <- par(no.readonly=TRUE)
  ## now the bottom internal ticks
  x1<-seq(0.1,0.9,by=0.1)
  x2<-x1
  y1<-rep(0,9)
  y2<-rep(-0.02,9)
  segments(x1,y1,x2,y2)
  text(x1,y1-0.03,as.character(rev(seq(10,90,by=10 #, cex=0.8)
  ## now the left internal ticks
  y1<-x1*sin60
  x1<-x1*0.5
  x2<-x1+0.02*sin60
  y2<-y1-0.02*0.5
  segments(x1,y1,x2,y2)
  text(x1-0.03,y1+0.015,as.character(seq(10,90,by=10)))
  ## now the right internal ticks
  x1<-rev(x1+0.5-0.02*sin60)
  x2<-x1+0.02*sin60
  segments(x1,y2,x2,y1)
  text(x2+0.03,y1+0.015,as.character(rev(seq(10,90,by=10
  ## the labels at the corners
  par(xpd=TRUE)
#   text(0.5,0.9,"100% clay")
#   text(-0.1,0,"100% sand")
#   text(1.1,0,"100% loam")
  text(0.09,0.43,"% Clay")
  text(0.90,0.43,"% Silt")
  text(0.5,-0.1,"% Sand")
  # boundary of clay with extensions
  x1<-c(0.275,0.35,0.6)
  x2<-c(0.4,0.79,0.7)
  y1<-c(0.55*sin60,0.41*sin60,0.41*sin60)
  y2<-c(0.285*sin60,0.41*sin60,0.6*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.5,0.57,"Clay", col="grey")
  # lower bound of clay loam & silty divider
  x1<-c(0.4,0.68)
  x2<-c(0.86,0.6)
  y1<-c(0.285*sin60,0.285*sin60)
  y2<-c(0.285*sin60,0.41*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.7,0.49*sin60,"Silty", col="grey")
  text(0.7,0.44*sin60,"clay", col="grey")
  text(0.73,0.37*sin60,"Silty clay", col="grey")
  text(0.73,0.33*sin60,"loam", col="grey")
  text(0.5,0.35*sin60,"Clay loam", col="grey")
  x1<-c(0.185,0.1,0.37)
  x2<-c(0.36,0.37,0.4)
  y1<-c(0.37*sin60,0.2*sin60,0.2*sin60)
  y2<-c(0.37*sin60,0.2*sin60,0.285*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.27,0.43*sin60,"Sandy", col="grey")
  text(0.27,0.39*sin60,"clay", col="grey")
  text(0.27,0.3*sin60,"Sandy clay", col="grey")
  text(0.27,0.26*sin60,"loam", col="grey")
  # sand corner
  x1<-c(0.05,0.075)
  x2<-c(0.12,0.3)
  y1<-c(0.1*sin60,0.15*sin60)
  y2<-c(0,0)
  segments(x1,y1,x2,y2, col="grey")
  text(0.25,0.13*sin60,"Sandy loam", col="grey")
  text(0.13,0.075*sin60,"Loamy", col="grey")
  text(0.15,0.035*sin60,"sand", col="grey")
  text(0.055,0.021,"Sand", col="grey")
  x1<-c(0.37,0.42,0.5,0.8,0.86)
  x2<-c(0.42,0.54,0.65,0.86,0.94)
  y1<-c(0.2*sin60,0.08*sin60,0,0,0.12*sin60)
  y2<-c(0.08*sin60,0.08*sin60,0.285*sin60,0.12*sin60,0.12*sin60)
  segments(x1,y1,x2,y2, col="grey")
  text(0.49,0.18*sin60,"Loam", col="grey")
  text(0.72,0.15*sin60,"Silt loam", col="grey")
  text(0.9,0.06*sin60,"Silt", col="grey")
  par(oldpar)
}

tmp <- array(dim=c(10,3))
tmp[,1] <- abs(rnorm(10)*20)
tmp[,2] <- abs(rnorm(10)*10)
tmp[,3] <- 100-tmp[,1]-tmp[,2]
tmp

library(vcd)
## Mark groups
ternaryplot(tmp,
  grid=FALSE,
  dimnames.position = "none",
  pch=1, col="black",
  scale=1, main=NULL,
  prop.size=FALSE,
  )
soil.triangle()


Sander Oom wrote:

Hi Jim,

This looks impressive! It gives me the 'background' graph. However, I'm 
not sure how I can use this function to plot my soil texture values! Can 
you explain?


I would like to be able to plot my soil texture samples in the same 
graph as the one your function plots.


Maybe I should try to figure out how to replicate your code inside a 
ternaryplot{vcd} call.


Cheers,

Sander.

Jim Lemon wrote:
 > Sander Oom wrote:
 >> Dear R users,
 >>
 >> has anybody made an attempt to create the soil texture triangle graph
 >> in R? For an example see here:
 >>
 >> http://www.teachingkate.org/images/soiltria.gif
 >>
 >> I would like to get the lines in black and texture labels in gray to
 >> allow for plotting my texture results on top.
 >>
 >> Any examples or suggestions are very welcome!
 >>
 > It's not too hard to write a plot function to do this, but I'm not sure
 > whether this will be what you want. Anyway, try it out.
 >
 > Jim
 >
 > 
 >
 > soil.triangle<-function() {
 >  oldpar<-par(no.readonly=TRUE)
 >  plot(0:1,type="n",axes=FALSE,xlim=c(0,1.1),ylim=c(0,1),
 >   main="Soil Triangle",xlab="",ylab="")
 >  # first draw the triangle
 >  x1<-c(0,0,0.5)
 >  sin60<-sin(pi/3)
 >  x2<-c(1,0.5,1)
 >  y1<-c(0,0,sin60)
 >  y2<-c(0,sin60,0)
 >  segments(x1,y1,x2,y2)
 >  # now the bottom internal ticks
 >  x1<-seq(0.1,0.9,by=0.1)
 >  x2<-x1
 >  y1<-rep(0,9)
 >  y2<-rep(0.02,9)
 >  segments(x1,y1,x2,y2)
 >  text(x1,y1-0.03,as.character(rev(seq(10,90,by=10
 >  # now the left internal ticks
 >  y1<-x1*sin60
 >  x1<-x1*0.5
 >  x2<-x1+0.02*sin60
 >  y2<-y1-0.02*0.5
 >  segments(x1,y1,x2

Re: [R] longitudinal survey data

2005-05-27 Thread Thomas Lumley

On Fri, 27 May 2005 [EMAIL PROTECTED] wrote:



Thank you for your reply.

Does that mean that in order to take in account the repeated measures I denote
these as another cluster in R?



Yes, but unless you have multistage finite population corrections to put 
in the design object only the first stage of clustering affects the 
results, so you may not need to bother.


-thomas

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


[R] I never made any assumption athat anyone had any obligation to do anything

2005-05-27 Thread BJ
I just asked a question. If I was too vague, then i am sorry. I dont 
expect anyone to help me, but I thought that it was ok to put the 
question out there in case someone wanted to help me. I didnt expect 
abject hostility for it. Human decency was the only thing I did expect. 
If my question was a pain,badly formatted, or too juvinile, then i have 
no problem being ignored.I asked a question that the archives did not 
satisfactorily answer. I appreciate the help of the poeple on this list 
as they are an invaluable resource, especially since the R documentation 
is sketchy at times. I am sorry for wasting everyones time. I just dont 
like being yelled at first thing in the morning for asking for help on a 
help list. See you all around  ~Erithid


__
R-help@stat.math.ethz.ch 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] plotting box plots on same x

2005-05-27 Thread J.R. Lockwood
BJ-

For the record as well I could not make heads or tails of your question.

The dedicated folks who day in, day out field poorly specified questions have
no obligation to do so, and have every right to get frustrated when it seems
that their time is being taken advantage of.

On Fri, 27 May 2005, BJ wrote:

> Date: Fri, 27 May 2005 11:01:39 -0400
> From: BJ <[EMAIL PROTECTED]>
> To: Uwe Ligges <[EMAIL PROTECTED]>
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] plotting box plots on same x
> 
> Does it matter what they are? they are just names. The six box plots are 
> from the array I created with columns. I forgot to add teh dim 
> statement, my mistake. But I thought it was obvious that i was using a 
> matrix from the data frame call and the assignments I provided. My 
> question was simply about setting the x axis so that it stopped after 
> x=3, even though I had 6 plots.  For teh record, before I get jumped on 
> for the statistics, I am just using a 3 x 6 matrix to test the code 
> before applying it to actual data. Also, I was not being scarcastic. I 
> have recieved a lot of help from this mailing list. The R documentation 
> is hard to hunt down and not complete. Without the help of actual people 
> I would be dead in the water. I am sorry for any hostility that I have 
> incurred. ~Erithid
> 
> Uwe Ligges wrote:
> 
> > BJ wrote:
> >
> >> I am trying to construct a graph of 6 box plots of blood pressures. I 
> >> want them to be on a single set of axis and I want the SBP to be 
> >> ontop of the DBP. I have an array bp with the data in it and I tried
> >
> >
> >
> > Folks, please invest 1 minute of time to rethink whether other people 
> > will understand your question!
> >
> > What is "SBP", "DBP", and where are the "6" boxplots from?
> >
> >> a[1,]<-c(145,60,147,62,140,57)
> >
> >
> > "a" must already be defined here, or we cannot replace a column!
> >
> >> a[2,]<-c(160,75,160,74,160,70)
> >> a[3,]<-c(140,55,140,65,142,55)
> >> boxplot(data.frame(a), main = "Blood Pressures", at=c(1,1,2,2,3,3), 
> >> names=c("sit","","lie","","stand",""))
> >>
> >> which is close to what I want, but it gives me a bunch of empty space 
> >> at the end. is there a better way to do this to avoid this?
> >
> >
> > Well, the first point is that you should write questions that you 
> > would understand yourself. In a next step you might find someone who 
> > is able to answer it 
> >
> >> As always, Thank You. ~Erithid
> >
> >
> > "As always"? Does not sound very enthusiastic ...
> >
> >
> > Uwe Ligges
> >
> >
> >
> >>
> >> __
> >> R-help@stat.math.ethz.ch mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide! 
> >> http://www.R-project.org/posting-guide.html
> >
> >
> >
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

J.R. Lockwood
412-683-2300 x4941
[EMAIL PROTECTED]
http://www.rand.org/statistics/bios/



This email message is for the sole use of the intended recip...{{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] box plots without whiskers]

2005-05-27 Thread BJ


--- Begin Message ---

> boxplot(data.frame(1:10, 2:11), at = 1:2,
+   pars=list(staplelty=0, whisklty=0), at=1:2)
Error in boxplot.default(data.frame(1:10, 2:11), at = 1:2, pars = 
list(staplelty = 0,  :

   formal argument "at" matched by multiple actual arguments

a<-array(dim=c(3,8))
a[1,]<-c(140,60,145,60,147,62,140,57)
a[2,]<-c(160,70,160,75,160,74,160,70)
a[3,]<-c(140,60,140,55,140,65,142,55)
plot.new()
boxplot(data.frame(a),pars=list(staplelty=0, whisklty=0), main = 
"Boxplots", at=c(1,1,4,4,6,6,8,8), names=c("Base 
Line","","Sit","","Stand","","Lie",""),ylab="DBP
SBP")


This does not work. The output is a collection of verticle lines that 
are as long as the boxes should be.


boxplot(data.frame(a),staplelty=0, whisklty=0, main = "Boxplots", 
at=c(1,1,4,4,6,6,8,8), names=c("Base 
Line","","Sit","","Stand","","Lie",""),ylab="DBP
SBP")


does though. So I thank you for your help. Didnt mean to get yellled at 
over what seemed like a decent question. The mailing list archives say 
you have to use the lattice package to achieve the effect I wanted.. 
Anyhow. Sorry to everyone else for the excessive trafffic. ~Erithid



Uwe Ligges wrote:


BJ wrote:

Hmm ok, that seems to work with that example, but when I add an "at=" 
option i get graphs that are only verticle lines. Sorry to be difficult. 




He? So you need to pe much more precisely in this message as well!

boxplot(data.frame(1:10, 2:11), at = 1:2,
  pars=list(staplelty=0, whisklty=0), at=1:2)

works perfectly for me! People are not that happy to invest their time 
for helping you on bad specified problems...


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

Uwe Ligges




~BJ

Uwe Ligges wrote:


BJ wrote:

I searched the archives, but couldnt find any way to do this with 
boxplot. Is there a way? Thanks again ~BJ





See ?boxplot and its argument par which points you to ?bxp:

Now, you can do stuff like
  boxplot(1:10, pars=list(staplelty=0, whisklty=0))

Uwe Ligges




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












--- End Message ---
__
R-help@stat.math.ethz.ch 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 R for classifying new samples

2005-05-27 Thread bogdan romocea
Read this book, "Multivariate Statistical Analysis: A Conceptual
Introduction" by Sam Kash Kachigan. I think it's *great*, and perfect
for someone without any statistical background.


-Original Message-
From: manav ram [mailto:[EMAIL PROTECTED]
Sent: Friday, May 27, 2005 10:56 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Using R for classifying new samples


Hello,
I do not have any statistical background, So I shall
apologise if I am asking trivial question or help.

I am trying to work with R.
The problem I have on hand is:
I have 2 sets of data(means & SD for each sample in
the group of both sets). The sample size is
massive(2000+ in each grp).
I have a new set of experimental data and I like to
classify this to either of the grps based on
statistical evidence.
I thought using Linear discriminant analysis of R(MASS
package) I can solve this problem.
But unfortunately I am not quite sure its the right
way and further with given my background I am not even
sure how to prepare the data to test.

To explain my problem further, I have prepared a small
set of data to be testedso that it might be easy
to suggest the right way to go ahead.The data is in
the
form""Object>Query>mean_grp1>SD_grp1>mean_grp2>SD_grp2""

A>3.890>3.315>1.105>1.395>0.345
B>0.915>1.193>0.334>0.638>0.034
C>2.059>2.155>0.614>1.042>0.159
D>1.372>0.901>0.314>0.384>0.174

What I would like to test is if the "query" belongs to
grp 1 or 2(for all my samples,2000+)and if it can read
out to me teh query belongs to grp_1 or grp_2.
Is there some good examples that I can refer to which
can teach me step wise right from preparing the data
to testing???or would there be someone who can help me
with this problem?

Thanks a lot for your time...look forward to hear some
help and suggestions

Manav

__
R-help@stat.math.ethz.ch 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] plotting box plots on same x

2005-05-27 Thread Marc Schwartz
On Fri, 2005-05-27 at 10:17 -0400, BJ wrote:
> I am trying to construct a graph of 6 box plots of blood pressures. I 
> want them to be on a single set of axis and I want the SBP to be ontop 
> of the DBP. I have an array bp with the data in it and I tried
> 
> a[1,]<-c(145,60,147,62,140,57)
> a[2,]<-c(160,75,160,74,160,70)
> a[3,]<-c(140,55,140,65,142,55)
>  boxplot(data.frame(a), main = "Blood Pressures", at=c(1,1,2,2,3,3), 
> names=c("sit","","lie","","stand",""))
> 
> which is close to what I want, but it gives me a bunch of empty space at 
> the end. is there a better way to do this to avoid this?
> 
> As always, Thank You. ~Erithid

To answer both of your posts, use the following:

# Review how your data is structured above. Your code for creating "a" 
# is not replicable. For those lacking clinical insight, explaining
# your acronyms would also be helpful...  :-)

SBP <- matrix(c(145, 160, 140, 
147, 160, 140,
140, 160, 142), ncol = 3)
 
DBP <- matrix(c(60, 75, 55, 
62, 74, 65,
57, 70, 55), ncol = 3)

colnames(SBP) <- colnames(DBP) <- c("sit","lie","stand")

# The key here is to only plot three at a time, lest boxplot() 
# default to a 'xlim' of 0.5 to 6.5 (1:# of groups +/- 0.5)
# Then use 'add = TRUE' to plot the second group of 3
# Note also that I set the 'ylim' to the range of the combined
# values in the first plot.

boxplot(data.frame(SBP), main = "Blood Pressures", 
ylim = range(c(SBP, DBP)),
whisklty = 0, staplelty = 0)

boxplot(data.frame(DBP), add = TRUE, whisklty = 0, staplelty = 0)

Note the final two arguments, which result in the whiskers being drawn
with an "invisible" line.

See ?boxplot and ?bxp for more information.

HTH,

Marc Schwartz

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


Re: [R] Chars as numbers

2005-05-27 Thread Josef Eschgfaeller



as.numeric


Some weeks ago one discussed on the list about how
to transform a hexadecimal representation to
decimal digits. Specifically one has to transform
'a' to 10 etc. In C one does this with 'a'-87,
but I did not find a function for this in R.
Using match on letterdigits as in the following
is of course a little slow when repeated often.
---
Hex = function (rep16)
{rep16=tolower(rep16)
u=strsplit(rep16,'',perl=T)[[1]]
letterdigits=c(0:9,letters)
v=sapply(u,function (x)
  match(x,letterdigits)-1)
v=as.numeric(v)
Horner(v,16)}

Horner = function (v,alfa=2)
{b=v[1]; m=length(v)
if (m>1) for (i in 2:m)
b=b*alfa+v[i]; b}

# Example:
for (x in c('0','a0','10e','f0ae'))
print(Hex(x))
# 0
# 160
# 270
# 61614
---
Josef Eschgfäller

--
Josef Eschgfäller
Dipartimento Matematico
Universita' di Ferrara
http://felix.unife.it
__
R-help@stat.math.ethz.ch 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] plotting box plots on same x

2005-05-27 Thread BJ
Does it matter what they are? they are just names. The six box plots are 
from the array I created with columns. I forgot to add teh dim 
statement, my mistake. But I thought it was obvious that i was using a 
matrix from the data frame call and the assignments I provided. My 
question was simply about setting the x axis so that it stopped after 
x=3, even though I had 6 plots.  For teh record, before I get jumped on 
for the statistics, I am just using a 3 x 6 matrix to test the code 
before applying it to actual data. Also, I was not being scarcastic. I 
have recieved a lot of help from this mailing list. The R documentation 
is hard to hunt down and not complete. Without the help of actual people 
I would be dead in the water. I am sorry for any hostility that I have 
incurred. ~Erithid


Uwe Ligges wrote:


BJ wrote:

I am trying to construct a graph of 6 box plots of blood pressures. I 
want them to be on a single set of axis and I want the SBP to be 
ontop of the DBP. I have an array bp with the data in it and I tried




Folks, please invest 1 minute of time to rethink whether other people 
will understand your question!


What is "SBP", "DBP", and where are the "6" boxplots from?


a[1,]<-c(145,60,147,62,140,57)



"a" must already be defined here, or we cannot replace a column!


a[2,]<-c(160,75,160,74,160,70)
a[3,]<-c(140,55,140,65,142,55)
boxplot(data.frame(a), main = "Blood Pressures", at=c(1,1,2,2,3,3), 
names=c("sit","","lie","","stand",""))


which is close to what I want, but it gives me a bunch of empty space 
at the end. is there a better way to do this to avoid this?



Well, the first point is that you should write questions that you 
would understand yourself. In a next step you might find someone who 
is able to answer it 



As always, Thank You. ~Erithid



"As always"? Does not sound very enthusiastic ...


Uwe Ligges





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






__
R-help@stat.math.ethz.ch 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] box plots without whiskers

2005-05-27 Thread Uwe Ligges

BJ wrote:
Hmm ok, that seems to work with that example, but when I add an "at=" 
option i get graphs that are only verticle lines. Sorry to be difficult. 



He? So you need to pe much more precisely in this message as well!

boxplot(data.frame(1:10, 2:11), at = 1:2,
  pars=list(staplelty=0, whisklty=0), at=1:2)

works perfectly for me! People are not that happy to invest their time 
for helping you on bad specified problems...


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

Uwe Ligges




~BJ

Uwe Ligges wrote:


BJ wrote:

I searched the archives, but couldnt find any way to do this with 
boxplot. Is there a way? Thanks again ~BJ




See ?boxplot and its argument par which points you to ?bxp:

Now, you can do stuff like
  boxplot(1:10, pars=list(staplelty=0, whisklty=0))

Uwe Ligges




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







__
R-help@stat.math.ethz.ch 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] box plots without whiskers

2005-05-27 Thread BJ
Hmm ok, that seems to work with that example, but when I add an "at=" 
option i get graphs that are only verticle lines. Sorry to be difficult. ~BJ


Uwe Ligges wrote:


BJ wrote:

I searched the archives, but couldnt find any way to do this with 
boxplot. Is there a way? Thanks again ~BJ



See ?boxplot and its argument par which points you to ?bxp:

Now, you can do stuff like
  boxplot(1:10, pars=list(staplelty=0, whisklty=0))

Uwe Ligges




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






__
R-help@stat.math.ethz.ch 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 R for classifying new samples

2005-05-27 Thread manav ram
Hello,
I do not have any statistical background, So I shall
apologise if I am asking trivial question or help.

I am trying to work with R.
The problem I have on hand is:
I have 2 sets of data(means & SD for each sample in
the group of both sets). The sample size is
massive(2000+ in each grp).
I have a new set of experimental data and I like to
classify this to either of the grps based on
statistical evidence.
I thought using Linear discriminant analysis of R(MASS
package) I can solve this problem.
But unfortunately I am not quite sure its the right
way and further with given my background I am not even
sure how to prepare the data to test.

To explain my problem further, I have prepared a small
set of data to be testedso that it might be easy
to suggest the right way to go ahead.The data is in
the
form""Object>Query>mean_grp1>SD_grp1>mean_grp2>SD_grp2""

A>3.890>3.315>1.105>1.395>0.345
B>0.915>1.193>0.334>0.638>0.034
C>2.059>2.155>0.614>1.042>0.159
D>1.372>0.901>0.314>0.384>0.174

What I would like to test is if the "query" belongs to
grp 1 or 2(for all my samples,2000+)and if it can read
out to me teh query belongs to grp_1 or grp_2.
Is there some good examples that I can refer to which
can teach me step wise right from preparing the data
to testing???or would there be someone who can help me
with this problem?

Thanks a lot for your time...look forward to hear some
help and suggestions

Manav

__
R-help@stat.math.ethz.ch 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] plotting box plots on same x

2005-05-27 Thread Uwe Ligges

BJ wrote:
I am trying to construct a graph of 6 box plots of blood pressures. I 
want them to be on a single set of axis and I want the SBP to be ontop 
of the DBP. I have an array bp with the data in it and I tried



Folks, please invest 1 minute of time to rethink whether other people 
will understand your question!


What is "SBP", "DBP", and where are the "6" boxplots from?


a[1,]<-c(145,60,147,62,140,57)


"a" must already be defined here, or we cannot replace a column!


a[2,]<-c(160,75,160,74,160,70)
a[3,]<-c(140,55,140,65,142,55)
boxplot(data.frame(a), main = "Blood Pressures", at=c(1,1,2,2,3,3), 
names=c("sit","","lie","","stand",""))


which is close to what I want, but it gives me a bunch of empty space at 
the end. is there a better way to do this to avoid this?


Well, the first point is that you should write questions that you would 
understand yourself. In a next step you might find someone who is able 
to answer it 



As always, Thank You. ~Erithid


"As always"? Does not sound very enthusiastic ...


Uwe Ligges





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


__
R-help@stat.math.ethz.ch 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] box plots without whiskers

2005-05-27 Thread Uwe Ligges

BJ wrote:
I searched the archives, but couldnt find any way to do this with 
boxplot. Is there a way? Thanks again ~BJ


See ?boxplot and its argument par which points you to ?bxp:

Now, you can do stuff like
  boxplot(1:10, pars=list(staplelty=0, whisklty=0))

Uwe Ligges




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


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

2005-05-27 Thread Uwe Ligges

Josef Eschgfaeller wrote:


Is there a proper function for transforming
a character to a number instead of using

  i=match('c',letters)
  # 3


I'd suggest to use the above if you really mean it. Note that 
"transforming a character to a number" is not well defined, because you 
have to think about encodings and characters at first. See the article 
by Brian Ripley in the most recent issue of R News, for example.


Uwe Ligges



Thanks.
Josef Eschgfäller




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

2005-05-27 Thread vincent

as.numeric()
hih

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

2005-05-27 Thread Tobias Muhlhofer

Josef,

Not sure if this is exactly what you mean, but there is a generic function

as()

to which you can then specify "numeric" as an argument and which then 
coerces stuff into numeric format.


Tobias


Josef Eschgfaeller wrote:


Is there a proper function for transforming
a character to a number instead of using

  i=match('c',letters)
  # 3

Thanks.
Josef Eschgfäller




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


--
**
When Thomas Edison invented the light bulb he tried over 2000
experiments before he got it to work. A young reporter asked
him how it felt to have failed so many times. He said
"I never failed once. I invented the light bulb.
It just happened to be a 2000-step process."

__
R-help@stat.math.ethz.ch 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] box plots without whiskers

2005-05-27 Thread BJ
I searched the archives, but couldnt find any way to do this with 
boxplot. Is there a way? Thanks again ~BJ


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

2005-05-27 Thread Earl F. Glynn
"Luis Ridao Cruz" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> R-help,
>
> I have lloked in the archives found no answer to how to round the line
> joint.
>
> I have usedthe arguments lnd, ljoin in par but I get no differences in
> the plotting.
>
> x=1:10
> par(ljoin="round",lend="round")
> plot(x,sin(x),type="l",lwd=2)

On my Windows 2000 machine using R 2.1.0, par()$ljoin and par()$lend are
already "round" by default.  The par()$lmitre parameter is 10,

Paul Murrell's article "Fonts, lines, and transparency ..." in R News 4/2
(Sept 2004) gives some clues under "The end of the line":
http://cran.stat.auckland.ac.nz/doc/Rnews/Rnews_2004-2.pdf



"All lines are drawn using a particular style for line ends and joins,
though the difference only becomes obvious when lines become thick."



Is it possible that with par()$lmitre at 10, and a lwd=2, you won't see any
difference?



efg

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


[R] plotting box plots on same x

2005-05-27 Thread BJ
I am trying to construct a graph of 6 box plots of blood pressures. I 
want them to be on a single set of axis and I want the SBP to be ontop 
of the DBP. I have an array bp with the data in it and I tried


a[1,]<-c(145,60,147,62,140,57)
a[2,]<-c(160,75,160,74,160,70)
a[3,]<-c(140,55,140,65,142,55)
boxplot(data.frame(a), main = "Blood Pressures", at=c(1,1,2,2,3,3), 
names=c("sit","","lie","","stand",""))


which is close to what I want, but it gives me a bunch of empty space at 
the end. is there a better way to do this to avoid this?


As always, Thank You. ~Erithid

__
R-help@stat.math.ethz.ch 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] xmlAttrs and problems with reading node attributes of XML file (b ug?)

2005-05-27 Thread Tuszynski, Jaroslaw W.
Hi,

Consider the following code:

  require(XML)
  xmlFile = paste( "\n", 
"\n",
"\n",
"\n")
  cat(xmlFile)
  
  a = function(x,...){
cat("Attributes of ", xmlName(x), ": "); 
print(xmlAttrs(x));
cat("\n"); 
NULL
  }
  
  xmlTreeParse(file=xmlFile, asText=TRUE,
handlers=list("startElement"=a) )

And its output:

 
 
 
 

Attributes of  parentFile :   a   b 
 "a" "b" 

Attributes of  mzXML : schemaLocation 
  "c" 
It seems to me that XML parser was able to correctly list all the attributes
of the "parentFile" node but it failed on "mzXML" node.
Am I missusing the functions somehow or is it a bug?
Attribute names in "mzXML" node are part of mzXML file format and can not be
changed (removing all ':' would fix the problem) and I would like to store
than so whan I write mzXML file I have the same header.

Jarek
\===

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



[[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] Chars as numbers

2005-05-27 Thread Josef Eschgfaeller


Is there a proper function for transforming
a character to a number instead of using

  i=match('c',letters)
  # 3

Thanks.
Josef Eschgfäller

--
Josef Eschgfäller
Dipartimento Matematico
Universita' di Ferrara
http://felix.unife.it
__
R-help@stat.math.ethz.ch 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] longitudinal survey data

2005-05-27 Thread h . brunschwig

Thank you for your reply.

Does that mean that in order to take in account the repeated measures I denote
these as another cluster in R?

Dassy


Quoting Thomas Lumley <[EMAIL PROTECTED]>:

> On Thu, 26 May 2005 [EMAIL PROTECTED] wrote:
> 
> >
> > Dear R-Users!
> >
> > Is there a possibility in R to do analyze longitudinal survey data
> (repeated
> > measures in a survey)? I know that for longitudinal data I can use lme()
> to
> > incorporate the correlation structure within individual and I know that
> there is
> > the package survey for analyzing survey data. How can I combine both? I
> am
> > trying to calculate design-based estimates. However, if I use svyglm() from
> the
> > survey package I would ignore the correlation structure of the repeated
> measures.
> >
> 
> You *can* fit regression models to these data with svyglm(). Remember that 
> from a design-based point of view there is no such thing as a correlation 
> structure of repeated measures -- only the sampling is random, not the 
> population data.
> 
> 
> If you *want* to fit mixed models (eg because you are interested in 
> estimating variance components, or perhaps to gain efficiency) then it's 
> quite a bit trickier. You can't just use the sampling weights in lme(). 
> You can correct for the biased sampling if you put the variables that 
> affect the weights in as predictors in the model.  Cluster sampling could 
> perhaps then be modelled as another level of random effect.
> 
> 
>   -thomas
> 
> Thomas Lumley Assoc. Professor, Biostatistics
> [EMAIL PROTECTED] University of Washington, Seattle
>

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


[R] 3D density estimation with library sm - no estimate returned

2005-05-27 Thread Gregory Jefferis
Dear List,

I have been trying to use library sm to do density estimation on a 3D
dataset.  I am using the current MacOS X binary of sm from CRAN.  If I do
this on a 2D dataset, sm.density returns a list including the component
"estimate" which contains the density estimate over a uniform grid.  When
doing this with 3D data, although I get a nice plot (even when I don't ask
for one), the returned list only contains the original data (see below).  It
would appear that the internal function sm.density.3d is returning NULL.
Have I misunderstood what should be returned?  Is this a platform specific
problem?  Can someone suggest a fix or an alternative library for my
application?  Very many thanks for your help,

Greg Jefferis.

> R.version
 _ 
platform powerpc-apple-darwin7.9.0
arch powerpc   
os   darwin7.9.0
system   powerpc, darwin7.9.0
status   Patched   
major2 
minor1.0   
year 2005  
month05
day  12
language R

> library(sm)
> str(sm.density(matrix(rnorm(300),ncol=3),display="none"))
List of 2
 $ data:List of 3
  ..$ x: num [1:100, 1:3]  0.9470 -1.5112  1.0589 -0.0884 -0.1900 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:3] "" "" ""
  ..$ nbins: num 0
  ..$ freq : num [1:100] 1 1 1 1 1 1 1 1 1 1 ...
 $ call: language sm.density(x = matrix(rnorm(300), ncol = 3), display =
"none")
> str(sm.density(matrix(rnorm(200),ncol=2),display="none"))
List of 10
 $ eval.points: num [1:50, 1:2] -2.67 -2.57 -2.47 -2.38 -2.28 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : chr [1:2] "xnew" "ynew"
 $ estimate   : num [1:50, 1:50] 3.76e-05 5.10e-05 7.57e-05 1.22e-04
2.05e-04 ...
 $ h  : Named num [1:2] 0.414 0.512
  ..- attr(*, "names")= chr [1:2] "" ""
 $ h.weights  : num [1:100] 1 1 1 1 1 1 1 1 1 1 ...
 $ weights: num [1:100] 1 1 1 1 1 1 1 1 1 1 ...
 $ se : num [1:50, 1:50] 0.0306 0.0306 0.0306 0.0306 0.0306 ...
 $ upper  : num [1:50, 1:50] 0.00454 0.00468 0.00489 0.00523 0.00571 ...
 $ lower  : num [1:50, 1:50] 0 0 0 0 0 0 0 0 0 0 ...
 $ data   :List of 3
  ..$ x: num [1:100, 1:2] -0.694 -0.192  0.149 -0.718 -0.357 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "" ""
  ..$ nbins: num 0
  ..$ freq : num [1:100] 1 1 1 1 1 1 1 1 1 1 ...
 $ call   : language sm.density(x = matrix(rnorm(200), ncol = 2),
display = "none")
> 



-- 
Gregory Jefferis, PhD   and:
Research Fellow
Department of Zoology   St John's College
Downing Street  Cambridge
Cambridge, CB2 3EJ  CB2 1TP

Tel: +44 (0)1223 336683 +44 (0)1223 339899
Fax: +44 (0)1223 336676 +44 (0)1223 337720

[EMAIL PROTECTED]

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


RE: [R] how to get this kind of binomial distribution simulation number?

2005-05-27 Thread Huntsinger, Reid
rmultinom(n=1,size=500,prob=c(0.3,0.5,0.2))

to get n samples each of size 500 just use the "n=" argument.

Reid Huntsinger


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of luan_sheng
Sent: Friday, May 27, 2005 9:26 AM
To: r-help@stat.math.ethz.ch; R-help@stat.math.ethz.ch
Subject: [R] how to get this kind of binomial distribution simulation
number?




hai, I want to perform a simulation like this:

Suppose that I have one population  ,it's size is 500, is composed of x,y
and z.  The probability of x, y and z is respectively is 0.3, 0.5, 0.2. I
wan to simulate a new same size population based ratio of x, y and z, how
can I get and assess  the number of x, y and z. ?

luan

Key Laboratory for Sustainable Utilization of Marine Fisheries Resources,
Ministry of Agriculture ,Yellow Sea Fisheries Research Institute, Chinese
Academy of Fishery Sciences, Qingdao 266071,China

__

雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱

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

2005-05-27 Thread Koen Pelleriaux
On 5/26/05, Thomas Lumley <[EMAIL PROTECTED]> wrote:

> If you *want* to fit mixed models (eg because you are interested in
> estimating variance components, or perhaps to gain efficiency) then it's
> quite a bit trickier. You can't just use the sampling weights in lme().
> You can correct for the biased sampling if you put the variables that
> affect the weights in as predictors in the model.  Cluster sampling could
> perhaps then be modelled as another level of random effect.


I've been struggeling with case weights (in the case of unequal
selection probabilities) in mixed effects models. Those are not
possible in lme(). Isn't it, however, possible to use case weights in
glmmPQL from MASS?

Koen Pelleriaux
Sociologist
University of Antwerp

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

2005-05-27 Thread Dimitris Rizopoulos

here is a possible solution:

subsets <- function (n, r, s = 1:n) {
   # from V&Rs (2000) S Programming, Springer, p.49
   if (mode(n) != "numeric" || length(n) != 1 || n < 1 || (n%%1) != 
0) stop("bad value of n")
   if (mode(r) != "numeric" || length(r) != 1 || r < 1 || (r%%1) != 
0) stop("bad value of r")
   if (!is.atomic(s) || length(s) < n) stop("s is either non-atomic 
or too short")

   fun <- function(n, r, s)
   if (r <= 0) vector(mode(s), 0)
   else if (r >= n) s[1:n]
   else rbind(cbind(s[1], Recall(n - 1, r - 1, s[-1])), 
Recall(n - 1, r, s[-1]))

   fun(n, r, s)
}
##
x <- c(1, 3, 5, 7, 9)

ind <- subsets(length(x), 2)
apply(matrix(x[ind], nc = ncol(ind)), 1, function(x) 
as.numeric(paste(x, collapse = "")))


ind <- subsets(length(x), 3)
apply(matrix(x[ind], nc = ncol(ind)), 1, function(x) 
as.numeric(paste(x, collapse = "")))




I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: "Clark Allan" <[EMAIL PROTECTED]>

To: 
Sent: Friday, May 27, 2005 3:24 PM
Subject: [R] r: LEXICOGRAPHIC ORDERING



HI all

i have a seemingly simple question.

given a sequence of numbers say, 1,2,3,4,5.

i would like to get all of the possible two number arrangments
(combinations), all 3 number arrangents ... 5 number arrangements
(combinations).

i.e.

in the 2 number case:

12,13,14,15,23,24,25,34,35,45



any ideas?







__
R-help@stat.math.ethz.ch 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 get this kind of binomial distribution simulation number?

2005-05-27 Thread Uwe Ligges
luan_sheng wrote:

> 
> hai, I want to perform a simulation like this:
> 
> Suppose that I have one population  ,it's size is 500, is composed of x,y
> and z.  The probability of x, y and z is respectively is 0.3, 0.5, 0.2. I
> wan to simulate a new same size population based ratio of x, y and z, how
> can I get and assess  the number of x, y and z. ?


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

I guess you are looking for ?table, but your question is much too
unspecific

Uwe Ligges



> luan
> 
> Key Laboratory for Sustainable Utilization of Marine Fisheries Resources,
> Ministry of Agriculture ,Yellow Sea Fisheries Research Institute, Chinese
> Academy of Fishery Sciences, Qingdao 266071,China
> 
> __
> 
> 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱
> 
> __
> R-help@stat.math.ethz.ch 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: LEXICOGRAPHIC ORDERING

2005-05-27 Thread Uwe Ligges

Clark Allan wrote:

HI all

i have a seemingly simple question.

given a sequence of numbers say, 1,2,3,4,5.

i would like to get all of the possible two number arrangments
(combinations), all 3 number arrangents ... 5 number arrangements
(combinations).

i.e. 


in the 2 number case:

12,13,14,15,23,24,25,34,35,45


  library(gtools)
  combinations(5, 2) %*% c(10, 1)

Uwe Ligges





any ideas?




__
R-help@stat.math.ethz.ch 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] Soil texture triangle in R?

2005-05-27 Thread Sander Oom

Hi Jari,

I assume this has been superseded by the ternaryplot{vcd} function!?

Thanks,

Sander.

Jari Oksanen wrote:
> Sander,
>
> Just a quick note before I go to the field.
>
> I attach a tri.R file for drawing ternary plots. The base function was
> posted to R News someday. One thing that I added was option to plot
> nothing (type="n") plus (invisible) return of plotting coordinates. This
> means that you can take the coordinates for drawing segments (in
> original values), feed them through this functions, and you get
> translated coordinates to use ordinary segments or lines commands to
> overlay your lines into an existing ternary plot.
>
> We used this in an Applied Vegetation Science paper (Hellström as the
> first author) to overlay arrows onto ternary plots.
>
> cheers, jari oksanen
>
>
> 
>
> "tri" <-
> function(a, f, m, symb = 2, grid = F, ...)
> {
> ta <- paste(substitute(a))
> tf <- paste(substitute(f))
> tm <- paste(substitute(m))
>
> tot <- 100/(a + f +m)
> b <- f * tot
> y <- b * .878
> x <- m * tot + b/2
> par(pty = "s")
> oldcol <- par("col")
> plot(x, y, axes = F, xlab = "", ylab = "", xlim = c(-10, 110), ylim
>  = c(-10, 110), type = "n", ...)
> points(x,y,pch=symb)
> par(col = oldcol)
> trigrid(grid)
> text(-5, -5, ta)
> text(105, -5, tm)
> text(50, 93, tf)
> par(pty = "m")
> invisible(cbind(x,y))
> }
>

__
R-help@stat.math.ethz.ch 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] Soil texture triangle in R?

2005-05-27 Thread Sander Oom

Hi Jim,

This looks impressive! It gives me the 'background' graph. However, I'm 
not sure how I can use this function to plot my soil texture values! Can 
you explain?


I would like to be able to plot my soil texture samples in the same 
graph as the one your function plots.


Maybe I should try to figure out how to replicate your code inside a 
ternaryplot{vcd} call.


Cheers,

Sander.

Jim Lemon wrote:
> Sander Oom wrote:
>> Dear R users,
>>
>> has anybody made an attempt to create the soil texture triangle graph
>> in R? For an example see here:
>>
>> http://www.teachingkate.org/images/soiltria.gif
>>
>> I would like to get the lines in black and texture labels in gray to
>> allow for plotting my texture results on top.
>>
>> Any examples or suggestions are very welcome!
>>
> It's not too hard to write a plot function to do this, but I'm not sure
> whether this will be what you want. Anyway, try it out.
>
> Jim
>
> 
>
> soil.triangle<-function() {
>  oldpar<-par(no.readonly=TRUE)
>  plot(0:1,type="n",axes=FALSE,xlim=c(0,1.1),ylim=c(0,1),
>   main="Soil Triangle",xlab="",ylab="")
>  # first draw the triangle
>  x1<-c(0,0,0.5)
>  sin60<-sin(pi/3)
>  x2<-c(1,0.5,1)
>  y1<-c(0,0,sin60)
>  y2<-c(0,sin60,0)
>  segments(x1,y1,x2,y2)
>  # now the bottom internal ticks
>  x1<-seq(0.1,0.9,by=0.1)
>  x2<-x1
>  y1<-rep(0,9)
>  y2<-rep(0.02,9)
>  segments(x1,y1,x2,y2)
>  text(x1,y1-0.03,as.character(rev(seq(10,90,by=10
>  # now the left internal ticks
>  y1<-x1*sin60
>  x1<-x1*0.5
>  x2<-x1+0.02*sin60
>  y2<-y1-0.02*0.5
>  segments(x1,y1,x2,y2)
>  text(x1-0.03,y1+0.015,as.character(seq(10,90,by=10)))
>  x1<-rev(x1+0.5-0.02*sin60)
>  x2<-x1+0.02*sin60
>  segments(x1,y2,x2,y1)
>  text(x2+0.03,y1+0.015,as.character(rev(seq(10,90,by=10
>  text(0.5,0.9,"100% clay")
>  par(xpd=TRUE)
>  text(-0.1,0,"100% sand")
>  text(1.1,0,"100% loam")
>  text(0.07,0.43,"percent clay")
>  text(0.93,0.43,"percent silt")
>  text(0.5,-0.1,"percent sand")
>  # boundary of clay with extensions
>  x1<-c(0.275,0.35,0.6)
>  x2<-c(0.4,0.79,0.7)
>  y1<-c(0.55*sin60,0.41*sin60,0.41*sin60)
>  y2<-c(0.285*sin60,0.41*sin60,0.6*sin60)
>  segments(x1,y1,x2,y2)
>  text(0.5,0.57,"Clay")
>  # lower bound of clay loam & silty divider
>  x1<-c(0.4,0.68)
>  x2<-c(0.86,0.6)
>  y1<-c(0.285*sin60,0.285*sin60)
>  y2<-c(0.285*sin60,0.41*sin60)
>  segments(x1,y1,x2,y2)
>  text(0.7,0.49*sin60,"Silty")
>  text(0.7,0.44*sin60,"clay")
>  text(0.73,0.37*sin60,"Silty clay")
>  text(0.73,0.33*sin60,"loam")
>  text(0.5,0.35*sin60,"Clay loam")
>  x1<-c(0.185,0.1,0.37)
>  x2<-c(0.36,0.37,0.4)
>  y1<-c(0.37*sin60,0.2*sin60,0.2*sin60)
>  y2<-c(0.37*sin60,0.2*sin60,0.285*sin60)
>  segments(x1,y1,x2,y2)
>  text(0.27,0.43*sin60,"Sandy")
>  text(0.27,0.39*sin60,"clay")
>  text(0.27,0.3*sin60,"Sandy clay")
>  text(0.27,0.26*sin60,"loam")
>  # sand corner
>  x1<-c(0.05,0.075)
>  x2<-c(0.12,0.3)
>  y1<-c(0.1*sin60,0.15*sin60)
>  y2<-c(0,0)
>  segments(x1,y1,x2,y2)
>  text(0.25,0.13*sin60,"Sandy loam")
>  text(0.13,0.075*sin60,"Loamy")
>  text(0.15,0.035*sin60,"sand")
>  text(0.055,0.021,"Sand")
>  x1<-c(0.37,0.42,0.5,0.8,0.86)
>  x2<-c(0.42,0.54,0.65,0.86,0.94)
>  y1<-c(0.2*sin60,0.08*sin60,0,0,0.12*sin60)
>  y2<-c(0.08*sin60,0.08*sin60,0.285*sin60,0.12*sin60,0.12*sin60)
>  segments(x1,y1,x2,y2)
>  text(0.49,0.18*sin60,"Loam")
>  text(0.72,0.15*sin60,"Silt loam")
>  text(0.9,0.06*sin60,"Silt")
>  par(oldpar)
> }

__
R-help@stat.math.ethz.ch 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 get this kind of binomial distribution simulation number?

2005-05-27 Thread luan_sheng


hai, I want to perform a simulation like this:

Suppose that I have one population  ,it's size is 500, is composed of x,y
and z.  The probability of x, y and z is respectively is 0.3, 0.5, 0.2. I
wan to simulate a new same size population based ratio of x, y and z, how
can I get and assess  the number of x, y and z. ?

luan

Key Laboratory for Sustainable Utilization of Marine Fisheries Resources,
Ministry of Agriculture ,Yellow Sea Fisheries Research Institute, Chinese
Academy of Fishery Sciences, Qingdao 266071,China

__

雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱

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

2005-05-27 Thread Clark Allan
HI all

i have a seemingly simple question.

given a sequence of numbers say, 1,2,3,4,5.

i would like to get all of the possible two number arrangments
(combinations), all 3 number arrangents ... 5 number arrangements
(combinations).

i.e. 

in the 2 number case:

12,13,14,15,23,24,25,34,35,45



any ideas?__
R-help@stat.math.ethz.ch 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] Round a line

2005-05-27 Thread Uwe Ligges

Luis Ridao Cruz wrote:


R-help,

I have lloked in the archives found no answer to how to round the line
joint.

I have usedthe arguments lnd, ljoin in par but I get no differences in
the plotting.

x=1:10
par(ljoin="round",lend="round")
plot(x,sin(x),type="l",lwd=2)


Any suggestions?



Well, round is the default! You have to zoom in or make even thicker 
lines. Hence you might want to try out the folowing to see differences:


  x <- 1:10
  par(mfrow = c(1, 2))
  plot(x, sin(x), type="l", lwd=10)
  par(ljoin="mitre", lend="butt")
  plot(x, sin(x), type="l", lwd=10)

Uwe Ligges




I run on a Windows XP machine.



version


 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.0
year 2005   
month04 
day  18 
language R  


Thank you in advance

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

2005-05-27 Thread Spencer Graves
	  What kind of nonlinear restriction?  Can you solve for one or more of 
the parameters in terms of the other(s) [either directly or implicitly]? 
 If yes, then let


  fit1 <- nls(... full model ... )
  fit2 <- nls(... restricted model ...)

  anova(fit1, fit2)

	  If my memory is correct, Doug Bates, in his PhD dissertation ~25 
years ago, decomposed the nonlinearity in nonlinear least squares into 
"intrinsic curvature" and "parameter effects curvature".  The Wald test 
is distorted by both sources types of nonlinearity, but the standard 
likelihood ratio anova is affected only by "intrinsic curvature", and 
not "parameter effects" (provided the algorithm actually converges 
appropriately).  Moreover, by reanalyzing a fair number of published 
data sets, Doug demostrated that in a nearly all practical application, 
the parameter effects curvature was much larger than the intrinsic 
curvature, and the latter was close to negligible in nearly all cases, 
while the parameter effects curvature was often of sufficient magnitude 
to substantively distort the answers.  For more information, see Bates & 
Watts (1988) Nonlinear Regression Analysis and Its Applications (Wiley).


  hope this helps.  
  spencer graves

Jacho-Chavez,DT (pgr) wrote:


Dear all,

I'm interested in testing 2 nonlinear restrictions on coefficients of a nls object. Is there a 
package for doing this? Something in the lines of `test(nls object, res=c("res 
1","res 2"),...)'
I only found the function delta.method in the alr3 library that calculates the 
se of a singleton nonlinear restriction of a nls object using the delta method.

Thanks in advanced for your help and suggestions.


David

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


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


Re: [R] Postscript

2005-05-27 Thread Uwe Ligges

Philippe Lamy wrote:

Hi,

I would like to create a multi-page postscript file. How can I do that in R ? Is
it possible ?



Yes, simply draw more than one plot. See ?postscript and its argument 
"onefile", which already defaults to TRUE.


Uwe Ligges



Thanks for help.

Philippe

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

2005-05-27 Thread James W. MacDonald

Spencer Graves wrote:


Hi, Laura:

  Have you considered "regsubsets" in library(leaps)?  Also, have 
you done an R site search "www.r-project.org" -> search -> "R site 
search" for something like "all subsets regression"?


Or much simpler if you are running R-2.1.0, use RSiteSearch("all subsets 
regression")


Best,

Jim

--
James W. MacDonald
Affymetrix and cDNA Microarray Facility
University of Michigan
Comprehensive Cancer Center
1500 E. Medical Center Drive
Ann Arbor MI 48109

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

2005-05-27 Thread Spencer Graves

Hi, Laura:

	  Have you considered "regsubsets" in library(leaps)?  Also, have you 
done an R site search "www.r-project.org" -> search -> "R site search" 
for something like "all subsets regression"?


	  Consistent with Frank Harrell's comment, comments, I suggest you 
randomly permute your response variable a hundred or a thousand times 
and count how many times the procedure finds a non-null model.  This 
might help you calibrate the procedure.  The archives include an email 
from Frank Harrell citing two relevant articles.


  Hope this helps.
  spencer graves

Frank E Harrell Jr wrote:


Laura Holt wrote:


Hi again!

I have a data.frame with the columns y, x1, x2, x3.

I would like to fit linear models with one variable at a time,
then 2 variables at a time, and then 3.

Makes me think of a power set.



Makes me think of irreproducible results if you use the output to select 
a single model  :-)


Frank Harrell



Anyhow, is there a function to produce the right hand side of the 
formulas, please?


thanks,
Laura Holt
mailto: [EMAIL PROTECTED]
R Version 2.1.0 Windows





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

2005-05-27 Thread Philippe Lamy

Hi,

I would like to create a multi-page postscript file. How can I do that in R ? Is
it possible ?

Thanks for help.

Philippe

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

2005-05-27 Thread Luis Ridao Cruz
R-help,

I have lloked in the archives found no answer to how to round the line
joint.

I have usedthe arguments lnd, ljoin in par but I get no differences in
the plotting.

x=1:10
par(ljoin="round",lend="round")
plot(x,sin(x),type="l",lwd=2)


Any suggestions?

I run on a Windows XP machine.

> version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.0
year 2005   
month04 
day  18 
language R  

Thank you in advance

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

2005-05-27 Thread Ajay Narottam Shah
> well ESS has such a facility.
> 
> However, I think Mathematica has a super scheme: unbalanced brackets 
> show up
> in red, making them obvious.
> 
> This is particularly good for spotting wrongly interleaved brackets, as 
> in
> 
> ([  blah di blah  )]
> 
> 
> 
> in which case both opening braces are highlighted in red: and the 
> system won't
> accept a newline until the closures are all correctly matched.
> 
> Would anyone else find such a thing useful?
> 
> Could the ESS team make something like this happen?

ess is great, but I was asking about the R commandline. I tend to
write a lot of stuff on the fly at the R commandline.

Yes, colours are a great way to deal with this, and this feature
should ideally be in ESS.

-- 
Ajay Shah   Consultant
[EMAIL PROTECTED]  Department of Economic Affairs
http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi

__
R-help@stat.math.ethz.ch 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] Function environments lm() weights

2005-05-27 Thread Tobias Muhlhofer
I am writing a function of weighted regression, as a procedure for 
heteroskedasticity.


The function runs an auxiliary regression whose fitted values I assign 
to fit, and then I go:


w <- 1/(exp(fit/2))

## Rerun the old regression ##
if(gls) {
  wtd.model <- glm(model, weights=w)
}

if(!gls) {
  wtd.model <- lm(model, weights=w, x=TRUE)
}

In this version, R complains that it can't find w. How can I tell it to 
look for w in the function's environment, rather than in environment 1 
or whatever?


An easy workaround, of course, is to superassign w and remove it 
afterwards, but that's a little messy, in case the user already has a 
variable called w in his environment.


Thanks,
Tobias Muhlhofer

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

2005-05-27 Thread Frank E Harrell Jr

Laura Holt wrote:

Hi again!

I have a data.frame with the columns y, x1, x2, x3.

I would like to fit linear models with one variable at a time,
then 2 variables at a time, and then 3.

Makes me think of a power set.


Makes me think of irreproducible results if you use the output to select 
a single model  :-)


Frank Harrell



Anyhow, is there a function to produce the right hand side of the 
formulas, please?


thanks,
Laura Holt
mailto: [EMAIL PROTECTED]
R Version 2.1.0 Windows


--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

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


Re: [R] R commandline editor question

2005-05-27 Thread Robin Hankin

Hi  Ajay

well ESS has such a facility.

However, I think Mathematica has a super scheme: unbalanced brackets 
show up

in red, making them obvious.

This is particularly good for spotting wrongly interleaved brackets, as 
in


([  blah di blah  )]



in which case both opening braces are highlighted in red: and the 
system won't

accept a newline until the closures are all correctly matched.

Would anyone else find such a thing useful?

Could the ESS team make something like this happen?





On May 27, 2005, at 12:11 pm, Ajay Narottam Shah wrote:


I am using R 2.1 on Apple OS X.

When I get the ">" prompt, I find it works well with emacs commandline
editing. Keys like M-f C-k etc. work fine.

The one thing that I really yearn for, which is missing, is bracket
matching When I am doing something which ends in  it is really
useful to have emacs or vi-style bracket matching, so as to be able
to visually keep track of whether I have the correct matching
brackets, whether ( or { or [.

I'm sure this is possible. I will be most grateful if someone will
show the way :-) Thanks,

--
Ajay Shah   Consultant
[EMAIL PROTECTED]  Department of Economic Affairs
http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi

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




--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
 tel  023-8059-7743

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

2005-05-27 Thread Ajay Narottam Shah
I am using R 2.1 on Apple OS X.

When I get the ">" prompt, I find it works well with emacs commandline
editing. Keys like M-f C-k etc. work fine.

The one thing that I really yearn for, which is missing, is bracket
matching When I am doing something which ends in  it is really
useful to have emacs or vi-style bracket matching, so as to be able
to visually keep track of whether I have the correct matching
brackets, whether ( or { or [.

I'm sure this is possible. I will be most grateful if someone will
show the way :-) Thanks,

-- 
Ajay Shah   Consultant
[EMAIL PROTECTED]  Department of Economic Affairs
http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi

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

2005-05-27 Thread zjao yana
Hello,
I'm a beginner to use R. 
When use cancor to analysis two data set X,Y, for
example:
 can<-cancor(X, Y)
 then 5 components are returned, that is cor, xcoef,
ycoef, xcentre, ycentre; 

The explained variance can be calculated by X %*%
can$xcoef or Y %*% can$ycoef, but how to alculate the
canonical maps of field X and Y? 
Thanks!

yana

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


[R] Testing Nonlinear Restrictions

2005-05-27 Thread Jacho-Chavez,DT (pgr)
Dear all,

I'm interested in testing 2 nonlinear restrictions on coefficients of a nls 
object. Is there a package for doing this? Something in the lines of `test(nls 
object, res=c("res 1","res 2"),...)'
I only found the function delta.method in the alr3 library that calculates the 
se of a singleton nonlinear restriction of a nls object using the delta method.

Thanks in advanced for your help and suggestions.


David

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


Re: [R] Simplify formula for heterogeneity

2005-05-27 Thread Stefaan Lhermitte
Thank you very much Ted! I have been looking at your simplification for 
more then an hour, but I don't see how you did it.
Could you perhaps, if it is not to much work, explain me how you reduced 
H? It would help me to understand what I am realy doing.


Looking at the result, it seems indeed that H does add more information 
than sd already did. Intuitively I thought the square of the sum of all 
possible differences would not be related to the standard deviation. 
Looking at your result it seems it is related by a factor sqrt(2*(n-1)) 
so there is no special point in calculating  H and I know I cannot trust 
my intuition anymore.


Thanks again!

Kind regards,
Stef

__
R-help@stat.math.ethz.ch 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] Contingency tables from data.frames

2005-05-27 Thread Jose Claudio Faria

The final version with the help of Gabor Grotendieck (thanks Gabor, very much!)

###
#   EasieR - Package  #
###

# Common function
er.make.table <- function(x,
  start,
  end,
  h,
  right) {
  # Absolut frequency
  f <- table(cut(x, br=seq(start, end, h), right=right))

  # Relative frequency
  fr <- f/length(x)

  # Relative frequency, %
  frP <- 100*(f/length(x))

  # Cumulative frequency
  fac <- cumsum(f)

  # Cumulative frequency, %
  facP <<- 100*(cumsum(f/length(x)))

  fi   <- round(f, 2)
  fr   <- round(as.numeric(fr), 2)
  frP  <- round(as.numeric(frP), 2)
  fac  <- round(as.numeric(fac), 2)
  facP <- round(as.numeric(facP),2)

  # Make final table
  res <- data.frame(fi, fr, frP, fac, facP)
  names(res) <- c('Class limits', 'fi', 'fr', 'fr(%)', 'fac', 'fac(%)')
  return(res)

}

#With Gabor Grotendieck suggestions (thanks Gabor, very much!)
er.table <- function(x, ...) UseMethod("er.table")

er.table.default <- function(x,
 k,
 start,
 end,
 h,
 breaks=c('Sturges', 'Scott', 'FD'),
 right=FALSE) {

  #User define nothing or not 'x' isn't numeric -> stop
  stopifnot(is.numeric(x))

  #User define only 'x'
  #(x, {k, start, end, h}, [breaks, right])
  if (missing(k) && missing(start) && missing(end) && missing(h) ){

x <- na.omit(x)

brk <- match.arg(breaks)
switch(brk,
   Sturges = k <- nclass.Sturges(x),
   Scott   = k <- nclass.scott(x),
   FD  = k <- nclass.FD(x))

tmp   <- range(x)
start <- tmp[1] - abs(tmp[2])/100
end   <- tmp[2] + abs(tmp[2])/100
R <- end-start
h <- R/k

  }

  #User define 'x' and 'k'
  #(x, k, {start, end, h}, [breaks, right])
  else if (missing(start) && missing(end) && missing(h)) {

stopifnot(length(k) >= 1)

x <- na.omit(x)

tmp   <- range(x)
start <- tmp[1] - abs(tmp[2])/100
end   <- tmp[2] + abs(tmp[2])/100
R <- end-start
h <- R/abs(k)

  }

  #User define 'x', 'start' and 'end'
  #(x, {k,} start, end, {h,} [breaks, right])
  else if (missing(k) && missing(h)) {

stopifnot(length(start) >= 1, length(end) >=1)

x <- na.omit(x)

tmp <- range(x)
R   <- end-start
k   <- sqrt(abs(R))
if (k < 5)  k <- 5 #min value of k
h   <- R/k

  }

  #User define 'x', 'start', 'end' and 'h'
  #(x, {k,} start, end, h, [breaks, right])
  else if (missing(k)) {

stopifnot(length(start) >= 1, length(end) >= 1, length(h) >= 1)
x <- na.omit(x)

  }

  else stop('Error, please, see the function sintax!')

  tbl <- er.make.table(x, start, end, h, right)
  return(tbl)

}

er.table.data.frame <- function(df,
k,
breaks=c('Sturges', 'Scott', 'FD'),
right=FALSE) {

  stopifnot(is.data.frame(df))

  tmpList <- list()
  logCol  <- sapply(df, is.numeric)

  for (i in 1:ncol(df)) {

if (logCol[i]) {

  x <- as.matrix(df[ ,i])
  x <- na.omit(x)

  #User define only x and/or 'breaks'
  #(x, {k,}[breaks, right])
  if (missing(k)) {

brk <- match.arg(breaks)
switch(brk,
   Sturges = k <- nclass.Sturges(x),
   Scott   = k <- nclass.scott(x),
   FD  = k <- nclass.FD(x))

tmp   <- range(x)
start <- tmp[1] - abs(tmp[2])/100
end   <- tmp[2] + abs(tmp[2])/100
R <- end-start
h <- R/k

  }

  #User define 'x' and 'k'
  #(x, k,[breaks, right])
  else {

tmp   <- range(x)
start <- tmp[1] - abs(tmp[2])/100
end   <- tmp[2] + abs(tmp[2])/100
R <- end-start
h <- R/abs(k)

  }

  tbl <- er.make.table(x, start, end, h, right)
  tmpList <- c(tmpList, list(tbl))

}

  }

  valCol <- logCol[logCol]
  names(tmpList) <- names(valCol)
  return(tmpList)

}

Best,
--
Jose Claudio Faria
Brasil/Bahia/UESC/DCET
Estatistica Experimental/Prof. Adjunto
mails:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
tel: 73-3634.2779

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


[R] mixed-integer optimisation

2005-05-27 Thread John Marsland
Does anybody know of a R package to solve mixed-integer quadratic  
optimisations with constraints?

Alternatively is anybody working with an R interface to ILOG CPLEX  
which seems to be the 'best' commercial product in this area?

Finally, is there any relationship between the R-project and AMPL - a  
modelling language for mathematical programming  -  
which also originated in Bell Labs?

Regards,

John Marsland
[[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] Soil texture triangle in R?

2005-05-27 Thread Sander Oom

Dear R users,

has anybody made an attempt to create the soil texture triangle graph in 
R? For an example see here:


http://www.teachingkate.org/images/soiltria.gif

I would like to get the lines in black and texture labels in gray to 
allow for plotting my texture results on top.


Any examples or suggestions are very welcome!

Thanks in advance,

Sander.

--

Dr Sander P. Oom
Animal, Plant and Environmental Sciences,
University of the Witwatersrand
Private Bag 3, Wits 2050, South Africa
Tel (work)  +27 (0)11 717 64 04
Tel (home)  +27 (0)18 297 44 51
Fax +27 (0)18 299 24 64
Email   [EMAIL PROTECTED]
Web www.oomvanlieshout.net/sander

__
R-help@stat.math.ethz.ch 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] Accounting for clustered data in Rpart or Mvpart

2005-05-27 Thread Luwis Tapiwa Diya
I am working on data that is in clusters (eg events from persons in
the family).So I have a clustered data set up and would like to build
a tree(regression /classification tree) taking into account this
clustered nature of the data.

Do anybody know how to do this or maybe the code to take into account
the clustered data in rpart

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