2

I have a very basic grasp of stats, and a very basic grasp of R so please bear with me.

I have survey data which shows the weekly expenditure of a number of respondents. I have put this into a histogram, and have plotted a density function as well. So far so good.

How do I then apply this curve to a larger population? Say that I know that the population of my town is 25000. How can I apply that to the density curve to arrive at a new histogram and the data table behind it?

I hope this is an appropriate question, thank you.

1 Answers1

0

It is not exactly clear what you want to do.

If you only have data on the sample then the best estimate that you have of the histogram/density for the population is the histogram/density of the sample, the only difference would be the scale on the y-axis. Personally I think the tick marks on the y axis should be ignored (and my preference would be that the tick labels were never plotted) since it is really the shape of the histogram/density that is important and the tick labels can change based on things that don't change the meaning. If you really feel the need to have the tick labels represent population values then see the axis function.

If you want something more than this then give us a better description of what you are trying to accomplish.

Greg Snow
  • 48,497
  • 6
  • 83
  • 110
  • On the histogram I have some empty bins, which I know will have content in reality. For various reasons I cant widen the bins to fix this. So i need some way to apply the shape of the smoothed function to a different 'n'. Hope that is clearer? – user1839676 Nov 20 '12 at 18:31
  • I should add, i may need to do this several times, so simply reading the values from the graph isnt practical. I need some way of getting the density plot curve back in the form of a table so I can then scale it up as you say. – user1839676 Nov 20 '12 at 18:45
  • 1
    You might consider using the logspline package to fit your density estimate, it has functions to then randomly sample, or give the proportion below a given value for the density estimate in a simple way. You can do the same ideas with kernel density esmitames, but it is not as straight forward. – Greg Snow Nov 20 '12 at 19:01