# st: RE: RE: weighting item specific (CPI) histograms

 From To Subject st: RE: RE: weighting item specific (CPI) histograms Date Tue, 28 Mar 2006 16:23:05 +0300

```Yes, CPI is consumer price index in this case.

My data set is an unweighted panel: I have around 50 months and around
450 different item groups in each month in my data set. The number of
single price quotes in each item group is useally slightly different
between months (and between item groups). To be able to draw a histogram
the data is converted to the long form.

I have tried to do the calculations first. The problem is that the
histogram (distribution) becomes way too narrow with this method. I
could get the correct weighted histogram at the whole CPI level, if I
could sum up the individual item level histograms.

To sum up, it would enought if I just could save the frequencies in
histograms in matrix or vector form and then export them out of Stata as
data. By so far, I've been not able to see the data (with the exception
of bar labels option) - just the picture. I can save the picture etc,
but does someone know how I could save the frequency data of the
histogram?

Samu

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 28. maaliskuuta 2006 12:46
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: weighting item specific (CPI) histograms

You don't explain CPI. I guess consumer price index.
As I understand it, despite a multiplicity of details,
such indexes are just weighted
combinations of a bundle of price variables. Stata
is well up to that, probably using -generate- and possibly -replace-.

I am puzzled by this question and am probably missing something. It
seems to me that you should just do the calculations first and then
produce the histogram
you want. The weights possibilities for histogram, or
any other kind of Stata graph, are not really intended for
elaborate calculations on the fly.

Nick
n.j.cox@durham.ac.uk

Samu Kurri

> Is there a way to calculate a weighted (CPI) histogram with STATA? I
> have a very large micro data set and I would like to sum up the
> histograms of price changes in each item groups (eg. gasoline,
> bananas, computers, cell phone calls) to a single weighted CPI
> histogram. So what I need is a command (or a macro or program) that
> calculates the item specific histograms and then weights them up with
> given item weights.
>
> Or can I save the histograms as tables (data) (instead of pictures)?
> That would allow me to export them and do the weighting in eg. Excel.
>
> I am familiar with the fweights option on histogram command, but I
> think it does not suit for my purposes.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

This mail has been checked for viruses

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```