Wednesday, 16 February 2011

This is the R code used to produce the Motion Chart:

install.packages('googleVis')
library(RJSONIO)
library(googleVis)
M <- gvisMotionChart(Smoking, idvar="Disorder", timevar="Age", options=list(state='{\"showTrails\":false};'))
plot(M)
cat(M$html$chart, file="tmp.html")    #this produces html for pasting into blog




The table below is taken from Figure 4 of Woloshin et al (2008)

Grey shading means fewer than 1 death per 1000 women. All ratios are >= 0.75 (grey shaded data gave ratios of 1).




Lung


Vascular
Disease
Cancer

Infection

Disease

Age
Smoking status 
Heart

Lung
Breast
Colon
Ovarian
Cervical



All

Disease
Stroke
Cancer
Cancer
Cancer
Cancer
Cancer
Pneumonia
Flu
AIDS
COPD
Accidents
Combined
35
Never smoker
1


1





1

2
14
Smoker
1
1
1
1





1

2
14
40
Never smoker
1


2
1




1

2
19
Smoker
4
2
4
2





1
1
2
27
45
Never smoker
2
1
1
3
1
1



1

2
25
Smoker
9
3
7
3
1
1

1

1
2
2
45
50
Never smoker
4
1
1
4
1
1





2
37
Smoker
13
5
14
4
1
1

1


4
2
69
55
Never smoker
8
2
2
6
2
2
1
1


1
2
55
Smoker
20
6
26
5
2
2
1
1


9
2
110
60
Never smoker
14
4
3
7
3
3
1
1


2
2
84
Smoker
31
8
41
6
3
3
1
2


18
2
167
65
Never smoker
25
7
5
8
5
4
1
2


3
3
131
Smoker
45
15
55
7
5
3
1
4


31
3
241
70
Never smoker
46
14
7
9
7
4
1
4


5
4
207
Smoker
66
25
61
8
6
4
1
7


44
4
335
75
Never smoker
86
30
7
10
10
5
1
8


6
7
335
Smoker
99
34
58
10
9
4

14


61
7
463




Here is the data (Smoking) based on the table and used by the R code:

DisorderAgeTypeN_per_1000Ratio
Heart Disease2035Vascular disease11.000
Heart Disease2040Vascular disease44.000
Heart Disease2045Vascular disease94.500
Heart Disease2050Vascular disease133.250
Heart Disease2055Vascular disease202.500
Heart Disease2060Vascular disease312.214
Heart Disease2065Vascular disease451.800
Heart Disease2070Vascular disease661.435
Heart Disease2075Vascular disease991.151
Stroke2035Vascular disease11.000
Stroke2040Vascular disease21.000
Stroke2045Vascular disease33.000
Stroke2050Vascular disease55.000
Stroke2055Vascular disease63.000
Stroke2060Vascular disease82.000
Stroke2065Vascular disease152.143
Stroke2070Vascular disease251.786
Stroke2075Vascular disease341.133
Lung Cancer2035Cancer11.000
Lung Cancer2040Cancer41.000
Lung Cancer2045Cancer77.000
Lung Cancer2050Cancer1414.000
Lung Cancer2055Cancer2613.000
Lung Cancer2060Cancer4113.667
Lung Cancer2065Cancer5511.000
Lung Cancer2070Cancer618.714
Lung Cancer2075Cancer588.286
Breast Cancer2035Cancer11.000
Breast Cancer2040Cancer21.000
Breast Cancer2045Cancer31.000
Breast Cancer2050Cancer41.000
Breast Cancer2055Cancer50.833
Breast Cancer2060Cancer60.857
Breast Cancer2065Cancer70.875
Breast Cancer2070Cancer80.889
Breast Cancer2075Cancer101.000
Colon Cancer2035Cancer01.000
Colon Cancer2040Cancer01.000
Colon Cancer2045Cancer11.000
Colon Cancer2050Cancer11.000
Colon Cancer2055Cancer21.000
Colon Cancer2060Cancer31.000
Colon Cancer2065Cancer51.000
Colon Cancer2070Cancer60.857
Colon Cancer2075Cancer90.900
Ovarian Cancer2035Cancer01.000
Ovarian Cancer2040Cancer01.000
Ovarian Cancer2045Cancer11.000
Ovarian Cancer2050Cancer11.000
Ovarian Cancer2055Cancer21.000
Ovarian Cancer2060Cancer31.000
Ovarian Cancer2065Cancer30.750
Ovarian Cancer2070Cancer41.000
Ovarian Cancer2075Cancer40.800
Cervical Cancer2035Cancer01.000
Cervical Cancer2040Cancer01.000
Cervical Cancer2045Cancer01.000
Cervical Cancer2050Cancer01.000
Cervical Cancer2055Cancer11.000
Cervical Cancer2060Cancer11.000
Cervical Cancer2065Cancer11.000
Cervical Cancer2070Cancer11.000
Cervical Cancer2075Cancer01.000
Pneumonia2035Infection01.000
Pneumonia2040Infection01.000
Pneumonia2045Infection11.000
Pneumonia2050Infection11.000
Pneumonia2055Infection11.000
Pneumonia2060Infection22.000
Pneumonia2065Infection42.000
Pneumonia2070Infection71.750
Pneumonia2075Infection141.750
AIDS2035Infection11.000
AIDS2040Infection11.000
AIDS2045Infection11.000
AIDS2050Infection01.000
AIDS2055Infection01.000
AIDS2060Infection01.000
AIDS2065Infection01.000
AIDS2070Infection01.000
AIDS2075Infection01.000
COPD2035Lung disease01.000
COPD2040Lung disease11.000
COPD2045Lung disease21.000
COPD2050Lung disease41.000
COPD2055Lung disease99.000
COPD2060Lung disease189.000
COPD2065Lung disease3110.333
COPD2070Lung disease448.800
COPD2075Lung disease6110.167
Accidents2035Accidents21.000
Accidents2040Accidents21.000
Accidents2045Accidents21.000
Accidents2050Accidents21.000
Accidents2055Accidents21.000
Accidents2060Accidents21.000
Accidents2065Accidents31.000
Accidents2070Accidents41.000
Accidents2075Accidents71.000

No comments:

Post a Comment