# Daryn Ramsden

## Machine Learning example in R: Predicting vehicle fuel efficiency

This notebook is an example of using R to tackle a prediction problem using machine learning. The aim is to fit a model that predicts a vehicle’s fuel efficiency - as measured in miles per gallon (MPG) - of vehicles, using the known values of other characteristics of the vehicle. This particular example was most-immediately inspired by a case study in the excellent free online course Supervised Machine Learning Case Studies in R developed by Julia Silge.

## Exploring scikit-learn: linear regression

While I consider myself to be a proficient Python programmer generally, I have definitely used R much more in the recent past. R is my preferred language for doing data-centric tasks but I would like to improve my fluency with tools in the Python Data Analysis ecosystem. In particular, I intend to make a concerted effort to learn the scikit-learn library for Machine Learning in Python. In this notebook, I work through simple examples of using scikit-learn to do linear regression.

## Making a calendar visualization with ggplot2

Earlier this week, I had made a calendar visualization of some data that I had come across participating in TidyTuesday in December. The data set was the set of tickets issued for parking violations in the city of Philadelphia, Pennsylvania in 2017. Originally, I had made a few other visualizations and a friend of mine had mentioned that they would be interested in seeing visualizations of the revenues generated by the city due to these parking tickets.

## Intro to Making maps with ggplot2

The sf package Using read_sf to read in a GeoJSON file A note on using shapefiles Using ggplot2 with geom_sf First map with geom_sf Adding labels with geom_sf_text Changing the theme of a map Getting some other data Joining an sf object to another dataframe Making a chloropleth map Changing the scale Using the viridis scale Manually setting a continuous scale Using a divergent scale Using a discrete scale Plotting points on the map Interactive maps with plotly This post is about using the ggplot2 package to make simple maps using R.

## Portfolio Analysis with R

R packages used Choosing a portfolio Getting the data (from Yahoo Finance) Breaking down the code above Getting monthly returns Filtering the data Calculating returns Adding portfolio weights Ok, now for some useful calculations Standard Deviation of returns Table of Downside Risks Table of Drawdowns SemiDeviation Sharpe ratio Returns summary Visualizing portfolio performance Combining all returns into one object Plotting portfolio returns Visualizing each component compared to the portfolio Using highcharter Computing rolling standard deviations.