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...]

How to manage credentials and secrets safely in R

August 1, 2020 | Bernardo Lares

Are you interested in guest posting? Publish at DataScience+ via your RStudio editor. Category Programming Tags credentials lares R Programming yaml yml If you have ever received an embarrassing message with a warning saying that you may have published your credentials or secrets when publishing your code, you know what ... [Read more...]

Handling R6 objects in C++

July 30, 2020 | Rcpp Gallery

Introduction When we are using R6 objects and want to introduce some C++ code in our project, we may also want to interact with these objects using Rcpp. With this objective in mind, the key to interacting with R6 objects is that they are essentially... [Read more...]

I like to MVO it!

July 30, 2020 | R on OSM

In our last post, we ran through a bunch of weighting scenarios using our returns simulation. This resulted in three million portfolios comprised in part, or total, of four assets: stocks, bonds, gold, and real estate. These simulations relaxed the allocation constraints to allow us to exclude assets, yielding a ...
[Read more...]

Spatial GLMM(s) using the INLA Approximation

July 30, 2020 | Corey S. Sparks, Ph.D.

The INLA Approach to Bayesian models The Integrated Nested Laplace Approximation, or INLA, approach is a recently developed, computationally simpler method for fitting Bayesian models [(Rue et al., 2009, compared to traditional Markov Chain Monte Carlo (MCMC) approaches. INLA fits models that are classified as latent Gaussian models, which are applicable ...
[Read more...]

rfm 0.2.2

July 30, 2020 | Rsquared Academy Blog - Explore Discover Learn

We’re excited to announce the release of rfm 0.2.2 on CRAN! rfm provides tools for customer segmentation using Recency Frequency Monetary value analysis. It includes a Shiny app for interactive segmentation. You can install rfm with:
install.packages("rfm")
In this blog post, we will summarize the changes implemented in the current (0.2.2) ...
[Read more...]
1 42 43 44 45 46 1,731