Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8123399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:10:20+00:00 2026-06-06T06:10:20+00:00

I am trying to plot this kind of behaviour of a data set. I

  • 0

I am trying to plot this kind of behaviour of a data set. I have tried with Ecdf()

library(Hmisc)
dd<-read.table('critical.1.dat',head=F)
cdf<-Ecdf(dd$V1)
df<-hist(dd$V1)
ll<-((1-cdf$y[df$mids])/(df$density))
plot(df$mids,ll)

and seems all goes fine. After this answer i have tried with ecdf()

dd<-read.table('critical.1.dat',head=F)
cdf<-ecdf(dd$V1)
df<-hist(dd$V1)
ll<-(1-cdf(df$mids))/df$density
plot(df$mids,ll)

and the outcome looks very different Ecdf().

Where is my mistake? why they looks me different?

First Edit: My actual code is

library(Hmisc)
dd<-read.table('critical.1.dat',head=F)

cdf<-Ecdf(dd$V1)
ccdf<-ecdf(dd$V1)

df<-hist(dd$V1)

ll<-((1-cdf$y[df$mids])/(df$density))
llc<-(1-ccdf(df$mids))/df$density

par( mfrow = c( 2, 1 ) )

plot(df$mids,ll,ylab='Ecdf()')
plot(df$mids,llc,ylab='ecdf()')
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:10:22+00:00Added an answer on June 6, 2026 at 6:10 am

    Ecdf returns a list while ecdf returns a function:

    > set.seed(1)
    > ch <- rnorm(1000, 200, 40)
    > Echol <- Ecdf(ch, xlab="Serum Cholesterol")
    > e.chol <- ecdf(ch)
    > str(Echol)
    List of 2
     $ x: num [1:1001] 79.7 79.7 80.1 82.4 84.4 ...
     $ y: num [1:1001] 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 ...
     - attr(*, "N")=List of 2
      ..$ n: num 1000
      ..$ m: num 0
    
    > e.chol <- ecdf(ch)   
    > str(e.chol)
    function (v)  
     - attr(*, "class")= chr [1:3] "ecdf" "stepfun" "function"
     - attr(*, "call")= language ecdf(ch)
    

    To summarize the comments below … the list representation of an ECDF needs a different access method than the functional representation. So at least one of the the mistakes was in using df$mids in cdf$y[df$mids] when processing the return object from Ecdf(). The beauty of the base::ecdf function is that it can process an X value directly, whereas the list representation will need to use a function like findInterval() to construct an appropriate index.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to plot some test data (show at the end of this
I'm currently trying to use the core-plot library to graph some data I get
I am kind of trying to get the flow of core plot. I have
I'm trying to plot the phase of an FFT using MATLAB. I have this
I am trying to follow this tutorial ( Using-core-plot-in-an-iphone-application ). When I try to
I am trying plot data sets consisting of 3 coordinates: X-coordinate, x-coordinate and the
I am trying to plot a graph using gnuplot. I have six text files.
I am trying to plot some data using pylab scatter function. I'm using pylab.scatter(X,
I'm trying to plot heatmap in ggplot2 using csv data following casbon's solution in
Well, I'm trying to plot this graphic: gnuplot> plot exp(-x) t 'MB' w l

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.