Skip to content

Instantly share code, notes, and snippets.

@tradingbills
Created August 2, 2020 17:54
Show Gist options
  • Select an option

  • Save tradingbills/5f7db5f3534193b97bf65099b67470b7 to your computer and use it in GitHub Desktop.

Select an option

Save tradingbills/5f7db5f3534193b97bf65099b67470b7 to your computer and use it in GitHub Desktop.

Revisions

  1. tradingbills created this gist Aug 2, 2020.
    29 changes: 29 additions & 0 deletions z_score, x_value, empirical rule
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    z_score <- function(x, m, sd){
    return ((x-m)/sd)
    }

    x_val <- function(z, m, sd){
    return (z*sd + m)
    }

    m <- 100
    sd <- 15
    z_score(130, m, sd)
    pnorm(2)
    a <- 1 - pnorm(2)
    b <- 1 - pnorm(-2)
    b - a
    1-.9772499
    # https://www.youtube.com/watch?v=mai23vW8uFM
    # How many people have an IQ above an IQ of 130, where the mean is 100 and the sd is 15
    m <- 100
    sd <- 15
    1 - pnorm(z_score(130, m, sd))

    # How many people have an IQ above an IQ of 145, where the mean is 100 and the sd is 15
    1 - pnorm(z_score(145, m, sd))

    # https://www.youtube.com/watch?v=CjF_yQ2N638&list=PLiIsR5PZj8mvM09Zl5X8CqK8uhUdo1cow&index=2&t=287s 7:46
    x_val(1.4, 50, 10)

    z_score(30, 50, 10)