Presentation is loading. Please wait.

Presentation is loading. Please wait.

I OWA S TATE U NIVERSITY Department of Animal Science Model Development and Selection of Variables Animal Science 500 Lecture No. 11 October 7, 2010.

Similar presentations


Presentation on theme: "I OWA S TATE U NIVERSITY Department of Animal Science Model Development and Selection of Variables Animal Science 500 Lecture No. 11 October 7, 2010."— Presentation transcript:

1 I OWA S TATE U NIVERSITY Department of Animal Science Model Development and Selection of Variables Animal Science 500 Lecture No. 11 October 7, 2010

2 I OWA S TATE U NIVERSITY Department of Animal Science Class Statement u Variables included in the CLASS statement referred to as class variables. u Specifies the variables whose values define the subgroup combinations for the analysis. n Represent various level of some factors or effects l Treatment (1,….n) l Season (spring, summer, fall, and winter coded 1 through 4) l Breed l Color l Sex l Line l Day l Laboratory

3 I OWA S TATE U NIVERSITY Department of Animal Science Class Variables u Are usually things you would like to account for in your model u Can be numeric or character u Can be continuous values u They are generally not used in regression analyses n What meaning would they have

4 I OWA S TATE U NIVERSITY Department of Animal Science Class Statement Options u Ascending sorts class variable in ascending order u Descendingsorts class variable in descending order Other options with the Class statement generally related to the procedure (PROC) being used and thus will not cover them all

5 I OWA S TATE U NIVERSITY Department of Animal Science Discrete Variables u A discrete variable is one that cannot take on all values within the limits of the variable.variable n Limited to whole numbers n For example, responses to a five-point rating scale can only take on the values 1, 2, 3, 4, and 5. n The variable cannot have the value 1.7. A variable such as a person's height can take on any value. Discrete variables also are of two types: 1. unorderable (also called nominal variables) 2. orderable (also called ordinal)

6 I OWA S TATE U NIVERSITY Department of Animal Science Discrete Variables u Data sometimes called categorical as the observations may fall into one of a number of categories for example: n Any trait where you score the value l Lameness scores l Body condition scores l Soundness scoring  Reproductive  Feet and leg l Behavioral traits  Fear test  Back test  Vocal scores l Body lesion scores

7 I OWA S TATE U NIVERSITY Department of Animal Science Discrete Variables u When do discrete variables become continuous or do they? u What is a trait like number born alive considered discrete or continuous?

8 I OWA S TATE U NIVERSITY Department of Animal Science Model Development and Selection of Variables Example: The general problem addressed is to identify important soil characteristics influencing aerial biomass production of marsh grass, Spartina alterniflora.

9 I OWA S TATE U NIVERSITY Department of Animal Science Assumptions of the Linear Regression Model 1. Linear Functional form 2. Fixed independent variables 3. Independent observations 4. Representative sample and proper specification of the model (no omitted variables) 5. Normality of the residuals or errors 6. Equality of variance of the errors (homogeneity of residual variance) 7. No multicollinearity 8. No autocorrelation of the errors 9. No outlier distortion

10 I OWA S TATE U NIVERSITY Department of Animal Science Explanation of the Assumptions 1. Linear Functional form n Does not detect curvilinear relationships 2. The Observations are Independent observations n Representative sample from some larger population n If the observations are not independent results in an autocorrelation which inflates the t and r and f statistics which in turn distorts the significance tests 3. Normality of the residuals n Permits proper significance testing similar to ANOVA and other statistical procedures 4. Equal variance (or no heterogenous variance) n Heteroskedasticity precludes generalization and external validity n This too distorts the significance tests being used 5. Multicollinearity (many of the traits exhibit collinearity) n Biases parameter estimation. n Can prevent the analysis from running or converging (getting your answers) 6. Severe or several outliers will distort the results and may bias the results. n If outliers have high influence and the sample is not large enough, then they may serious bias the parameter estimates

