6 Day 6 (June 10)

6.1 Announcements

  • Assignment 1 is graded
    • General grading scheme
    • General comments about reproducibility
      • Too much computer code
      • No or not enough computer code
      • Computer code formatting (e.g., running over the page edge)
  • Questions about assignment 2

6.2 Estimation

  • Three options to estimate \(\boldsymbol{\beta}\)
    • Minimize a loss function
    • Maximize a likelihood function
    • Find the posterior distribution
    • Each option requires different assumptions

6.3 Loss function approach

  • Using modern (circa 1970’s) optimization techniques

    y <- c(0.16,2.82,2.24)
    x <- c(1,2,3)
    
    optim(par=c(0,0),method = c("Nelder-Mead"),fn=function(beta){sum((y-(beta[1]+beta[2]*x))^2)})
    ## $par
    ## [1] -0.3399977  1.0399687
    ## 
    ## $value
    ## [1] 1.7496
    ## 
    ## $counts
    ## function gradient 
    ##       61       NA 
    ## 
    ## $convergence
    ## [1] 0
    ## 
    ## $message
    ## NULL
  • Using modern and user friendly statistical computing software

    df <- data.frame(y = c(0.16,2.82,2.24),x = c(1,2,3))
    lm(y~x,data=df)
    ## 
    ## Call:
    ## lm(formula = y ~ x, data = df)
    ## 
    ## Coefficients:
    ## (Intercept)            x  
    ##       -0.34         1.04
  • Live example