A new phenomenon that entered the scene a little while ago may indicate how skewed the market is. People wanting to buy a house in a certain neighborhood will put notes and letters in the mailboxes of people living in that area saying "Nice house! Are you interested in selling it to me?". This is now not an uncommon strategy to find a house. Some people living in popular neighborshoods are inundated with notes from agencies facilitating these practices. See also a news item by RTL.
+- -
+{{< image src="spss-screenshot.png" alt="spss screenshot" >}} This screen shows up when you click `Analyze` -\> `Dimension Reduction` -\> `Factor`, which then opens a window called "Factor Analysis: Extraction" which lets you pick "Principal components" as a method. To put the (apparent) PCA method as a sub-section of factor analysis is misleading at best, and straight-up erronious at worst. The other options for the method here is "Principal axis factoring" (which is closer to traditional factor analysis) and "Maximum likelihood" ([source for screenshot and SPSS interface](https://stats.idre.ucla.edu/spss/seminars/efa-spss/)). If you're wondering if you're the first one to be confused by SPSS' choice to present this in such a way, you're not ([link](https://stats.stackexchange.com/questions/1576/what-are-the-differences-between-factor-analysis-and-principal-component-analysi), [link](https://stats.stackexchange.com/questions/24781/interpreting-discrepancies-between-r-and-spss-with-exploratory-factor-analysis)). @@ -46,8 +41,8 @@ theme_set(theme_minimal()) We'll load the data into R, clean up the variable names, convert the outcome variable (`ca_cervix`) to a factor. We'll have a look at the dataset using some functions from `{skimr}`. This function will give us summary statistics and basic histograms of the different variables. ``` r -data <- read_csv("sobar-72.csv") %>% - janitor::clean_names() %>% +data <- read_csv("sobar-72.csv") |> + janitor::clean_names() |> mutate(ca_cervix = as_factor(ca_cervix)) skim_summ <- skimr::skim_with(base = skimr::sfl()) @@ -101,8 +96,8 @@ Data summary Now let's only select the variables containing the risk factors (called features from here on). We'll also scale all the features to have a mean of 0 and a standard deviation of 1 using the `scale()` function. We can check what the new variable looks like using the `summary()` function. ``` r -data_features <- data %>% - select(-ca_cervix) %>% +data_features <- data |> + select(-ca_cervix) |> mutate(across(everything(), ~ scale(.x))) summary(data_features$attitude_consistency) @@ -119,11 +114,11 @@ summary(data_features$attitude_consistency) So now we have a data frame with 72 entries and 19 normalized columns, each representing a feature that may or may not predict cervical cancer. We can create a correlation matrix to visualize the degree of correlation between the different features. For this we simply run `cor()` on the data frame with the features, transform the output to a data frame in long format and then visualize it using `ggplot()` and `geom_tile()`. ``` r -cor(data_features) %>% - as_tibble() %>% - mutate(feature_y = names(.)) %>% - pivot_longer(cols = -feature_y, names_to = "feature_x", values_to = "correlation") %>% - mutate(feature_y = fct_rev(feature_y)) %>% +cor(data_features) |> + as_tibble() %>% + mutate(feature_y = names(.)) |> + pivot_longer(cols = -feature_y, names_to = "feature_x", values_to = "correlation") |> + mutate(feature_y = fct_rev(feature_y)) |> ggplot(aes(x = feature_x, y = feature_y, fill = correlation)) + geom_tile() + labs(x = NULL, @@ -242,7 +237,7 @@ We may be tempted to immediately look at the *p*-value at the end of the output. The "Loadings" section of the results show a make-shift weight matrix, but in order to further interpret these results, let's create a plot showing the weight matrix. We'll get the results from the factor analysis model we created earlier using the `tidy()` function from `{broom}` and convert it to long format. We'll then create a weight matrix much in the same way we did earlier. ``` r -fa_weight_matrix <- broom::tidy(fa_model) %>% +fa_weight_matrix <- broom::tidy(fa_model) |> pivot_longer(starts_with("fl"), names_to = "factor", values_to = "loading") fa_loading_plot <- ggplot(fa_weight_matrix, aes(x = factor, y = variable, fill = loading)) + @@ -263,11 +258,11 @@ Here we can more easily see that there's two strong clusters in Factor 1 and Fac Lastly, I think it would be interesting to see how the different factors relate to each other. We'll take the Bartlett's scores and correlate them with each other much like before and create a correlation matrix like before. ``` r -fa_model$scores %>% - cor() %>% - data.frame() %>% - rownames_to_column("factor_x") %>% - pivot_longer(cols = -factor_x, names_to = "factor_y", values_to = "correlation") %>% +fa_model$scores |> + cor() |> + data.frame() |> + rownames_to_column("factor_x") |> + pivot_longer(cols = -factor_x, names_to = "factor_y", values_to = "correlation") |> ggplot(aes(x = factor_x, y = factor_y, fill = correlation)) + geom_tile() + geom_text(aes(label = round(correlation,4)), color = "white") + @@ -301,12 +296,12 @@ pc_model$variance <- pc_model$sdev^2 Next we can make a simple scree plot using the variance we calculate above. We'll create a plot with the principal components on the x-axis and the eigenvalue on the y-axis. The scree plot is a very popular plot to visualize features of a PCA. In this plot the elbow is quite clearly at principal component 3, but as discussed, the scree plot is not the best nor the only way to determine the optimal number of components. In the code below I also added a calculation for the cumulative variance (`cum_variance`) which showed that a little more than 80% of the variance is captured in the first 7 components, while the first 3 components combined capture only 56%. ``` r -pc_model$variance %>% - as_tibble() %>% - rename(eigenvalue = value) %>% - rownames_to_column("comp") %>% +pc_model$variance |> + as_tibble() |> + rename(eigenvalue = value) |> + rownames_to_column("comp") |> mutate(comp = parse_number(comp), - cum_variance = cumsum(eigenvalue)/sum(eigenvalue)) %>% + cum_variance = cumsum(eigenvalue)/sum(eigenvalue)) |> ggplot(aes(x = comp, y = eigenvalue)) + geom_hline(yintercept = 1) + geom_line(size = 1) + @@ -321,13 +316,13 @@ pc_model$variance %>% We'll also create a weight matrix again, based on the rotation from the PCA. We'll create the weight matrix much in the same way as before. A PCA by its very nature returns an equal number of components as the number of variables put in, however, we're interested in just the first 7 components, so we'll select just those using the `filter()` function. ``` r -pc_weight_matrix <- pc_model$rotation %>% - data.frame() %>% - rownames_to_column("variable") %>% +pc_weight_matrix <- pc_model$rotation |> + data.frame() |> + rownames_to_column("variable") |> pivot_longer(starts_with("PC"), names_to = "prin_comp", values_to = "loading") -pca_loading_plot <- pc_weight_matrix %>% - filter(parse_number(prin_comp) <= n_comps) %>% +pca_loading_plot <- pc_weight_matrix |> + filter(parse_number(prin_comp) <= n_comps) |> ggplot(aes(x = reorder(prin_comp, parse_number(prin_comp)), y = variable, fill = loading)) + geom_tile() + labs(title = "PCA loadings", @@ -346,13 +341,13 @@ One thing that immediately jumps out is that PC1 and PC2 are nearly identical to We can also make a correlation matrix for the different principal components. We'll use the `x` field and otherwise create the correlation matrix the same way as before: ``` r -pc_model$x %>% - cor() %>% - data.frame() %>% - rownames_to_column("comp_x") %>% - pivot_longer(cols = starts_with("PC"), names_to = "comp_y", values_to = "correlation") %>% +pc_model$x |> + cor() |> + data.frame() |> + rownames_to_column("comp_x") |> + pivot_longer(cols = starts_with("PC"), names_to = "comp_y", values_to = "correlation") |> filter(parse_number(comp_x) <= n_comps, - parse_number(comp_y) <= n_comps) %>% + parse_number(comp_y) <= n_comps) |> ggplot(aes(x = comp_x, y = comp_y, fill = correlation)) + geom_tile() + geom_text(aes(label = round(correlation,4)), color = "white") + @@ -392,8 +387,8 @@ pc_manual <- as.matrix(data_features) %*% eigenvector Let's look at the scree plot: ``` r -tibble(eigenvalues) %>% - ggplot(aes(x = seq_along(eigenvalues), y = eigenvalues)) + +tibble(eigenvalues) |> + ggplot(aes(x = seq_along(eigenvalues), y = eigenvalues)) + geom_hline(yintercept = 1) + geom_line(size = 1) + geom_point(size = 3) @@ -404,7 +399,7 @@ tibble(eigenvalues) %>% Looks identical to the previous one. Let's also look at the correlation matrix between the principal components. ``` r -data.frame(pc_manual) %>% +data.frame(pc_manual) |> cor() %>% round(., 4) ``` @@ -443,9 +438,9 @@ ica_model <- fastICA(data_features, n.comp = n_comps) Let's create a weight matrix again. The output from the `fastICA()` doesn't provide useful names, but the [documentation](https://www.rdocumentation.org/packages/fastICA/versions/1.2-2/topics/fastICA) provides sufficient information. To create the weight matrix we take the `A` field, transpose it, get the right names to the right places and then create the plot like we've done several times now. ``` r -ica_weight_matrix <- data.frame(t(ica_model$A)) %>% - rename_with(~ str_glue("IC{seq(.)}")) %>% - mutate(variable = names(data_features)) %>% +ica_weight_matrix <- data.frame(t(ica_model$A)) |> + rename_with(~ str_glue("IC{seq(.)}")) |> + mutate(variable = names(data_features)) |> pivot_longer(cols = starts_with("IC"), names_to = "ic", values_to = "loading") ica_loading_plot <- ggplot(ica_weight_matrix, aes(x = ic, y = variable, fill = loading)) + @@ -466,11 +461,11 @@ The FastICA method doesn't rank the components based on variance like factor ana Again, we can also visualize the correlation between the different components. ``` r -ica_model$S %>% - cor() %>% - data.frame() %>% - rownames_to_column("comp_x") %>% - pivot_longer(cols = starts_with("X"), names_to = "comp_y", values_to = "correlation") %>% +ica_model$S |> + cor() |> + data.frame() |> + rownames_to_column("comp_x") |> + pivot_longer(cols = starts_with("X"), names_to = "comp_y", values_to = "correlation") |> ggplot(aes(x = comp_x, y = comp_y, fill = correlation)) + geom_tile() + geom_text(aes(label = round(correlation,4)), color = "white") + @@ -489,21 +484,21 @@ Okay, let's now compare the three approaches and put the loading matrices side b ``` r all_weight_matrices <- bind_rows( - fa_weight_matrix %>% - rename(comp = factor) %>% + fa_weight_matrix |> + rename(comp = factor) |> mutate(alg = "FA"), - pc_weight_matrix %>% - rename(comp = prin_comp) %>% + pc_weight_matrix |> + rename(comp = prin_comp) |> mutate(alg = "PCA"), - ica_weight_matrix %>% - rename(comp = ic) %>% + ica_weight_matrix |> + rename(comp = ic) |> mutate(alg = "ICA") ) -all_weight_matrices %>% - filter(parse_number(comp) <= n_comps) %>% +all_weight_matrices |> + filter(parse_number(comp) <= n_comps) |> mutate(alg = str_glue("{alg} loadings"), - alg = as_factor(alg)) %>% + alg = as_factor(alg)) |> ggplot(aes(x = comp, y = variable, fill = loading)) + geom_tile() + labs(x = NULL, @@ -555,10 +550,10 @@ Let's look at how the clusters are made up according to the hierarchical cluster ``` r hclust_weight_matrix %>% - data.frame() %>% - janitor::clean_names() %>% - rename(cluster = x) %>% - rownames_to_column("variable") %>% + data.frame() |> + janitor::clean_names() |> + rename(cluster = x) |> + rownames_to_column("variable") |> ggplot(aes(x = as_factor(cluster), y = variable, fill = as_factor(cluster))) + geom_tile() + labs(x = NULL, diff --git a/content/blog/2021-comparison-fa-pca-ica/index.qmd b/content/blog/2021-comparison-fa-pca-ica/index.qmd index c25a2b7..8cc0c05 100644 --- a/content/blog/2021-comparison-fa-pca-ica/index.qmd +++ b/content/blog/2021-comparison-fa-pca-ica/index.qmd @@ -1,16 +1,13 @@ --- title: A Basic Comparison Between Factor Analysis, PCA, and ICA -author: Daniel Roelfs -date: "2021-09-14" +date: 2021-09-14 +description: A Basic Comparison Between Factor Analysis, PCA, and ICA slug: a-basic-comparison-between-factor-analysis-pca-and-ica categories: - statistics tags: - statistics - R -description: "A Basic Comparison Between Factor Analysis, PCA, and ICA" -thumbnail: images/avatar.png -format: hugo execute: fig.retina: 2 fig.align: center @@ -21,9 +18,7 @@ execute: This is just a very quick blog post outlining some of the commonalities and differences between factor analysis (FA), principal component analysis (PCA), and independent component analysis (ICA). I was inspired to write some of this down through some confusion caused in the lab by SPSS' apparent dual usage of the term "factor analysis" and "principal components". A few of my colleagues who use SPSS showed me the following screen: -- -
+{{{< image src="spss-screenshot.png" alt="spss screenshot" >}}} This screen shows up when you click `Analyze` -> `Dimension Reduction` -> `Factor`, which then opens a window called "Factor Analysis: Extraction" which lets you pick "Principal components" as a method. To put the (apparent) PCA method as a sub-section of factor analysis is misleading at best, and straight-up erronious at worst. The other options for the method here is "Principal axis factoring" (which is closer to traditional factor analysis) and "Maximum likelihood" ([source for screenshot and SPSS interface](https://stats.idre.ucla.edu/spss/seminars/efa-spss/)). If you're wondering if you're the first one to be confused by SPSS' choice to present this in such a way, you're not ([link](https://stats.stackexchange.com/questions/1576/what-are-the-differences-between-factor-analysis-and-principal-component-analysi), [link](https://stats.stackexchange.com/questions/24781/interpreting-discrepancies-between-r-and-spss-with-exploratory-factor-analysis)). @@ -52,8 +47,8 @@ We'll load the data into R, clean up the variable names, convert the outcome var #| label: load-data #| message: false -data <- read_csv("sobar-72.csv") %>% - janitor::clean_names() %>% +data <- read_csv("sobar-72.csv") |> + janitor::clean_names() |> mutate(ca_cervix = as_factor(ca_cervix)) skim_summ <- skimr::skim_with(base = skimr::sfl()) @@ -65,8 +60,8 @@ Now let's only select the variables containing the risk factors (called features ```{r} #| label: scale-data -data_features <- data %>% - select(-ca_cervix) %>% +data_features <- data |> + select(-ca_cervix) |> mutate(across(everything(), ~ scale(.x))) summary(data_features$attitude_consistency) @@ -77,11 +72,11 @@ So now we have a data frame with 72 entries and 19 normalized columns, each repr ```{r} #| label: corr-matrix-original -cor(data_features) %>% - as_tibble() %>% - mutate(feature_y = names(.)) %>% - pivot_longer(cols = -feature_y, names_to = "feature_x", values_to = "correlation") %>% - mutate(feature_y = fct_rev(feature_y)) %>% +cor(data_features) |> + as_tibble() %>% + mutate(feature_y = names(.)) |> + pivot_longer(cols = -feature_y, names_to = "feature_x", values_to = "correlation") |> + mutate(feature_y = fct_rev(feature_y)) |> ggplot(aes(x = feature_x, y = feature_y, fill = correlation)) + geom_tile() + labs(x = NULL, @@ -128,7 +123,7 @@ The "Loadings" section of the results show a make-shift weight matrix, but in or ```{r} #| label: fa-weight-matrix -fa_weight_matrix <- broom::tidy(fa_model) %>% +fa_weight_matrix <- broom::tidy(fa_model) |> pivot_longer(starts_with("fl"), names_to = "factor", values_to = "loading") fa_loading_plot <- ggplot(fa_weight_matrix, aes(x = factor, y = variable, fill = loading)) + @@ -149,11 +144,11 @@ Lastly, I think it would be interesting to see how the different factors relate ```{r} #| label: fa-corr-matrix -fa_model$scores %>% - cor() %>% - data.frame() %>% - rownames_to_column("factor_x") %>% - pivot_longer(cols = -factor_x, names_to = "factor_y", values_to = "correlation") %>% +fa_model$scores |> + cor() |> + data.frame() |> + rownames_to_column("factor_x") |> + pivot_longer(cols = -factor_x, names_to = "factor_y", values_to = "correlation") |> ggplot(aes(x = factor_x, y = factor_y, fill = correlation)) + geom_tile() + geom_text(aes(label = round(correlation,4)), color = "white") + @@ -190,12 +185,12 @@ Next we can make a simple scree plot using the variance we calculate above. We'l ```{r} #| label: pca-scree -pc_model$variance %>% - as_tibble() %>% - rename(eigenvalue = value) %>% - rownames_to_column("comp") %>% +pc_model$variance |> + as_tibble() |> + rename(eigenvalue = value) |> + rownames_to_column("comp") |> mutate(comp = parse_number(comp), - cum_variance = cumsum(eigenvalue)/sum(eigenvalue)) %>% + cum_variance = cumsum(eigenvalue)/sum(eigenvalue)) |> ggplot(aes(x = comp, y = eigenvalue)) + geom_hline(yintercept = 1) + geom_line(size = 1) + @@ -207,13 +202,13 @@ We'll also create a weight matrix again, based on the rotation from the PCA. We' ```{r} #| label: pca-weight-matrix -pc_weight_matrix <- pc_model$rotation %>% - data.frame() %>% - rownames_to_column("variable") %>% +pc_weight_matrix <- pc_model$rotation |> + data.frame() |> + rownames_to_column("variable") |> pivot_longer(starts_with("PC"), names_to = "prin_comp", values_to = "loading") -pca_loading_plot <- pc_weight_matrix %>% - filter(parse_number(prin_comp) <= n_comps) %>% +pca_loading_plot <- pc_weight_matrix |> + filter(parse_number(prin_comp) <= n_comps) |> ggplot(aes(x = reorder(prin_comp, parse_number(prin_comp)), y = variable, fill = loading)) + geom_tile() + labs(title = "PCA loadings", @@ -232,13 +227,13 @@ We can also make a correlation matrix for the different principal components. We ```{r} #| label: pca-corr-matrix -pc_model$x %>% - cor() %>% - data.frame() %>% - rownames_to_column("comp_x") %>% - pivot_longer(cols = starts_with("PC"), names_to = "comp_y", values_to = "correlation") %>% +pc_model$x |> + cor() |> + data.frame() |> + rownames_to_column("comp_x") |> + pivot_longer(cols = starts_with("PC"), names_to = "comp_y", values_to = "correlation") |> filter(parse_number(comp_x) <= n_comps, - parse_number(comp_y) <= n_comps) %>% + parse_number(comp_y) <= n_comps) |> ggplot(aes(x = comp_x, y = comp_y, fill = correlation)) + geom_tile() + geom_text(aes(label = round(correlation,4)), color = "white") + @@ -280,8 +275,8 @@ Let's look at the scree plot: ```{r} #| label: pca-manual-scree -tibble(eigenvalues) %>% - ggplot(aes(x = seq_along(eigenvalues), y = eigenvalues)) + +tibble(eigenvalues) |> + ggplot(aes(x = seq_along(eigenvalues), y = eigenvalues)) + geom_hline(yintercept = 1) + geom_line(size = 1) + geom_point(size = 3) @@ -294,11 +289,11 @@ Looks identical to the previous one. Let's also look at the correlation matrix b #| echo: false #| eval: false -data.frame(pc_manual) %>% - rename_with(~ str_glue("PC{parse_number(.x)}")) %>% - rownames_to_column("participant") %>% - pivot_longer(starts_with("PC"), names_to = "prin_comp", values_to = "loading") %>% - filter(parse_number(prin_comp) <= n_comps) %>% +data.frame(pc_manual) |> + rename_with(~ str_glue("PC{parse_number(.x)}")) |> + rownames_to_column("participant") |> + pivot_longer(starts_with("PC"), names_to = "prin_comp", values_to = "loading") |> + filter(parse_number(prin_comp) <= n_comps) |> ggplot(aes(x = reorder(prin_comp, parse_number(prin_comp)), y = parse_number(participant), fill = loading)) + geom_tile() + @@ -312,7 +307,7 @@ data.frame(pc_manual) %>% ```{r} #| label: pca-manual-corr-matrix -data.frame(pc_manual) %>% +data.frame(pc_manual) |> cor() %>% round(., 4) ``` @@ -335,9 +330,9 @@ Let's create a weight matrix again. The output from the `fastICA()` doesn't prov ```{r} #| label: ica-weight-matrix -ica_weight_matrix <- data.frame(t(ica_model$A)) %>% - rename_with(~ str_glue("IC{seq(.)}")) %>% - mutate(variable = names(data_features)) %>% +ica_weight_matrix <- data.frame(t(ica_model$A)) |> + rename_with(~ str_glue("IC{seq(.)}")) |> + mutate(variable = names(data_features)) |> pivot_longer(cols = starts_with("IC"), names_to = "ic", values_to = "loading") ica_loading_plot <- ggplot(ica_weight_matrix, aes(x = ic, y = variable, fill = loading)) + @@ -358,11 +353,11 @@ Again, we can also visualize the correlation between the different components. ```{r} #| label: ica-corr-matrix -ica_model$S %>% - cor() %>% - data.frame() %>% - rownames_to_column("comp_x") %>% - pivot_longer(cols = starts_with("X"), names_to = "comp_y", values_to = "correlation") %>% +ica_model$S |> + cor() |> + data.frame() |> + rownames_to_column("comp_x") |> + pivot_longer(cols = starts_with("X"), names_to = "comp_y", values_to = "correlation") |> ggplot(aes(x = comp_x, y = comp_y, fill = correlation)) + geom_tile() + geom_text(aes(label = round(correlation,4)), color = "white") + @@ -382,21 +377,21 @@ Okay, let's now compare the three approaches and put the loading matrices side b #| out.width: 100% all_weight_matrices <- bind_rows( - fa_weight_matrix %>% - rename(comp = factor) %>% + fa_weight_matrix |> + rename(comp = factor) |> mutate(alg = "FA"), - pc_weight_matrix %>% - rename(comp = prin_comp) %>% + pc_weight_matrix |> + rename(comp = prin_comp) |> mutate(alg = "PCA"), - ica_weight_matrix %>% - rename(comp = ic) %>% + ica_weight_matrix |> + rename(comp = ic) |> mutate(alg = "ICA") ) -all_weight_matrices %>% - filter(parse_number(comp) <= n_comps) %>% +all_weight_matrices |> + filter(parse_number(comp) <= n_comps) |> mutate(alg = str_glue("{alg} loadings"), - alg = as_factor(alg)) %>% + alg = as_factor(alg)) |> ggplot(aes(x = comp, y = variable, fill = loading)) + geom_tile() + labs(x = NULL, @@ -452,10 +447,10 @@ Let's look at how the clusters are made up according to the hierarchical cluster #| label: hclust-weight-matrix hclust_weight_matrix %>% - data.frame() %>% - janitor::clean_names() %>% - rename(cluster = x) %>% - rownames_to_column("variable") %>% + data.frame() |> + janitor::clean_names() |> + rename(cluster = x) |> + rownames_to_column("variable") |> ggplot(aes(x = as_factor(cluster), y = variable, fill = as_factor(cluster))) + geom_tile() + labs(x = NULL, diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/all-weight-matrices-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/all-weight-matrices-1.png deleted file mode 100644 index 1045637..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/all-weight-matrices-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/corr-matrix-original-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/corr-matrix-original-1.png deleted file mode 100644 index ce1c0d5..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/corr-matrix-original-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/dendrogram-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/dendrogram-1.png deleted file mode 100644 index 8484fa4..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/dendrogram-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/dendrogram-w-line-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/dendrogram-w-line-1.png deleted file mode 100644 index 8226c86..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/dendrogram-w-line-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/fa-corr-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/fa-corr-matrix-1.png deleted file mode 100644 index f103501..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/fa-corr-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/fa-weight-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/fa-weight-matrix-1.png deleted file mode 100644 index 95eca95..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/fa-weight-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/hclust-weight-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/hclust-weight-matrix-1.png deleted file mode 100644 index f64981b..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/hclust-weight-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/ica-corr-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/ica-corr-matrix-1.png deleted file mode 100644 index 60ea990..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/ica-corr-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/ica-weight-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/ica-weight-matrix-1.png deleted file mode 100644 index 37bb391..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/ica-weight-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-biplot-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-biplot-1.png deleted file mode 100644 index 594a647..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-biplot-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-corr-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-corr-matrix-1.png deleted file mode 100644 index a0bdcaf..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-corr-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-manual-scree-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-manual-scree-1.png deleted file mode 100644 index 02cd68d..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-manual-scree-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-scree-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-scree-1.png deleted file mode 100644 index a822ca6..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-scree-1.png and /dev/null differ diff --git a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-weight-matrix-1.png b/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-weight-matrix-1.png deleted file mode 100644 index fbcfe66..0000000 Binary files a/content/blog/2021-comparison-fa-pca-ica/index_files/figure-gfm/pca-weight-matrix-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index.md b/content/blog/2021-easy-map-norway/index.md index 03dfdde..0249baf 100644 --- a/content/blog/2021-easy-map-norway/index.md +++ b/content/blog/2021-easy-map-norway/index.md @@ -1,7 +1,7 @@ --- title: The Easier Way to Create a Map of Norway Using {csmaps} -author: Daniel Roelfs -date: "2021-08-24" +date: 2021-08-24 +description: The Easier Way to Create a Map of Norway Using {csmaps} slug: the-easier-way-to-create-a-map-of-norway-using-csmaps categories: - ggplot @@ -9,9 +9,6 @@ tags: - ggplot - map - norway -description: "The Easier Way to Create a Map of Norway Using {csmaps}" -thumbnail: images/avatar.png -format: hugo editor_options: chunk_output_type: console execute: diff --git a/content/blog/2021-easy-map-norway/index.qmd b/content/blog/2021-easy-map-norway/index.qmd index da22f25..c52efc6 100644 --- a/content/blog/2021-easy-map-norway/index.qmd +++ b/content/blog/2021-easy-map-norway/index.qmd @@ -1,7 +1,7 @@ --- title: The Easier Way to Create a Map of Norway Using {csmaps} -author: Daniel Roelfs -date: "2021-08-24" +date: 2021-08-24 +description: The Easier Way to Create a Map of Norway Using {csmaps} slug: the-easier-way-to-create-a-map-of-norway-using-csmaps categories: - ggplot @@ -9,9 +9,6 @@ tags: - ggplot - map - norway -description: "The Easier Way to Create a Map of Norway Using {csmaps}" -thumbnail: images/avatar.png -format: hugo editor_options: chunk_output_type: console execute: @@ -23,7 +20,10 @@ execute: --- -```{css echo=FALSE, label='css'} +```{css} +#| label: style +#| echo: FALSE + p.announcement { border-radius: 5px; background-color: #acc8d4; diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/age-plot-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/age-plot-1.png deleted file mode 100644 index 5ba6b40..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/age-plot-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/minimal-plot-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/minimal-plot-1.png deleted file mode 100644 index 32f4029..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/minimal-plot-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-kommune-faceted-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-kommune-faceted-1.png deleted file mode 100644 index e9c7f53..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-kommune-faceted-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-oslo-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-oslo-1.png deleted file mode 100644 index e1e810b..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-oslo-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-w-cities-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-w-cities-1.png deleted file mode 100644 index 55fc79d..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/plot-w-cities-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/simple-plot-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/simple-plot-1.png deleted file mode 100644 index 2c1f54e..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/simple-plot-1.png and /dev/null differ diff --git a/content/blog/2021-easy-map-norway/index_files/figure-gfm/vax-plot-1.png b/content/blog/2021-easy-map-norway/index_files/figure-gfm/vax-plot-1.png deleted file mode 100644 index 3be9069..0000000 Binary files a/content/blog/2021-easy-map-norway/index_files/figure-gfm/vax-plot-1.png and /dev/null differ diff --git a/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/events-timeline-1.png b/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/events-timeline-1.png index 0f0cf43..c354b49 100644 Binary files a/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/events-timeline-1.png and b/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/events-timeline-1.png differ diff --git a/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/podium-sweeps-1.png b/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/podium-sweeps-1.png index ef6dc53..8adc175 100644 Binary files a/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/podium-sweeps-1.png and b/content/blog/2022-dutch-performance-olympic-speed-skating/index.markdown_strict_files/figure-markdown_strict/podium-sweeps-1.png differ diff --git a/content/blog/2022-dutch-performance-olympic-speed-skating/index.md b/content/blog/2022-dutch-performance-olympic-speed-skating/index.md index cc98c6a..b7ef3d0 100644 --- a/content/blog/2022-dutch-performance-olympic-speed-skating/index.md +++ b/content/blog/2022-dutch-performance-olympic-speed-skating/index.md @@ -1,16 +1,13 @@ --- title: Dutch performance at Olympic speed skating -author: Daniel Roelfs -date: "2022-02-09" +date: 2022-02-09 +description: Dutch performance at Olympic speed skating slug: dutch-performance-at-olympic-speed-skating categories: - miscellaneous tags: - data visualization - R -description: "Dutch performance at Olympic speed skating" -thumbnail: images/avatar.png -format: hugo execute: fig.retina: 2 fig.align: center @@ -25,6 +22,9 @@ Now, since the last Winter Olympic Games in 2018 I've learned quite a bit about First we'll load the packages, as usual, we'll use the `{tidyverse}` package. For some more functionality around text rendering in the plots, we'll also load the `{ggtext}` package, and in order to use different fonts than the default ones we'll use functionality from the `{showtext}` package and then load a nice sans-serif font called [Yanone Kaffeesatz](https://fonts.google.com/specimen/Yanone+Kaffeesatz?preview.text=solipsism&preview.text_type=custom). We'll incidentally use some other packages, but then we can use the `::` operator. +{{ .Site.Params.intro | markdownify }}
+ +{{ end }} +