Answered step by step
Verified Expert Solution
Question
1 Approved Answer
we need to prepare a DataFrame that counts the number of non - zero precipitation hours each day. This is done for you below when
we need to prepare a DataFrame that counts the number of nonzero precipitation hours each day. This is done for you below when creating dailycounts
dailycounts
dfgroupbypdGrouperkeydt freqD
agg
"precip": lambda x: x sum "mean", "sum"
"temp": min 'max'
assignmonthlambda x: xindex.month
dropna
dailycounts.columns npreciphours", "avehourlyprecip", "dailyprecip", "tempmin", "tempmax", "month"
dailycounts.head
Using this DataFrame and the statsmodels library, fit the appropriate GLM model to predict the number of hours with nonzero precipitation in a day
You shoud use as features, tempmin, tempmax, and a collection of indidcator variables for the month. In total you will have features.
# countmodel smfglm
# # CHANGE FORMULA
# dailycounts,
# family # CHANGE FAMILY
#
# your code here
countmodelfit countmodel.fit
countmodelfit.summary
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