Académique Documents
Professionnel Documents
Culture Documents
Batch B
Grade
The following command does the equivalent of the SQL command SELECT
avg(purchase_amt) FROM offertest GROUP BY offer,
aggregates(x=offertest$purchase_amt, by=list(offertest$offer), FUN="mean")
4. Plot and determine how purchase size varies within the three groups:
The log=y argument plots the y axis on the log scale. Does it appear that making
offers increases purchase amount?
5.
5.
5.
5.
5) Use lm() to do the ANOVA:
1. Execute the following commands:
model = lm(log10(purchase_amt) ~ as.factor(offers), data=offertest)
summary(model)
2. What is the p-value on the F-stat? Can we reject the null hypothesis?
2.2e-16 means he value of value of p<0.05 and therefore we can reject null
hypothesis.
3. The intercept of the model is the mean value of log10(purchase_amt | no offer), (call
it m0) and the other coefficients are:
4. mean(log10(purchase_amt |offer1)) m0, and
5. mean(log10(purchase_amt |offer2)) m0, respectively.
6. What
are
Offer14.49e-14
Offer2 <2e-16
the
p-values
on
those
coefficients?
7. Can we reject the null hypotheses that the mean purchase amount for offer1 was different
from
that
of
no
offer,
and
similarly
for
offer2
vs.
no
offer?
Yes. We can reject the null hypothesis but nothing can be commented on similarity of offer2
vs. noffer
2.
2.
2.
2.
Also try the plots:
densityplot(~purchase_amt | offers, data=offertest)
2. Since our null hypothesis is that m1 <> m2, we need the area under both tails.
1. Are
the
means
different
(to
Yes the mean values are different.
the
p<0.05
significance
level)?
B.2
Conclusion
From the above operations performed, we can find and predict the relations
between the different option to choose from given set of results and data.
,using mean, median mode and using t.test for testing and p-value and f-stat