Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
598 views
in Technique[技术] by (71.8m points)

r - plot of an empirical cumulative distribution function (was Percentile plot)

How can I generate a plot like the following in R.

enter image description here

It shows the percent of transactions (x) for a given response time (y), see my own answer below for my own go at it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Methinks you want a plot of an empirical cumulative distribution function.

So take a look at the documentation for ecdf() as well as the more featureful Ecdf() in the CRAN package Hmisc.

Hmisc Ecdf example: ExecTm array of execution times, HttpProvCall array of time it took to call downstream system and we compare the time we spend with the downstream system with percentiles

> library(Hmisc)
> x <- c(ExecTm,ExecTm-HttpProvCall)
> g <- c(rep('ExecTm',length(ExecTm)),rep('ExecTm-HttpProvCall',length(ExecTm)))
> Ecdf(x, group=g, xlab='Test Results', 
+     label.curves=list(keys=1:2),q=c(.90,.95,.98))

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...