Skip to content
Back to formatted view

Raw Message

Message-ID: <CADv2QyFzYbSwY+9sQaq7Nfy6r9K5+oHMAh5jVB6qjEOnUagncA@mail.gmail.com>
Date: 2011-10-16T19:53:15Z
From: Dennis Murphy
Subject: ecdf
In-Reply-To: <CAJ7zG7EBuQ8jVpwQT9P10cRQ98O4aMVzT6-9kusLqDTfx6vX3w@mail.gmail.com>

Hi:

I don't understand what you're attempting to do. Wouldn't courseid be
a categorical variable with a numeric label? If that is so, why are
you trying to compute an EDF? An EDF computes cumulative relative
frequency of a random variable, which by definition is numeric. If we
were talking about EDFs for a distribution of student course grades on
a numeric point system by course, that would make some sense, but I
don't see how the course IDs themselves qualify as being on an
interval scale of measurement. Could you clarify your intent?

Dennis

On Sun, Oct 16, 2011 at 8:31 AM, gj <gawesh at gmail.com> wrote:
> Hi,
> Newbie here. I read the R for Beginners but i still don't get this.
>
> I have the following data (this is just an example) in a CSV file:
>
> ? ?courseid numstudents
> ? ? ? ?101 ? ? ? ? 209
> ? ? ? ?141 ? ? ? ? ?13
> ? ? ? ?246 ? ? ? ? 140
> ? ? ? ?263 ? ? ? ? ? 8
> ? ? ? ?321 ? ? ? ? ?10
> ? ? ? ?361 ? ? ? ? ?10
> ? ? ? ?364 ? ? ? ? ?28
> ? ? ? ?365 ? ? ? ? ?25
> ? ? ? ?366 ? ? ? ? ?23
> ? ? ? ?367 ? ? ? ? ?34
>
> I load my data using:
>
> fs<-read.csv(file="C:\\num_students_inallmodules.csv",header=T, sep=',')
>
> I want to get the ecdf. So, I looked at the ?ecdf which says usage:ecdf(x)
>
> So I expected ecdf(fs$numstudents) to work
>
> Instead it just returned:
> Call: ecdf(fs$numstudents)
> ?x[1:210] = ? ? ?1, ? ? ?2, ? ? ?3, ?..., ? 3717, ? 4538
>
> After Googling, got this to work:
> ecdf(fs$numstudents)(unique(fs$numstudents))
>
> But I don't understand why if the ?ecdf says usage is ecdf(x) ... I
> need to use ecdf(fs$numstudents)(unique(fs$numstudents)) to get this
> to work?
>
> Can somebody explain this to me?
>
> Regards
> Gawesh
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>