I
I
Ivan Smirnov2020-11-13 11:19:54
PostgreSQL
Ivan Smirnov, 2020-11-13 11:19:54

Null hypothesis. How to fix the wording?

The problem with understanding and searching for an error - I quote below along with the correspondence:

And so, we have two tariffs, you need to understand whether the average revenue for the two tariffs differs or not?
Let's put forward hypotheses:

H₀ - the average revenue for two tariffs differs

H1 - the average revenue for two tariffs does not differ

alpha = .05 - the critical level of statistical significance. If p-value turns out to be less than it, we reject the hypothesis.

Teacher's note:The st.ttest_ind method tests the means of two populations for equality. Accordingly, the null hypothesis always assumes that the averages of the studied populations are equal. Further, the obtained p-value shows the probability with which we will be mistaken, accepting an alternative hypothesis. If it is small enough, we can reject the null hypothesis and accept the alternative one (averages are not equal), if it is large enough, we cannot reject the null one, we have to accept it (averages are equal).

alpha = .05
_ , equal_var = False) print('p-value:', results.
if (results.pvalue < alpha):
print("Reject the null hypothesis")
else:
print("Failed to reject the null hypothesis")
p-value: 0.0
Reject the null hypothesis
The difference between the revenue of the Ultra tariff and the Smart tariff cannot be called statistically significant. Despite the fact that the average monthly revenue between the two tariffs is clearly different: smart = 692, and ultra = 1950. That is, the average revenue for the two tariffs is not the same, but such a difference can be obtained by chance, which was shown to us by the p-value: 0.0

TEACHER'S CLAIM
Here , due to the incorrect formulation of the hypotheses and the conclusions were incorrect. Let's work on this.

UPD: As I wrote above, the null hypothesis should assume the equality of the studied means. We assume the opposite.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
Maxim Fedorov, 2016-08-04
@risentveber

the error occurs as a result of an attempt to add data with the same Primary Key. Use UPSERT if your version of postgres allows it, if it doesn't - there is a lot of information on the Internet on how to implement it yourself in older versions.

O
Optimus, 2016-08-04
Pyan @marrk2

Maybe so?
Apparently the error occurs when the player has already killed this mob. Then it would be more correct to add a column with the quantity and check whether there is such a pair of player-mob, if there is a counter ++
INSERT IGNORE for your case, I don’t think it fits judging by the context of the request...

E
Evgeny Bykov, 2016-08-05
@bizon2000

You can conditionally add a row with a zero counter and then update the row to change the counter:

INSERT INTO player_mob_kills (player_id, mob_id, count)
    SELECT :player_id, :mob_id, 0
        WHERE NOT EXISTS(SELECT *
                             FROM player_mob_kills
                             WHERE player_id = :player_id
                               AND mob_id = :mob_id
                        )
UPDATE player_mob_kills
    SET count=count + :count
    WHERE player_id = :player_id
      AND mob_id = :mob_id;

D
dmshar, 2020-11-13
@dmshar

What exactly is unclear? The null hypothesis for the means is always accepted as the EQUAL mean hypothesis, which must be refuted (rejected). Or "do not reject". The alternative hypothesis is indeed generally related to the theory that is going to be explored - in your case, that tariffs affect revenue. This is how all the criteria work, and it is this (the probability that we will be mistaken in accepting an alternative hypothesis - in your case, we will say that the tariff affects revenue, although in fact it does not) that shows the p-value. In simple terms, its "large" value says that if we reject the null hypothesis, we are likely to be mistaken, and small - that we may be wrong, but the probability of such an error is extremely small.
You have the opposite. So the result you get is one that cannot be properly interpreted.
PS And yes, increase the precision of the decimal representation, otherwise you will never see anything at all.

S
Stanislav Ivanov, 2020-11-13
@ivstig

Are you counting revenue correctly? Somehow the pvalue = 0.0 is suspicious

D
Dimonchik, 2020-11-13
@dimonchik2013

porridge and an incorrectly formulated task,
always look for a physical meaning, in addition to juggling numbers and coefficients

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question