Skip to content
View RobHayward's full-sized avatar
Block or Report

Block or report RobHayward

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
RobHayward/README.md

Hi there 👋

Rob Hayward.

These are a mixture of class notes, research and mini-projects.

  • Class notes include lecture notes and slides. Feel free to use and develop.

  • Research is mostly in the area of foreign exchange, speculation and capital flows.

  • There a mixture of R, python and tikz projects.

Pinned

  1. Use colour brewer Use colour brewer
    1
    library(RColorBrewer)
    2
    colors <- brewer.pal(n = 4, "Greens")
  2. fedfunds.R fedfunds.R
    1
    ##
    2
    ## John Taylor proposed the following rule designed to guide monetary policy:
    3
    ## i = r* + pi + 0.5 ( pi - pi*) + 0.5 ( y - y*)
    4
    ## where i is the nominal federal funds rate, r* is the "natural" real federal funds rate (often taken to be 2%), pi is the rate of inflation, pi* is the target inflation rate (for example, 2%), y is the logarithm of real output, and y* is the logarithm of potential output.
    5
    ## The two basic ideas here are to raise the federal funds rate to one-half the extent that inflation exceeds its target and to lower the federal funds rate to one-half of the percentage that real output falls below its potential.  Implicit in this formulation is that a reasonable rule of thumb applied consistently over time is more likely to achieve a good outcome than is aggressive manipulation of monetary policy.  It is widely believed that central banks have paid close attention to variations on this Taylor Rule in recent years.
  3. Flip data frame so that order is rev... Flip data frame so that order is reversed
    1
    BAC$Date <- as.Date(BAC$Date, format = "%d/%m/%Y")
    2
    BAC <- BAC[,c(1,7)]
    3
    colnames(BAC) <- c("Date", "Close")
    4
    BAC <- BAC[rev(rownames(BAC)),]
    5
    head(BAC)
  4. acf.R acf.R
    1
    # This is not mine.  I forget whoes it is.  Sorry.  By all means let me know and I will add it
    2
    acf2=function(series,max.lag=NULL){
    3
      num=length(series)
    4
      if (is.null(max.lag)) max.lag=ceiling(10+sqrt(num))
    5
      if (max.lag > (num-1)) stop("Number of lags exceeds number of observations")
  5. Percentage change in a data frame Percentage change in a data frame
    1
    # create the lagged variable
    2
    da$GDPl <- c(rep(NA, 1), da$GDP)[1:length(da$GDP)]
    3
    # calculate the percentage
    4
    da$GDPr <- (da$GDP - da$GDPl)/da$GDPl
    5
    
                  
  6. myStats myStats
    1
      if (na.omit)
    2
        x <- x[!is.na(x)]
    3
      n <- length(x)
    4
      m <- mean(x)
    5
      s <- sd(x)