11 I OWA S TATE U NIVERSITY Department of Animal Science Example Data Origination (Dr. P. J. Berger) Data: The data were published as an exercise by Rawlings (1988) and originally appeared as a study by Dr. Rick Linthurst, North Carolina State University (1979). The purpose of his research was to identify the important soil characteristics influencing aerial biomass production of the marsh grass, Spartina alterniflora in the Cape Fear Estuary of North Carolina. The design for collecting data was such that there were three types of Spartina vegetation, in each of three locations, and five random sites within each location vegetation type.

12 I OWA S TATE U NIVERSITY Department of Animal Science Example Variables Data: The dependent variable (what is being measured) is aerial biomass and there are five substrate measurements: (These are the independent variables) 1. Salinity, 2. Acidity, 3. Potassium, 4. Sodium, and Zinc. u Objective:

13 I OWA S TATE U NIVERSITY Department of Animal Science Example Data u Objective: u Find the substrate variable, or combination of variables, showing the strongest relationship to biomass. Or, u From the list of five independent variables of salinity, acidity, potassium, sodium, and zinc, find the combination of one or more variables that has the strongest relationship with aerial biomass. u Find the independent variables that can be used to predict aerial biomass.

14 I OWA S TATE U NIVERSITY Department of Animal Science Example analysis u The REG Procedure INTRODUCTION u The REG procedure fits least-squares estimates to linear regression models. u SPECIFICATIONS n PROC REG; l MODEL dependents = regressors / options;

15 I OWA S TATE U NIVERSITY Department of Animal Science Example analysis u The RSQUARE Procedure RECALL u The RSQUARE procedure selects optimal subsets of independent variables in a multiple regression analysis

16 I OWA S TATE U NIVERSITY Department of Animal Science Example analysis PROC RSQUARE options; MODEL dependents = independents / options; (options can appear in either PROC RSQUARE or any MODEL statement). n SELECT = n specific maximum number of subset models n INCLUDE = I requests that the first I variables after the equal sign be included in every regression n SIGMA = n specifies the true standard deviation of the error term n ADJRSQ computes R2 adjusted for degrees of freedom n CP computes MALLOWS’ Cp statistic

17 I OWA S TATE U NIVERSITY Department of Animal Science Example analysis PROC RSQUARE options; MODEL dependents = independents / options; (options can appear in either PROC RSQUARE or any MODEL statement). PROC RSQUARE DATA=name OUTEST=EST ADJRSQ MSE CP; SELECT=n; MODEL = variable list;

18 I OWA S TATE U NIVERSITY Department of Animal Science Example analysis PROC PRINT DATA=EST; PROC PLOT; PLOT _CP_*_P_ = ‘C’ _P_*_P_ = ‘P’ / OVERLAY; PLOT _MSE_*_P_ = ‘M’; Run; Quit

19 I OWA S TATE U NIVERSITY Department of Animal Science PROC STEPWISE The STEPWISE procedure provides five methods for stepwise regression. General form: PROC STEPWISE; MODEL dependents = independents / options; Run; Quit; ** Assumes that you have at least one dependent variable and 2 or more independent variables. If only one independent variable exists then you are just doing a simple regression of x on y or y on x.

20 I OWA S TATE U NIVERSITY Department of Animal Science Types of Regression u Uses of PROC REG for standard problems: 1. PROC REG; /* simple linear regression */ model y = x; 2. PROC REG; /* weighted linear regression */ model y = x; weight w; 3. PROC REG; /* multiple regression */ model y = x1 x2 x3;

21 I OWA S TATE U NIVERSITY Department of Animal Science PROC REG General form: PROC REG; MODEL dependents = independents / options; Options available include: NOINT – regression with no intercept FORWARD A forward selection analysis starts out with no predictors in the model. Each predictor that that was chosen by the user is evaluated with respect to see how much the R 2 is increased by adding it to the model. The predictor that increases the R 2 will be added if it meets the statistical conditions for entry With SAS the statistical conditions is the significance level for the increase in the R 2 produced by addition of the predictor. If no predictor meets the condition, the analysis stops. If a predictor is added, then the second step involves re-evaluating all of the available predictors which have not yet been entered into the model. If any satisfy the statistical condition for entry, the predictor increasing the R 2 the greatest is added. This process is continued until no predictors remain that could enter.

