Write out a description of the effects that age and gender have on the odds of developing hearing problems in terms a layperson could understand. Include estimates for the odds of hearing problems in a 95 year old woman and a 50 year old man.
logit(HasHearingProblem)=−1+.02∗age+1∗male
In [16]:
import math
In [21]:
#odds of hearing problems in a 95 year old woman
a = -1+ 0.02*95 + 1*0
c = math.exp( a )
d = math.exp( a )/(1+ c)
print('Probability of having hearing problems over not having them:', c)
print('HashearingProblem:', d)
The probability of a 95 year old man of having hearing problems is nearly 2.5 times more than the probability of not developing them being the probability of 71%
In [22]:
#odds of hearing problems in a 50 year old man
b = -1+.02*50+1*1
c = math.exp( a )
d = math.exp( a )/(1+ c)
print('Probability of having hearing problems over not having them:', c)
print('HashearingProblem:', d)
The probability of a 50 year old woman of having hearing problems is nearly 2.5 times more than the probability of not developing them being the probability of 71%.
In [ ]: