Published unlisted
Edited
Apr 19, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
From above, one can see how certain cancer ASIR rates seem to have a linear relationship with the health indicators. For example, take the positive linear relationship between "Current smoker, daily or occasional" and lung and bronchus cancer. What about "High boold pressure" and melanoma. To better visualize this correlation, I computed the following heat map of the correlation coefficient.
Insert cell
Insert cell
Insert cell
md`${await FileAttachment("pca-variance-final@1.png").image()}${await FileAttachment("pca-final@1.png").image()}`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
color_mortality = d3.scaleThreshold()
.domain([color_selection_mortality[9][1], color_selection_mortality[5][1], color_selection_mortality[2][1], color_selection_mortality[1][1]])
.range(d3.schemeReds[4])
Insert cell
Insert cell
color_selection_mortality = Array.from(new Map([...map_data_mortality.entries()].sort((a,b) => a[1] < b[1])));
Insert cell
mapHeight = 300
Insert cell
mapWidth = 550
Insert cell
Insert cell
// Edit the iso code to the origina data for mortality
fig_2_4_2_5_data_provinces.map(function(d) {
d.iso_id = "CA-" + d["Location"];
return d;
});
Insert cell
map_data_mortality = Object.assign(new Map(fig_2_4_2_5_data_provinces.filter(d => d["Cancer Type"] == cancer_select_mortality_map && d["Sex"] == sex_select_mortality_map).map(d => {
return [d.iso_id, d[selected_value_mortality_map]];
})), {title: selected_value_mortality_map}).set('CA-NU', -1).set('CA-NT', -1).set('CA-YT', -1);
Insert cell
topojson.feature(canada_provinces_geo_json_2, canada_provinces_geo_json_2.objects.canadaprov).features
Insert cell
canada_provinces_geojson = FileAttachment("canada_provinces.geojson").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
indicators_data.map(function(item) {
if (item["REF_DATE"] instanceof Date) {
return item;
} else {
item["REF_DATE"] = new Date(Date.UTC(item["REF_DATE"], 0, 1));
return item;
}
});
Insert cell
Insert cell
Insert cell
Insert cell
fig_1_4_1_5_data_provinces = FileAttachment("fig_1_5_1_4_combined-by-province.csv").csv()
Insert cell
fig_1_4_1_5_data_provinces.map(function(item) {
item["Projected Cases"] = parseInt(item["Projected Cases"]);
return item;
});
Insert cell
fig_1_4_1_5_data_provinces.map(function(item) {
item["ASIR (Cases per 100,000) "] = parseFloat(item["ASIR (Cases per 100,000) "]);
return item;
});
Insert cell
viewof summary_fig_1_4_1_5_data = SummaryTable(fig_1_4_1_5_data_provinces,
{label: html`<b>Projected cases and ASIR (cases per 100,000) of cancer types by province and sex</b>`})
Insert cell
Insert cell
fig_2_4_2_5_data_provinces = FileAttachment("fig-2.4-2.5-combined-by-province.csv").csv()
Insert cell
fig_2_4_2_5_data_provinces.map(function(item) {
item["Projected Cases"] = parseInt(item["Projected Cases"]);
return item;
});
Insert cell
fig_2_4_2_5_data_provinces.map(function(item) {
item["ASMR (per 100,000)"] = parseFloat(item["ASMR (per 100,000)"]);
return item;
});
Insert cell
viewof summary_fig_2_4_2_5_data = SummaryTable(fig_2_4_2_5_data_provinces,
{label: html`<b>Projected mortality and ASMR (cases per 100,000) of cancer types by province and sex</b>`})
Insert cell
fig_1_3_data = FileAttachment("fig-1.3-tidy-asir-percentage-sex-age.csv").csv({typed: true})
Insert cell
fig_1_6_data = FileAttachment("fig-1.6-tidy-asir-cases-sex-year.csv").csv({typed: true})
Insert cell
fig_1_6_data.map(function(item) {
if (item["Year"] instanceof Date) {
return item;
} else {
item["Year"] = new Date(Date.UTC(item["Year"], 0, 1));
return item;
}
});
Insert cell
Insert cell
fig_2_3_data = FileAttachment("fig-2.3-tidy-asmr-percentage-sex-age.csv").csv({typed: true})
Insert cell
fig_2_6_data = FileAttachment("fig-2.6-tidy-asmr-cases-sex-year.csv").csv()
Insert cell
fig_2_6_data.map(function(item) {
item["ASMR (per 100,000)"] = parseFloat(item["ASMR (per 100,000)"]);
item["Deaths (in thousands)"] = parseFloat(item["Deaths (in thousands)"]);
if (item["Year"] instanceof Date) {
return item;
} else {
item["Year"] = new Date(Date.UTC(item["Year"], 0, 1));
return item;
}
});
Insert cell
Insert cell
fig_S1_1_projected_cases_2021 = FileAttachment("fig-S1.1-TIDY-projected-cases-2021-2.csv").csv()
Insert cell
fig_S1_1_projected_cases_2021.map(function(d) {
d["Projected new cases"] = parseInt(d["Projected new cases"]);
return d;
})
Insert cell
Insert cell
fig_S1_2_projected_asir_2021 = FileAttachment("fig-S1.2-tidy-projected-asir-rates-2021.csv").csv()
Insert cell
fig_S1_3_data = FileAttachment("fig-S1.3-1.3-1.5-tidy-asir-by-year-sex-cancer-type-TIDY.csv").csv()
Insert cell
// Convert date of figS1_3 into date format
fig_S1_3_data.map(function(item) {
if (item["Year"] instanceof Date) {
return item;
} else {
item["Year"] = new Date(Date.UTC(item["Year"], 0, 1));
return item;
}
});
Insert cell
fig_S2_1_projected_deaths_2022 = FileAttachment("fig-S2.1-tidy-projected-deaths-2021-2.csv").csv()
Insert cell
fig_S2_1_projected_deaths_2022.map(function(d) {
d["Projected deaths"] = parseInt(d["Projected deaths"]);
return d;
})
Insert cell
viewof summary_data_S2_1 = SummaryTable(fig_S2_1_projected_deaths_2022.map(function(item) {
delete item["Table Name"];
delete item["* Note"];
delete item["Analysis By"];
delete item["Note"];
delete item["Data Sources"];
return item;
}), {label: html`<b>Data summary Table S2.1 - Projected deaths by cancer type, age, and sex</b>`})
Insert cell
fig_S2_2_projected_asmr_2021 = FileAttachment("fig-S2.2-tidy-asmr-deadliest-cancers.csv").csv()
Insert cell
fig_S2_3_data = FileAttachment("fig-S2.3-2.4-2.5-asmr-by-year-sex-cancer-type-TIDY.csv").csv()
Insert cell
// Convert date of figS1_3 into date format
fig_S2_3_data.map(function(item) {
item["Age-standardized mortality rate (ASMR)"] = parseFloat(item["Age-standardized mortality rate (ASMR)"]);
if (item["Year"] instanceof Date) {
return item;
} else {
item["Year"] = new Date(Date.UTC(item["Year"], 0, 1));
return item;
}
});
Insert cell
viewof summary_data_S2_3 = SummaryTable(fig_S2_3_data.map(function(item) {
delete item["Table Name"];
delete item["* Note"];
delete item["Analysis By"];
delete item["Note"];
delete item["Data Sources"];
delete item["Liver Note"];
return item;
}), {label: html`<b>Data summary Table S2.1 - Projected deaths by cancer type, age, and sex</b>`})
Insert cell
Insert cell
import { SummaryTable } from "@observablehq/summary-table"
Insert cell
import {Plot} from "@mkfreeman/plot-tooltip"
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
Insert cell
import {PieChart} from "@ammanyusuf/pie-chart"
Insert cell
import {GroupedBarChart} from "@d3/grouped-bar-chart"
Insert cell
import {StackedBarChart} from "@d3/stacked-normalized-horizontal-bar"
Insert cell
import {Legend, Swatches} from "@d3/color-legend"
Insert cell
Insert cell
import {StackedAreaChart} from "@d3/stacked-area-chart"
Insert cell
import { autoSelect, select, number, checkbox, slider } from "@jashkenas/inputs"
Insert cell
import {legend} from "@d3/color-legend"
Insert cell
import {searchCheckbox} from "@ammanyusuf/search-checkbox"
Insert cell
import {ScatterplotMatrix} from "@d3/splom"
Insert cell
d3 = require("d3@6")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more