Vraag omtrent Python
Geplaatst: do 28 mar 2019, 11:12
Hallo,
Ik moet in python een Z-test maken, maar als output krijg ik een waarschuwing en NaN.
Kan iemand mij misschien vertellen waarom dit fout is?
Ik heb het volgende:
-----------------------------------------------------
oscar_profit = 253
oscar_totalprofit = 303
rate_oscar = oscar_profit/oscar_totalprofit
#proportion films winst+no-oscar = films-no-oscar/amount of no-oscars
noscar_profit = 521
noscar_totalprofit = 736
rate_noscar = noscar_profit/noscar_totalprofit
rate_oscar, rate_noscar
---------------------------------------
ztest = sm.stats.proportions_ztest([oscar_totalprofit, noscar_totalprofit], [oscar_profit, noscar_profit], alternative='larger')
ztest
Maar dan krijg je dit als output:
C:\ProgramData\Anaconda3\lib\site-packages\statsmodels\stats\proportion.py:806: RuntimeWarning: invalid value encountered in sqrt
std_diff = np.sqrt(var_)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in greater
return (self.a < x) & (x < self.b)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in less
return (self.a < x) & (x < self.b)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py RuntimeWarning: invalid value encountered in less_equal
cond2 = cond0 & (x <= self.a)
Out[70]:
(nan, nan)
Ik moet in python een Z-test maken, maar als output krijg ik een waarschuwing en NaN.
Kan iemand mij misschien vertellen waarom dit fout is?
Ik heb het volgende:
-----------------------------------------------------
oscar_profit = 253
oscar_totalprofit = 303
rate_oscar = oscar_profit/oscar_totalprofit
#proportion films winst+no-oscar = films-no-oscar/amount of no-oscars
noscar_profit = 521
noscar_totalprofit = 736
rate_noscar = noscar_profit/noscar_totalprofit
rate_oscar, rate_noscar
---------------------------------------
ztest = sm.stats.proportions_ztest([oscar_totalprofit, noscar_totalprofit], [oscar_profit, noscar_profit], alternative='larger')
ztest
Maar dan krijg je dit als output:
C:\ProgramData\Anaconda3\lib\site-packages\statsmodels\stats\proportion.py:806: RuntimeWarning: invalid value encountered in sqrt
std_diff = np.sqrt(var_)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in greater
return (self.a < x) & (x < self.b)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py:879: RuntimeWarning: invalid value encountered in less
return (self.a < x) & (x < self.b)
C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\_distn_infrastructure.py RuntimeWarning: invalid value encountered in less_equal
cond2 = cond0 & (x <= self.a)
Out[70]:
(nan, nan)