




























































Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!





























































Statistical learning: a wide set of tools for understanding data. These tools can be classified as supervised or unsupervised. Data Science it was a synonymous of statistics. But then, some years later, they started to talk about a new discipline, is no longer just statistic, but it is different. Currently is no consensus on the definition of data science. In data science teamwork is very important. Data is used to help with marketing decision. Data Science is a discipline aimed at extracting knowledge from data in various forms it is applicable to a wide range of fields. Different level of human input in the descriptive (What happened?), diagnostic (Why did it happen?), predictive (What will happen?), and prescriptive statistics (What should I do?). Import tidy data. Then an exploration part we consider as a loop. And then the communication. Data are used to help make decisions. In general, a data-informed approach is the strategic option for more complex decisions It is important to have quality and complete data. We must have in mind the cycle of the data. Statistical learning:
Advertising data Aim: to give advice to a company on how to improve sales, by adjusting advertising budgets (advertising budgets: TV, Radio, Newspaper). In SL: to investigate the relationship between sales and the three advertising budgets and develop a model to predict sales on basis of the three advertising budgets.
How estimate f? there is different approach to estimate f training data (a set of n data points used to train our method for estimating f): Our aim is to apply a SL method to the training data to estimate the unknown
We distinguish parametric and non-parametric SL methods. PARAMETRIC SL METHODS Parametric methods simplify the problem of estimating f to one of estimating set of parameters. NON-PARAMETRIC SL METHODS Non-parametric methods do not make explicit assumptions about the functional form of f: they look for an estimate of f that is as close as possible to the data points, without being too rough or too wiggly.
Nonparametric SL are sometimes a lot complicated, we need a lot of data There exist a trade-off between flexibility (and prediction accuracy) and model interpretability. When we are only interested in inference, simple and relatively inflexible SL methods are preferable. When we are only interested in prediction, the most flexible SL methods are sometimes preferable (they can suffer from overfitting).
the true response value yi. Data with three different model, we are increasing the level of flexibility of the model moving from orange to blue to green. The best model that fit the
estimated it using a different training set. In general, more flexible SL methods have higher variance.
and measures the error introduced by approximating a real phenomenon by a model. In general, more flexible SL methods have lower bias. General rule: as flexibility increases, variance will increase and bias will decrease; the test MSE will increase or decrease, depending on the relative change of variance and bias. The aim is to find a SL method with low variance and low squared bias. THE BAYES CLASSIFIER The test error rate is minimized, on average, by the Bayes classifier. It is a very simply method that assigns each observation to the most likely class, given its predictor values. Given a test observation with predictor x 0 , we assign it to the class j for which the conditional probability is largest. If I have a new observation that has a predicted values x1 and x2, I will classified the customer in the blue category. We have an area where the probability to be orange is
under 50%. (Nell’angolo in basso a destra la probabilità che sia arancione è zero la probabilità che sia blu quindi è del 100%.) In the example (simulated data): Bayes error rate = 0. The Bayes error rate is analogous to the irreducible error. For real data, the Bayes classifier cannot be computed, because the conditional distribution of Y given X is unknown. In practice, SL classification methods estimate the conditional distribution of Y given X and classify a given observation to the class with the highest estimated probability. Examples:
About the Multiple LRM we must made some classical assumption: With p = 2 the LS regression line becomes a plane, that minimize the sum of the squared vertical distances between each observation and the plane. The OLS estimates of the parameters minimize the objective function (Residual Sum of Squares-RSS), each estimate Betaj is a linear transformation of y like y^. Under the classical assumptions, the OLS estimators: are BLUE: best (most efficient) linear unbiased estimators in the class of linear and unbiased estimators (Gauss Markov theorem). under general conditions, they have optimal asymptotic properties (consistency, asymptotic Normality -if errors are independent- and efficiency in the class of unbiased estimators for Beta). The Residual Standard Error RSE and the variance-covariance matrix of the OLS estimators: In order to apply the ML estimation method, we add a new error to the classical assumptions. The ML estimators for Beta do coincide with the OLS estimators, they have the same properties
The estimate of 𝛽𝑗 can be interpreted as the average effect on 𝑌 of a one-unit increase in 𝑋𝑗 , holding all other predictors fixed, In order to compare the effects 𝛽𝑗 of several predictors we compute the so-called Beta coefficients where s is the estimate of the standard deviation. Beta coefficients do coincide with the parameter estimates of the model where all variables (both response and predictors) are previously standardized. Confidence interval and tests for beta The confidence interval provides a set of plausible values for 𝜗 that includes 𝜗 with a high level of confidence. We can just invoke the long run relative frequency interpretation of probability and say that we are highly confident that it includes 𝜗. Hypothesis tests for parameters: Standard errors are also used to perform hypothesis tests on the parameters; there are two possible tests: T = ß-b over SE and T = ß over SE.
When 𝑝 is very large with 𝑝 > 𝑛, the 𝐹-statistic cannot be used (we cannot even fit the multiple LRM). There exist another F-statistic useful to test that a particular subset of 𝑞 of the parameters are zero. F-statistic for a subset of q predictors: Do all the predictors help to explain 𝑌, or is only a subset of the predictors useful? Identifying which predictors are associated with 𝑌 in order to fit a model involving only those predictors is referred to as variable selection. Classical approaches for variable selection are the stepwise procedures (which must be performed within the theoretical framework of the application field). The stepwise procedure compares several different models, each containing a different subset of the predictors, and selects the best model according to a measure of model quality To judge the quality of a model, we can use several indices. The most common are in the class of the Information Criteria, like AIC and BIC. Where L is the max value of the likelihood function and k the n of model parameters, the model with lowest AIC or BIC is selected as the best model. In general, the indices of model quality are defined as a function of the number of parameters in order to take account of the trade-off between: the improvement of the goodness of fit the worsening of parsimony (and therefore of interpretability) Starting with 𝑝 predictors, there exist 𝟐^𝒑 models each containing a different subset of the predictors. We need an automated approach to choose a smaller set of models to consider Three classical approaches: Forward selection: start from the null model and adds one variable at each step Backward selection: start from full model and exclude one variable at step (p How well does the model fit the data? We can use the RSE (Residual Standard Error) that measures the lack of fit of the model to the data It is an absolute measure (measured on units of 𝑌) or the R square statistic (coefficient of determination): To determine what is a good value of 𝑅2 can be difficult and depends on the application. Use of the model: We can use it for the description and interpretation but also fort the prediction of future value (prediction in a strict sense), of a value between other two values (interpolation) and estimation of a missing value (imputation). At the end we can use the model for simulation and control (reverse and not regression) or for stability studies. Given a set of predictor values, what response value should we predict, and how accurate is our prediction? We must distinguish: the prediction of the expected value of 𝑌 associated with a given value of 𝑋 and the prediction of a single value of 𝑌 associated with a given value of 𝑋. Associated to the model there are some uncertainties: this inaccuracy is related to the reducible error, To measure how close 𝑌^ is to 𝑓(𝑋), we can compute a confidence interval for 𝒇(𝑿) (𝑓 (𝑋) the expected value 𝐸(𝑌|𝑋) of the dependent variable) assuming a linear model for 𝑓 𝑋 is an approximation, so there is a model bias (another source of reducible error) even if we knew the true 𝑓 𝑋 (so the true parameters), 𝑌 cannot be predicted perfectly because of the random error 𝜖 in the model (irreducible error)
Slide 14: Xsouth Xwest 1 1 0 2 1 0 3 0 1 4 0 0 β 0 : average balance for individuals from the East β 0 + β 1 : average balance for individuals from the South β 1 : difference in the average balance between individuals from the South versus the East β 0 + β 2 : average balance for individuals from the West β 2 : difference in the average balance between individuals from the West versus the East. The choice of the reference category is arbitrary. The final predictions for each group will be the same regardless of this choice. However, estimates and their p-values do depend on the coding scheme. Rather than rely on individual coefficients, we can use F-test for all predictors, testing:
The fourth person is from East, beacuse he is not from South and neither from West (referred to upper table). Xsouth Xwest Xeast 1 1 0 0 2 1 0 0 3 0 1 0 4 0 0 1 Attention to the problem of multicollinearity, in this case if we add the column of 1 of the intercepts there is a problem with multicollinearity, so we must not include that column.
We extend the linear model to accommodate nonlinear relationships, in order to remove the linearity assumption, stating that the relationship between the response and predictors is linear, that is the change in Y associated with one-unit increase in Xj is constant (does not depend on the value of Xj). Polynomial regression: includes polynomial functions of the predictors in the linear regression model. We still have a linear regression model, but it is able to incorporate nonlinear associations.
identifying nonlinearity. As already seen, the presence of pattern in the residual plot may indicate the presence of nonlinearity. If the residual plot indicates that there are non-linear associations in the data, then a simple approach is to include non-linear transformations of the predictors in the model. For example, log(X), (^) √ X and X^2. Other more advanced non-linear approaches can be proposed.