STATISTIC Simple regression 1
Problem : Can we explain the price of the ski pass by the number of ski runs? 2
3
4
5
Data STATION PIS PFJ Max 27 110 Eaux Bonnes Courette 30 100 Font Romeu 40 140 Luz 33 113 La Mongie 70 138 Piau Engaly 37 119 Saint Lary 47 135 La Bonhomme 13 85 La Bresse 39 126 Gérardmer 20 80 St Maurice Moselle 11 80 Ventron 10 110 Métabief 30 104 Monts Jura 33 109 Les Rousses 43 108 Super Besse 27 110 Mont Dore 30 110 Le Lioran 40 101 Auron 38 120 Beuil 59 130 Isola 2000 47 122 Montgenèvre 59 145 Orcières Merlette 42 145 Les Orres 29 135 Pra Loup 73 154 Puy Saint Vincent 30 125 Risoul 103 152 Sauze Super Sauze 35 126 Serre Chevalier 109 185 Super Dévoluy La Joue 60 132 Valberg 58 130 La Foux Val d'allos 32 154 Le Seignus Val d'allos 15 122 Vars 107 152 Avoriaz 44 168 Les Carroz 103 146 Chamonix 69 241 Chatel 40 153 La Clusaz 76 153 Combloux 35 110 Les Contamines 44 159 Flaine 132 163 Les Gets 65 150 Le Grand Bornand 47 142 Les Houches 22 148 Megève 125 176 Morillon 96 146 Morzine 80 150 Praz sur Arly 24 106 Praz de Lys 43 85 St Gervais 125 188 Samoens 127 146 Thollon 18 86 Les Aillons 42 99 Les Arcs 121 215 Areches Beaufort 30 110 Aussois 21 90 Bessans 4 70 Bonneval sur arc 18 110 Le Corbier 36 122 Courchevel 102 192 Crest Voland Corennoz 26 102 Flumet 20 50 Les Karellis 28 98 Les Menuires 61 189 Meribel 73 192 La Norma 25 115 Notre Dame de Belleco 32 110 La Plagne 123 223 Pralognan 20 112 La Rosière 33 145 Les Saisies 30 119 St François Longchamp 28 124 St Martin de Belleville 62 189 St Sorlin d'arves 26 109 La Tania 102 192 Tignes 65 224 La Toussuire 89 122 Val Cenis 39 92 Valfréjus 20 95 Val d'isère 135 224 Valloire 75 148 Val Meinier 76 148 Valmorel la Belle 82 152 Val Thorens 54 148 Alpe d'huez 108 197 Alpe du Grand Serre 34 107 Auris 19 104 Autrans 18 78 Chamrousse 36 136 Le Collet d'allevard 18 99 Les 2 Alpes 70 188 Lans en Vercors 19 78 Meaudre 17 78 St Pierre de Chartreuse 26 95 Les 7 Laux 42 135 Vaujany 32 118 Villard de Lans 32 135 6
The fit line 7
Least squares method 1600 1400 ^ y=b 0 + b 1 x We re looking for Real value Predicted value y i 1200 1000 800 600 400 error e i ŷ i * b 0 et b 1 minimizing n i= 1 2 e i 200 Prix 0 0 100 200 300 Surface x i 8
Output SPSS PSP=88,459 + 0,873 RUN + residu 9
Model s quality Decomposition (y y) = (ŷ y) + i 2 i 2 e 2 i Total Sum of Squares Regression Sum of Squares Residual Sum of Squares So 1 = RegSS/TSS + ResSS/TSS R 2 10
R 2 Cor(X,Y) = sign (b1) R 2 11
What can we see with the R 2? 1) 0 R 2 1 2) R 2 = 1 3) R 2 = 0 Y * * * * * X Y y * * * * * * * * * * * * X 12
What can we see with the Cor(X,Y)? Y * * * * * * * ** * * * * * Y aˆ > 0 X Cor( X, Y) > 0 aˆ < 0 Cor( X, Y ) < 0 X 13
Direct calculation for Cor(X,Y) * y = ( y y)/ y y Cor( X, Y ) = ( x x)( y y) i ( x x) ( y y) i i 2 2 i SPSS Results : * x = ( x x)/ x x 14
Is Cor(X,Y) significant with a risk α = 0.05? Decision s rule Test : H 0 : Cor(X,Y) = 0 H 1 : Cor (X,Y) 0 We reject H 0 with a risk α = 0.05 of mistakes if Cor( X, Y ) 2 n (we need n > 20) 15
Calcul direct de R Nous faisons 0% d erreur en disant que prix forfait jour et nb de pistes sont liées. Nous faisons 41% d erreur en disant que prix forfait jour et kilométrage ski de fond sont liées. 16
The statistic s model for the simple regression Model : Y = b 1 X+ b 0 + ε, with ε N(0, σ) Y y = b 1 x + b 0 95% of Y s values Loi de Y * * μ x + 1.96σ μ x = ax+b μ x - 1.96σ x X The standard deviation σ is about the scatter s quarter 17
Estimation for σ Estimation for σ : ˆ σ 2 ˆ σ = 1 = n 2 ˆ σ 2 n i= 1 2 e i = estimation deσ = estimation deσ 2 18
Forecast for Y? Modele : Y = b1x + b0 + ε, with ε N(0, σ) Problem : Calculate a forecast and an intervall with 95 % of Y s values when X =x? 19
prix forfait jour 300 200 100 0 0 35 32 41 45 38 85 84 71 43 25 82 39 8348 47 27 44 36 34 24 9890 3 23 22 967 33 73 2628 3130 72 9760 21 20 5 78 59 7067 19 9 6 12 91 8849 75 16 156 17 68 14 62 87 4 13 40 15 8095 642 18 54 57 79 11 853 50 9493 89 10 58 63 20 Observations atypiques 40 65 74 92 66 60 37 77 80 61 76 86 29 100 69 81 55 51 46 42 52 120 140 nb pistes 20
Outlier A value y is an outlier if it doesn t belong to his own forecast s intervall : y [ ŷ ± t 0.975 (n 2) σ ˆ 1+ 1 n + n i = 1 (x x) (x i 2 x) 2 ] So : y [ŷ ± 2σˆ ] soit e = y ŷ > 2σˆ Conclusion : A value is an outlier if its standardized e i residual is above 2. σˆ 21
22
Multiple regression : Maybe are there other variables to explain PFJ 23
explain PFJ by variables Multiple regression Objective : 1. AST Altitude station 2. REM Nb of Ski tows (remonte pente) 3. API Altitude Ski run 4. PIS Nb of ski run (pistes) 5. KMF Cross country run (Km) (ski de fond) 6. LIT Nb bed 7. HOT Nb hotel What is the best model available? First, we try to make a linear model as : Y = b 0 + b 1 X 1 + b 2 X 2 + + b k X k + ε 24
O n définitles vecteurs suivants Y = Y 1 Y 2. Y n β = β 0. β k ɛ= ɛ 1 ɛ 2. ɛ n et lamatrice X = 1 x 11 x 1k.... 1 x i1 x ik.... 1 x n1 x nk Y =Xβ+ɛ. 25
Ilfaut rechercher b 0,b 1,,b k telque soitminimum. n i= 1 (y i b 0 b 1 x i1 b k x ik ) 2 oùw estle sous espace vectorielengendréparles vecteurs 1,x 1,x 2,,x k. 26
(y Xb) x j = 0pourj= 0,,n. Donc(y Xb) X = 0 soitx (y Xb)= 0 etdoncx y =X Xb. Ilsuffi t donc de calculer b =(X X) 1 X y. 27
Ilfaut rechercher b 0,b 1,,b k telque soitminimum. n i= 1 (y i b 0 b 1 x i1 b k x ik ) 2 oùw estle sous espace vectorielengendréparles vecteurs 1,x 1,x 2,,x k. 28
Résultats logiciel PSP= +52.646-0.002 AST -0.011 TOW +0.019 ARUN +0.430 RUN -0.074 KCC +0.002 BED -0.037 HOT + residu 29
The global quality of a model between Y and X 1,,X k? Model : Y = β 0 + β 1 X 1 + + β k X k + ε Test : H 0 : β 1 = = β k = 0 H 1 : At least one β j 0 Statistic : (ŷi y) / k F = 2 e /(n k 1) i 2 Reject of H 0 with a risk α : Reject of H 0 if F F 1-α (k, n-k-1) Fractil of Fisher-Snedecor distribution 30
What is the signification level (SIG)? The smallest value for α with a reject of H 0 Distribution F α SIG F 1-α (k,n-k-1) F calculated 31
Outputs SPSS The global quality of the model is good. 32
Estimation of σ (standard deviation of residual) Estimation of σ 2 : σˆ 2 = n n i= 1 e 2 i k 1 Estimation of σ : σ ˆ = σˆ 2 33
Forecast intervall for y i Model : Y i =b 0 + b 1 x 1i + + b k x ki + ε i Formule simplifiée : ŷ i ± 2 σˆ 34
But there is a problem! 35
Is the contribution of X j significant? Model : Y = β 0 + β 1 X 1 + + β j X j + + β k X k + ε Test : H 0 : β j = 0 H 1 : β j 0 Statistic used : t j = βˆ s j j Reject of H 0 with risk α : ˆ 1 où s = écart-type( β ) = j j 2 2 1 R (X j;autres X) (xji x j) i Reject of H 0 if t j t 1-α/2 (n-k-1) σˆ 2 Fractil of a Student distribution 36
What is the signification level (SIG)? The smallest value for α with a reject of H 0 Student distribution Sig/2 α/2 Sig/2 - t j 0 t j t 1-α/2 (n-k-1) We can reject «H 0 : β j = 0» with a risk α if Sig α 37
Which are the significant variables in this model (α = 0.05)? 38
Selection of variables Method Backward Step 1 : model complete Each step : I will take out the variable X j with the smallest contribution : t j minimum or Sig(t j ) maximum while there are some variables non significant (while Sig(t j ) 0.1 = default value in SPSS). I compute a new model 39
40
41
42
Bon ski!!! 43