22 I OWA S TATE U NIVERSITY Department of Animal Science PROC REG General form: PROC REG; MODEL dependents = independents / options; Options available include: BACKWARD In a backwards elimination analysis we start out with all of the predictors in the model. At each step we evaluate the predictors which are in the model and eliminate any that meet the criterion for removal. STEPWISE Stepwise selection begins similar to forwards selection. However at each “step” variables that are in the model are first evaluated for removal. Those meeting removal criteria are evaluated to see which would lower the R 2, the least. How does this work where a variable enters and then might leave later? If two predictors ultimately enter the model, one may be removed because they are well correlated and removing one impacts the R 2 very little if at all.

23 I OWA S TATE U NIVERSITY Department of Animal Science PROC REG General form: PROC REG; MODEL dependents = independents / options; Options available include: MAXR The maximum R 2 option does not settle on a single model. Instead, it tries to find the "best" one-variable model, the "best" two-variable model, and so forth., MAXR starts out by finding the single variable model producing the greatest R 2 After finding the one variable MAXR then another variable is added until it finds the variable that increases the R 2 the most. It continues this process until it stops where the addition of another variable is no better than the previous (i.e. adding the 4 th variable did not significantly improve the R 2 compared to the 3 variable model for example. The difference between the STEPWISE and MAXR options is that all switches are evaluated before any switch is made in the MAXR method. Using the STEPWISE option, the "worst" variable may be removed without considering what adding the "best" remaining variable might accomplish.

24 I OWA S TATE U NIVERSITY Department of Animal Science PROC REG General form: PROC REG; MODEL dependents = independents / options; Options available include: MINR The MINR option closely resembles the MAXR method. However, the switch chosen with the MINR option is switch that produces the smallest increase in R 2. In a way approaching the “best” model in reverse compared to MAXR.

25 I OWA S TATE U NIVERSITY Department of Animal Science PROC REG General form: PROC REG; MODEL dependents = independents / options; Options available include: SLE=value This option sets some criterion for entry into the model. This can be defined by the user by meeting some level of change or Δ to the R 2 SLS=value This option sets some criterion for staying or remaining in the model. This can be defined by the user by meeting some level of change or Δ to the R 2 to stay in the model.

26 I OWA S TATE U NIVERSITY Department of Animal Science PROC REG u The default statistical levels for each type of regression analysis is different unless it is changed by the user: u The defaults are: BACKWARD = 0.10 FORWARD = 0.10 STEPWISE = 0.15 User can set it by using the SLSTAY option for example / SLSTAY=.05.

27 I OWA S TATE U NIVERSITY Department of Animal Science Significance Tests for the Regression Coefficients 1. Finding the significance of the parameter estimates by using the F or t test (will see in a couple of slides) 2. R 2 = R-Square is the proportion of variation in the dependent variable (Y) that can be explained by the predictors (X variables) in the regression model. 3. Adjusted R 2 Predictors could be added to the model which would continue to improve the ability of the predictors to explain the dependent variable. Some of the improvement in the R-Square would be simply due to chance variation. The adjusted R-Square attempts to yield a more honest value to estimate R-Square. = 1-(1-R 2 ) (n-1)/(n-p-1) where R 2 = the unadjusted R 2 n = the number of number of observations, and p = the number of predictors

28 I OWA S TATE U NIVERSITY Department of Animal Science Significance Tests for the Regression Coefficients u The Mallows’ C p statistic u CP (C p ) = SSE / σ 2 + 2p – n where SSE = error sums of squares σ 2 = the estimate of pure error variance from the SIGMA = option for from fitting the full model p = the number of parameters including the intercept, and n = the number of observations

29 I OWA S TATE U NIVERSITY Department of Animal Science F and T tests for significance for overall model


Download ppt "I OWA S TATE U NIVERSITY Department of Animal Science Model Development and Selection of Variables Animal Science 500 Lecture No. 11 October 7, 2010."

Similar presentations


Ads by Google