On May 7, 2013, at 11:15 PM, jpm miao wrote:
> Let me revise the data as below.
> It is survey data. The respondent must answer the outlook of the oil price, say, in three months. Respondent A might answer that the price will be in the 80-90 interval, while B might answer 100-110. I think there should be a function that finds out the mean and the median of the data with the assumption that all data points inside each interval are evenly distributed. Are there such functions in R?
>
I doubt so. You could always make one up and my suggestion would be to assume that all the items were at the midpoint. (It would be "good exercise" for developing your R skills.) First step, constructing a reproducible example to work on.
--
David.
>
>
> 70-80 4
> 80-90 5
> 90-100 8
> 100-110 7
> 110-120 3
>
>
>
> 2013/5/8 David Winsemius
>
> On May 7, 2013, at 8:40 PM, jpm miao wrote:
>
> > Is there a function in R that calculate the mean and median for a grouped
> > data?
> > For example, a survey shows the oil price outlook in the future. How can I
> > calculate the mean/median?
> > (Of course, I understand that the groups "below 80" and "above 110" must be
> > defined more specifically)
> >
> > below 80 4 80-90 5 90-100 8 100-110 7 above 110 3
> >
>
> Why would all groups need to be defined more specifically? How do we know whether items in the 80-90 range are evenly distributed? .... could be 80, 81, 82, 84, 85 or all 89's.
>
> David Winsemius
> Alameda, CA, USA
>
>
David Winsemius
Alameda, CA, USA
[[alternative HTML version deleted]]