[R] trellis help

2006-03-19 Thread Alexander Nervedi
apoplogies for the repeat post - i just realized i forgot to change the 
subject line


I dont as yet fully understand how trellis works. Advice would be much 
appreciated.

I have a factor variable (2 levels) and a continuous variable and I am able 
to plot a histogram of the frequencies of the continuous variable for each 
level of the factor variable using :

histogram( ~ e.ps | vdc, data = est.prop.score,
xlab = Propensity Score, type = 
density,
 panel = function(x, ...) {
  panel.histogram(x, ...)
  panel.mathdensity(dmath = dnorm, col = 
black,
args = list(mean=mean(x),sd=sd(x)))

The two distributions overlap over an area and I would like to draw vertical 
lines to demark the lower tail of the distribution which has a higher 
median, and the right tail of the distribution with lower  median.

Any suggestion would be really helpful.
thanks

ul-nadi

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

2006-03-19 Thread Deepayan Sarkar
On 3/19/06, Alexander Nervedi [EMAIL PROTECTED] wrote:
 apoplogies for the repeat post - i just realized i forgot to change the
 subject line


 I dont as yet fully understand how trellis works. Advice would be much
 appreciated.

 I have a factor variable (2 levels) and a continuous variable and I am able
 to plot a histogram of the frequencies of the continuous variable for each
 level of the factor variable using :

 histogram( ~ e.ps | vdc, data = est.prop.score,
 xlab = Propensity Score, type =
 density,
  panel = function(x, ...) {
   panel.histogram(x, ...)
   panel.mathdensity(dmath = dnorm, col =
 black,
 args = list(mean=mean(x),sd=sd(x)))

 The two distributions overlap over an area and I would like to draw vertical
 lines to demark the lower tail of the distribution which has a higher
 median, and the right tail of the distribution with lower  median.

You can compute these quantities beforehand and add them using
panel.abline (inside your panel function). It's not entirely
impossible to do it in a single histogram call, but that won't look
pretty.

Deepayan

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