covariance and correlation
play

Covariance and correlation P RACTICIN G S TATIS TICS IN TERVIEW - PowerPoint PPT Presentation

Covariance and correlation P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R Zuzanna Chmielewska Actuary Covariance and correlation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R PRACTICING STATISTICS INTERVIEW QUESTIONS IN R


  1. Covariance and correlation P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R Zuzanna Chmielewska Actuary

  2. Covariance and correlation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  3. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  4. Covariance Formula for a sample: n ( x − ) ⋅ ( y − ) ∑ i =1 x y i i cov ( X , Y ) = n − 1 Formula for a population: ( x − ) ⋅ ( y − ) n ∑ i =1 x y i i cov ( X , Y ) = n PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  5. Covariance Formula for a sample: n ( x − ) ⋅ ( y − ) ∑ i =1 x y i i cov ( X , Y ) = n − 1 PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  6. Covariance Formula for a population: ( x − ) ⋅ ( y − ) n ∑ i =1 x y i i cov ( X , Y ) = n PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  7. Covariance - numerical example x = 3, x = 5, x = 7 ( x − ) ⋅ ( y − ) = 14 n ∑ i =1 x y 1 2 3 i i i i n ( x − )⋅( y − ) ∑ i =1 y = 6, y = 11, y = 13 x y = 7 1 2 3 n −1 = 5 x = 10 y ( x − ) ⋅ ( y − ) = 8 x y 1 1 ( x − ) ⋅ ( y − ) = 0 x y 2 2 ( x − ) ⋅ ( y − ) = 6 x y 3 3 PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  8. Correlation coef�cient cov ( X , Y ) corr ( X , Y ) = σ ⋅ σ x y PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  9. Correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  10. Correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  11. Correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  12. Correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  13. Correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  14. Correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  15. Nonlinear relationships PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  16. Correlation does not imply causation! PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  17. Summary covariance correlation coef�cient PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  18. Let's practice! P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R

  19. Linear regression model P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R Zuzanna Chmielewska Actuary

  20. Linear regression model PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  21. Linear regression model PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  22. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  23. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  24. Linear regression model y = β + β ⋅ x + ... + β ⋅ x + e 0 1 i 1 i p ip i where: y - dependent variable, i x - independent variables, ij β - parameters, j e - error. i PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  25. Linear predictor function ^ = β + β ⋅ x + ... + β ⋅ x y i 0 1 i 1 p ip PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  26. ^ = β + β ⋅ x y i 0 1 i PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  27. ^ = β + β ⋅ x y i 0 1 i PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  28. ^ = β + β ⋅ x y i 0 1 i PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  29. ^ = β + β ⋅ x y i 0 1 i PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  30. Log-transformation Examples: ^ = β + β ⋅ ln ( x ) + ... + β ⋅ x y i 0 1 i 1 p ip ln ( ) = β + β ⋅ x ^ + ... + β ⋅ x y i 0 1 i 1 p ip PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  31. Assumptions Linear relationship Normally distributed errors Homoscedastic errors Independent observations PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  32. Linear model in R model <- lm(dist ~ speed, data = cars) print(model) Call: lm(formula = dist ~ speed, data = cars) Coefficients: (Intercept) speed -17.579 3.932 PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  33. Linear model in R model <- lm(dist ~ speed, data = cars) new_car <- data.frame(speed = 17.5) predict(model, newdata = new_car) 1 51.23806 PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  34. Diagnostic plots model <- lm(dist ~ speed, data = cars) plot(model) PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  35. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  36. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  37. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  38. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  39. Summary linear regression model linear predictor function lm() in R diagnostic plots PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  40. Let's practice! P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R

  41. Logistic regression model P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R Zuzanna Chmielewska Actuary

  42. Logistic regression's application PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  43. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  44. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  45. Logistic function 1 f ( x ) = 1 + e − x PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  46. Logistic function 1 f ( x ) = ∈ (0, 1) 1 + e − x PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  47. Logistic regression model Probability prediction: 1 p = P ( y = 1) = i i 1 + e −( β + β ⋅ x +...+ β ⋅ x ) 0 1 i 1 p ip Logit prediction: p i l = ln ( ) = β + β ⋅ x + ... + β ⋅ x 0 1 i 1 i p ip 1 − p i PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  48. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  49. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  50. Logistic regression in R model <- glm(y ~ x, data = df, family = "binomial") PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  51. Logistic regression in R model <- glm(y ~ x, data = df, family = "binomial") predict(model, newdata = new_df, type = "response") PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  52. Summary logistic regression model prediction of a binary response variable logistic regression in R with glm() PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  53. Let's practice! P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R

  54. Model evaluation P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R Zuzanna Chmielewska Actuary

  55. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  56. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  57. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  58. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  59. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  60. PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  61. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  62. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  63. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  64. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  65. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  66. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  67. Cross-validation PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  68. Confusion matrix PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  69. Confusion matrix PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  70. Confusion matrix PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  71. Confusion matrix PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  72. Classi�cation metrics TP + TN accuracy = TP + TN + F P + F N TP precision = TP + F P TP recall = TP + F N PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  73. Classi�cation metrics Precision Recall PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  74. Regression metrics PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  75. Regression metrics PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  76. Regression metrics Root Mean Squared Error √ 1 ∑ i =1 ^ i 2 RMSE = ( y − ) n y i n Mean Absolute Error 1 ∑ i =1 MAE = ∣ y − ^ i ∣ n y i n PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  77. Regression metrics Root Mean Squared Error Mean Absolute Error 1 ∑ i =1 √ 1 ∑ i =1 MAE = ∣ y − ^ i ∣ n y ^ i 2 RMSE = ( y − ) n y i n i n straightforward interpretation height weight to large errors PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  78. Summary validation set approach cross-validation confusion matrix classi�cation metrics regression metrics PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  79. Let's practice! P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R

  80. Wrapping up P RACTICIN G S TATIS TICS IN TERVIEW QUES TION S IN R Zuzanna Chmielewska Actuary

  81. Congratulations! PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  82. Chapter 1 Probability distributions: discrete distributions continuous distributions central limit theorem PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  83. Chapter 2 Exploratory Data Analysis: descriptive statistics categorical data time-series principal component analysis PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

  84. Chapter 3 Statistical tests: normality tests inference for a mean comparing two means ANOVA PRACTICING STATISTICS INTERVIEW QUESTIONS IN R

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend