Articles by R | Quantum Jitter

Bootstraps & Bandings

March 7, 2022 | R | Quantum Jitter

Are the distinct residential property bands of 3 decades ago becoming less so? Over the years, urban properties have been added to and divided up. And two streets of equal attractiveness, and with equivalently-banded properties, may have diverged as neighbourhoods evolved. Whilst properties can and do move to higher or lower ...
[Read more...]

Sea Monsters that Lost their Way

December 3, 2021 | R | Quantum Jitter

library(tidyverse)
library(tidymodels)
library(probably)
library(finetune)
library(textrecipes)
library(stopwords)
library(wesanderson)
library(kableExtra)
library(clock)
library(glue)
library(janitor)
library(vip)
library(ggrepel)
library(tictoc)
library(doParallel)

registerDoParallel(cores = 6)
theme_set(theme_bw())

(cols <- wes_palette(name = "Darjeeling2"))
The Natural History Museum began recording cetacean (whales, dolphins and porpoises) strandings in 1913. I’d like to explore this 1913-1989 dataset.
strandings_df <- read_csv("strandings.csv") %>%
  clean_names() %>% 
  mutate(
    date = date_parse(date, format = "%d/%m/%Y"),
    length = parse_number(length_et),
    species_lumped = fct_lump_n(species, 20),
    across(ends_with("_val"), as.integer)
  )

# glimpse(strandings_df)
Exploratory Some of the species labels contain a question mark or forward slash. This indicates uncertainty, so it might be fun to see if a machine ...
[Read more...]

A Frosty Deal?

September 17, 2020 | R | Quantum Jitter

Reading news articles on the will-they-won’t-they post-Brexit trade negotiations with the EU sees days of optimism jarred by days of gloom. Do negative news articles, when one wants a positive outcome, leave a deeper impression? I wondered if I coul...
[Read more...]

The Goldilocks Principle

August 8, 2020 | R | Quantum Jitter

The Goldilocks principle has its origins in a children’s story about a girl who tastes the bowls of porridge left by three bears. She prefers the one that is neither too hot nor too cold, but is just right. When it comes to investing in stocks, how many is “...
[Read more...]

Weathering the Storm

August 1, 2020 | R | Quantum Jitter

Covid-19 began battering the financial markets in February. Which sectors are faring best? I’ll compare each sector in the S&P 500 with the overall market. And I’ll baseline each at 100% as of February 19th, 2020 so we can see which have recovered lost ground.
symbols <-
  c(
    "EOD/SPY",
    "EOD/XLV",
    "EOD/XLK",
    "EOD/XLE",
    "EOD/XLF",
    "EOD/XLC",
    "EOD/XLI",
    "EOD/XLY",
    "EOD/XLP",
    "EOD/XLRE",
    "EOD/XLU",
    "EOD/XLB"
  )

from <- "2020-02-19"
eod_sectors <-
  tq_get(symbols, get = "quandl", from = from) %>%
  group_by(symbol) %>%
  mutate(
    norm_close = adj_close / first(adj_close),
    type = if_else(symbol == "EOD/SPY", "Market", "Sector"),
    sector = case_when(
      symbol == "EOD/SPY"  ~ "S&P 500",
      symbol == "EOD/XLB"  ~ "Materials",
      symbol == "EOD/XLE"  ~ "Energy",
      symbol == "EOD/XLU"  ~ "Utilities",
      symbol == "EOD/XLI"  ~ "Industrical",
      symbol == "EOD/XLRE" ~ "Real Estate",
      symbol == "EOD/XLV"  ~ "Health",
      symbol == "EOD/XLK"  ~ "Technology",
      symbol == "EOD/XLF"  ~ "Financial",
      symbol == "EOD/XLC"  ~ "Communication",
      symbol == "EOD/XLY"  ~ "Consumer Discretionary",
      symbol == "EOD/XLP"  ~ "Consumer Staples",
      TRUE                 ~ "Other"
    )
  ) %>%
  ungroup()
With all that ...
[Read more...]

Favourite Things

July 25, 2020 | R | Quantum Jitter

theme_set(theme_bw())

cols <- wes_palette(name = "IsleofDogs1")
Each project closes with a table summarising the R tools used. By visualising my most frequently used packages and functions I get a sense of where I may most benefit from going deeper and keeping abreast of the latest breaking changes. I may also spot superseded functions e.g. ...
[Read more...]

Moving House

July 25, 2020 | R | Quantum Jitter

After reading up on Blogdown, I decided to take the plunge and move my Wordpress blog thinkr to Hugo Academic + Netlify as Quantum Jitter. Motivation My existing site looks (soon-to-be looked) pretty good. But it’s expensive to maintain. I was sp... [Read more...]

East-West Divide

January 8, 2019 | R | Quantum Jitter

theme_set(theme_bw())

cols <- wes_palette(8, name = "FantasticFox1", type = "continuous")
When tensions heightened at the United Nations early in 2019, I wondered whether we had drawn closer, or farther apart, over the decades since the body was established in 1945. I’ll see if I can garner a clue by performing cluster analysis on the General Assembly voting of five of ...
[Read more...]

Bigger & Brighter

December 31, 2018 | R | Quantum Jitter

In Criminal Goings-on I initially got a sense of the data using a static facet plot. This is a great visualisation tool building on the principle of small multiples. There may come a point though where the sheer volume of small multiples make it harder to “see the wood for ...
[Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)