Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The forestfires.csv data base contains meteorological information and the area burned for 5 1 7 forest fires that occurred in Montesinho Natural Park in Portugal.
The forestfires.csv data base contains meteorological information and the area burned for 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 no new variables have a pvalue less than
Ex: If the variable RH is used instead of FFMC the output is:
model pvalues are Intercept e
RH e
dtype: float
model pvalues are Intercept e
DMC e
dtype: float
model pvalues are Intercept e
DC e
dtype: float
model pvalues are Intercept e
ISI e
dtype: float
model pvalues are Intercept e
RH e
DC e
dtype: float
model pvalues are Intercept e
DMC e
DC e
dtype: float
model pvalues are Intercept e
DC e
ISI e
dtype: float
model pvalues are Intercept e
RH e
DMC e
DC e
dtype: float
model pvalues are Intercept e
DMC e
DC e
ISI e
dtype: float
# import the necessary modules
fires # read in the csv file
# response variable
Y # set area as the response variable
# first forward selection step
model # generate the linear regression model for FFMC
# prints the pvalue
printmodel pvalues are modelpvalues
model # generate the linear regression model for wind
printmodel pvalues are modelpvalues
model # generate the linear regression model for DC
printmodel pvalues are modelpvalues
model # generate the linear regression model for temp
printmodel pvalues are modelpvalues
# Second forward selection step using order FFMC wind, DC temp. Ex: If the best SLR model uses temp, the first MLR model should be Y ~ FFMC temp.
model # generate multiple regression model
printmodel pvalues are modelpvalues
model # generate multiple regression model
printmodel pvalues are modelpvalues
model # generate multiple regression model
printmodel pvalues are modelpvalues
# Third forward regression step using order FFMC wind, DC temp
model # generate multiple regression model
printmodel pvalues are modelpvalues
model # generate multiple regression model
printmodel pvalues are modelpvalues
# Continue until no additional predictor variables have pvalues less than
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started