Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2071 zjchen 1
!goto $wims_read_parm
2
 
3
:def
4
title=Weighted standard deviation
5
synonyme=weighted deviation, deviation weighted, weighted data deviation, standard deviation weighted
6
input=data2d
7
!exit
8
 
9
:proc
10
 
11
pari_header=dmat=Mat([$fml2]);w=sum(x=1,$cnt,dmat[x,2]);\
12
	mean=(dmat[,1]~*dmat[,2])/w;\
13
	dev=sqrt(sum(x=1,$cnt,dmat[x,2]*(dmat[x,1]-mean)^2)/(w));
14
result=!exec pari print(dev);\
15
	print(w);
16
!distribute lines $result into result, totweight
17
 
18
!exit
19
 
20
:output
21
 
22
<center>
23
Weighted deviation =
24
!htmlmath $result
25
</center> <p>
26
Data: $cnt weighted numbers { $fml3 } (total weight = $totweight).
27
<p>
28
(Deviation of the whole population.)
29
<p>
30
!exit
31