6.6 LAB: Backward selection using ols() The forestfires.csv data…
Question Answered step-by-step 6.6 LAB: Backward selection using ols() The forestfires.csv data… 6.6 LAB: Backward selection using ols() The forestfires.csv data base contains meteorological information and the area burned for 517 forest fires that occurred in Montesinho Natural Park in Portugal. The columns of interest are FFMC, DMC, DC, and ISI, as well as the response variable, area.Read in the file forestfires.csv.Use the ols() function to perform forward selection stepwise regression on the variables FFMC, DMC, DC, and ISI, in that order.Continue the stepwise regression until all the variables in the model have p-values less than 0.15.Ex: If the variable RH is used instead of FFMC, the output is:model1 p-values are Intercept 1.684306e-64RH 3.486263e-01DMC 2.350870e-02DC 1.556796e-03ISI 6.984705e-01dtype: float64model2 p-value is Intercept 3.247158e-76RH 3.108264e-01DMC 2.520680e-02DC 1.521100e-03dtype: float64model3 p-value is Intercept 2.969390e-136DMC 1.642624e-02DC 9.065366e-04dtype: float64# import the necessary modulesfires = # read in forestfires.csv# response variableY = # set area as the response variablemodel1 = # generate the multiple regression model for FFMC, DMC, DC, and ISI, in that order.# Prints the p-valueprint(“model1 p-values are “, model1.pvalues)# second step of backward regressionmodel2 = # generate the MLR model using the order FFMC, DMC, DC, and ISI. Ex: if DMC is removed, use Y ~ FFMC + DC + ISI.print(“model2 p-value is “, model2.pvalues)# Continue until no variables have p-value greater than 0.15# print(“model3 p-value is “, model3.pvalues)# print(“model4 p-value is “, model4.pvalues) Computer Science Engineering & Technology Python Programming CIS 461 Share QuestionEmailCopy link Comments (0)


