[R] Fraction ECDF
Duncan Murdoch
murdoch at stats.uwo.ca
Tue Jul 10 17:03:48 CEST 2007
On 7/10/2007 10:36 AM, livia wrote:
> Hi all,
>
> I would like to plot part of the emperical CDF. Suppose the variable is x, I
> just need the part when x>1,therefore, I am using the following codes.
>
> tail <- x>1
> plot(ecdf(x[tail]), do.points=FALSE, verticals=TRUE)
>
> The "x" value starts from 1, but the yaxs still begins from 0, not the
> corresponding value when "x" is 1. How can I make it match?
>
> Could anyone give me some advice? Many thanks.
Rather than subsetting the x, I'd just use xlim and ylim arguments to
plot() to change the range. For example,
plot(ecdf(x), do.points=FALSE, verticals=TRUE, xlim=c(1, max(x)),
ylim=c(1-sum(x>1)/length(x), 1))
Duncan Murdoch
More information about the R-help
mailing list