Graybeard
Well-Known Member
- Works
Code:
POPRATIO=$(echo \(9986857/327533795\)|bc -l);\
sed -e 's/^2020/2020\//' -e 's/^2021/2021\//' -e 's#/\([0-9][0-9]\)#/\1/#' USAdaily.csv \
|cut -d, -f1,6 | awk -v var="$POPRATIO" -F ',' 'BEGIN{OFS=","} {print $1, $2, $2*var}' \
|sed '1,14!d' |less
date,hospitalizedCurrently,0 (really the weighted value[number])
2021/01/19,123820,3775.4
2021/01/18,123848,3776.26
2021/01/17,124387,3792.69
2021/01/16,126139,3846.11
2021/01/15,127235,3879.53
2021/01/14,128947,3931.73
2021/01/13,130391,3975.76
2021/01/12,131326,4004.27
2021/01/11,129793,3957.53
2021/01/10,129223,3940.15
2021/01/09,130781,3987.65
2021/01/08,131921,4022.41
2021/01/07,132370,4036.1
- WTF is this?
Problem: Create a weighted ratio to compare 2 populations
US state population/ US nation population
ex: 9986857/327533795
now the state
Code:
sed -e 's/^2020/2020\//' -e 's/^2021/2021\//' -e 's#/\([0-9][0-9]\)#/\1/#' ../states/daily.csv \
|cut -d, -f1,2,9 |grep MI |awk -F ',' 'BEGIN{OFS=","} {print $1, $2, $3}'\
|sed '1,14!d' |less
----returns
date,state,hospitalizedCurrently
2021/01/19,MI,2055
2021/01/18,MI,2140
2021/01/17,MI,2222
2021/01/16,MI,2222
2021/01/15,MI,2222
2021/01/14,MI,2238
2021/01/13,MI,2246
2021/01/12,MI,2443
2021/01/11,MI,2396
2021/01/10,MI,2480
2021/01/09,MI,2480
2021/01/08,MI,2480
2021/01/07,MI,2578
2021/01/06,MI,2657
(END)
this took 2 hours grrr and then 15 minutes to fix the error --once I sorted out what it was
Solution: You have to declare a bash shell variable in awk in order to use it right!
awk -v var="$POPRATIO"
never stop learning
- WTF is this for?
To make a graphical chart that compares the 2 populations hospitalization rate of COVID-19 infections. As you (can|should) see from the numbers the state of MI is lesser than the national population weighted averages.
2021/01/19,MI,2055
2021/01/19,USA,3775.4
2055/3775
or .54437086092715231788 (54.4% of the national population weighted averages)
"California",US,39512223
date,hospitalizedCurrently,0
2021/01/20,122700,14802
2021/01/19,123820,14937.1
2021/01/18,123848,14940.5
2021/01/17,124387,15005.5
2021/01/16,126139,15216.8
2021/01/15,127235,15349.1
2021/01/14,128947,15555.6
2021/01/13,130391,15729.8
2021/01/12,131326,15842.6
2021/01/11,129793,15657.7
2021/01/10,129223,15588.9
2021/01/09,130781,15776.8
2021/01/08,131921,15914.4
(END)
2021/01/19,CA,20942
2021/01/18,CA,20968
2021/01/17,CA,21143
2021/01/16,CA,21579
2021/01/15,CA,21856
2021/01/14,CA,22210
2021/01/13,CA,22550
2021/01/12,CA,22665
2021/01/11,CA,22633
2021/01/10,CA,22513
2021/01/09,CA,22600
2021/01/08,CA,22836
2021/01/07,CA,22851
2021/01/06,CA,22820
(END)
CA California
The state of CA is greater than the national population weighted averages.
20942/14937
1.40202182499832630380
or 140% of the national weighted average 2021/01/19
Sorry no pictures of the charts yet
CPA uses? Analysis
scenario:
a large volume CR
compared to your scaled A,B,C ... Tests
---------------------
statistics are statistics and numbers (and their manipulation) are the same ..
Last edited: