Skip to content
Prev 360225 / 398503 Next

problem on simulation code (the loop unable to function effectively)

Hi Si Jie,
Again, please send questions to the list, not me.

Okay, I may have worked out what you are doing. The program runs and
produces what I would expect in the rightmost columns of the result
"g".

You are storing the number of each test for which the p value is less
than 0.05. It looks to me as though the objects storing the results
should be vectors as you are only storing 100 p values at a time.
Using matrices in which the only part of the values are used is a bit
confusing. Perhaps this resulted from my initial suggestion of using
matrices and storing all of the results before calculating the number
of p values less than 0.05, which you didn't do.

If I rewrite your code with vectors for storing the p values, I get
the same results. Essentially, with the scale parameter set the same
for both distributions, you get about five false positives (Type I
errors) per 100 simulations. This is expected. As the scale
parameters, and thus the means, of the groups diverge, you first get a
large number of results less than 0.05. With large differences between
the means, all results are less than 0.05, which seems correct to me.
You have probably been asked to interpret the effect of group size and
difference in means on the number of p values less than 0.05. If the
difference in means is large enough, you are almost guaranteed this.
In the cases where this is not occurring (i.e. the first difference in
scale parameters) you can see the difference in outcomes between the
three significance tests.

Jim
On Tue, Apr 19, 2016 at 10:35 AM, <uk31429 at student.umt.edu.my> wrote:
Message-ID: <CA+8X3fUPdxWfj+8XFV-scVJYvV=YcMqDhUvgNykgUi8xcvwuqw@mail.gmail.com>
In-Reply-To: <61967.172.16.74.16.1461026107.squirrel@webmail.student.umt.edu.my>