# Calculation of the standard deviation of a rate per 1000 (Work SPC Chart)

#### JonJ

##### New Member
Hi all,

Would anyone be kind enough to tell me show to calculate the standard deviation of a rate per 1000

For instance

A hospital ward has

In Jan 20 days of Flu within 20 bed days
In Feb 50 days of Flu within 80 bed days
In March 100 days if flu within 200 bed days

So the average number of days of flu per 1000 bed days=
(20+50+100)*1000/(20+80+200)=566.6667

Hopefully having that correct I need to know the formula to calculate the standard deviation

Any help would be great!

#### Reaperaider

##### New Member
Standard deviation is calculated this way:
First, find the average number of what you're looking for. Then, for each data value that affected that, note the difference between them (Average minus the other number, if it's a negative result make it positive). Using those numbers, find the average of them.

#### katxt

##### Well-Known Member
Not quite, Reaperaider.
What you have, JonJ, looks more like a proportion. The proportion you have worked out to be p = 56.7%. All good and you have scaled x1000.
The SD of a proportion is given by sqrt(p(1-p)/n) Work that out and scale it up too.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
I always feel like these are more complicated then they seem. Like you would use a Poisson model for rate with an offset.

I quickly tried to recycle some old SAS code and got:

Code:
data pharm;
input incidents days;
offset = log(days/1000);
datalines;
170    300
;
run;
proc genmod data=pharm;
model incidents =  /  dist=poisson link=log offset=offset type3;
run;
After exponeniating results: 561/1000 with a SE of 1.1 and 95% CI of 488, 658.

#### Miner

##### TS Contributor
You mention SPC chart in the thread title. If you are trying to calculate the control limits for a p-chart, you may find them here. It is the same formula that @katxt mentioned multiplied by 3.

If your questions tend more toward quality and SPC than statistics in general, I recommend this Quality discussion forum. No offense to this group, but there aren't many members that are familiar with industrial/quality statistics.

#### Reaperaider

##### New Member
Not quite, Reaperaider.
What you have, JonJ, looks more like a proportion. The proportion you have worked out to be p = 56.7%. All good and you have scaled x1000.
The SD of a proportion is given by sqrt(p(1-p)/n) Work that out and scale it up too.
I was just answering the formular of standard deviation, I didn't think it was the correct way to solve that, I should have mentioned this

#### katxt

##### Well-Known Member
Standard deviation is calculated this way:
First, find the average number of what you're looking for. Then, for each data value that affected that, note the difference between them (Average minus the other number, if it's a negative result make it positive). Using those numbers, find the average of them.
OK, but in case you need to do it manually, you get the differences as you say, then you square them, then average the squares, then square root the average. (Don't do it manually if you have a computer.) Cheers, kat