Quantcast

qqplot for binomial distribution

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

qqplot for binomial distribution

Ashim Kapoor
Dear All,

set.seed(123)
qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )

I expect to see 1 clear line,but I don't. What am I misunderstanding?

Best Regards,
Ashim

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Spencer Graves-4


On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
> Dear All,
>
> set.seed(123)
> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
>
> I expect to see 1 clear line,but I don't. What am I misunderstanding?


       The distribution is discrete, and points are superimposed. Try
the following:


set.seed(123)
qqplot(jitter(rbinom(n=100,size=100,p=.05)),
        jitter(rbinom(n=100,size=100,p=.05) ))


       Spencer Graves

>
> Best Regards,
> Ashim
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Ashim Kapoor
Dear Spencer,

Okay. Many thanks. My next query is how do I use qqline?

When I try

> qqline(rbinom(n=100,size=100,p=.05))

I don't get the line in the right place.

Best Regards,
Ashim

On Mon, Apr 17, 2017 at 6:31 PM, Spencer Graves <
[hidden email]> wrote:

>
>
> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
>
>> Dear All,
>>
>> set.seed(123)
>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
>>
>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
>>
>
>
>       The distribution is discrete, and points are superimposed. Try the
> following:
>
>
> set.seed(123)
> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
>        jitter(rbinom(n=100,size=100,p=.05) ))
>
>
>       Spencer Graves
>
>>
>> Best Regards,
>> Ashim
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Boris Steipe
In reply to this post by Spencer Graves-4
Moreover, setting the seed once, then evaluating two functions means you are sampling from the same distributions, but you do in fact have different values. Outliers in the rarefied tails of the distribution may lie quite considerably off the expected diagonal. Try

set.seed(123)
qqplot(rbinom(n=1000, size=1000, p=0.05),
       rbinom(n=1000, size=1000, p=0.05))

and you will find that you approximate the "1 clear line" quite well - for most of the values.


B.




> On Apr 17, 2017, at 9:01 AM, Spencer Graves <[hidden email]> wrote:
>
>
>
> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
>> Dear All,
>>
>> set.seed(123)
>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
>>
>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
>
>
>      The distribution is discrete, and points are superimposed. Try the following:
>
>
> set.seed(123)
> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
>       jitter(rbinom(n=100,size=100,p=.05) ))
>
>
>      Spencer Graves
>>
>> Best Regards,
>> Ashim
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Ashim Kapoor
Dear Boris,

Okay and Thanks.

Best,
Ashim

On Mon, Apr 17, 2017 at 6:45 PM, Boris Steipe <[hidden email]>
wrote:

> Moreover, setting the seed once, then evaluating two functions means you
> are sampling from the same distributions, but you do in fact have different
> values. Outliers in the rarefied tails of the distribution may lie quite
> considerably off the expected diagonal. Try
>
> set.seed(123)
> qqplot(rbinom(n=1000, size=1000, p=0.05),
>        rbinom(n=1000, size=1000, p=0.05))
>
> and you will find that you approximate the "1 clear line" quite well - for
> most of the values.
>
>
> B.
>
>
>
>
> > On Apr 17, 2017, at 9:01 AM, Spencer Graves <spencer.graves@
> effectivedefense.org> wrote:
> >
> >
> >
> > On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
> >> Dear All,
> >>
> >> set.seed(123)
> >> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
> >>
> >> I expect to see 1 clear line,but I don't. What am I misunderstanding?
> >
> >
> >      The distribution is discrete, and points are superimposed. Try the
> following:
> >
> >
> > set.seed(123)
> > qqplot(jitter(rbinom(n=100,size=100,p=.05)),
> >       jitter(rbinom(n=100,size=100,p=.05) ))
> >
> >
> >      Spencer Graves
> >>
> >> Best Regards,
> >> Ashim
> >>
> >>      [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Boris Steipe
In reply to this post by Ashim Kapoor
That's not how qqline() works. The line is drawn with respect to a _reference_distribution_ which is the normal distribution by default. For the binomial distribution, you need to specify the distribution argument. There is an example in the help page that shows you how this is done for qchisq(). for qbinom() it is:


set.seed(123)
qqplot(rbinom(n=100, size=100, p=0.05),
       rbinom(n=100, size=100, p=0.05) )
 
qqline(rbinom(n=100,size=100,p=.05),
       distribution = function(probs) { qbinom(probs, size=100, prob=0.05) },
       col = "red",
       lwd = 0.5)




B.


> On Apr 17, 2017, at 9:15 AM, Ashim Kapoor <[hidden email]> wrote:
>
> Dear Spencer,
>
> Okay. Many thanks. My next query is how do I use qqline?
>
> When I try
>
>> qqline(rbinom(n=100,size=100,p=.05))
>
> I don't get the line in the right place.
>
> Best Regards,
> Ashim
>
> On Mon, Apr 17, 2017 at 6:31 PM, Spencer Graves <
> [hidden email]> wrote:
>
>>
>>
>> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
>>
>>> Dear All,
>>>
>>> set.seed(123)
>>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
>>>
>>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
>>>
>>
>>
>>      The distribution is discrete, and points are superimposed. Try the
>> following:
>>
>>
>> set.seed(123)
>> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
>>       jitter(rbinom(n=100,size=100,p=.05) ))
>>
>>
>>      Spencer Graves
>>
>>>
>>> Best Regards,
>>> Ashim
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posti
>>> ng-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Ashim Kapoor
Dear Boris,

Thank you for your reply.

> dput(count1_vector)
c(5, 6, 4, 4, 6, 5, 4, 5, 3, 7, 5, 5, 3, 4, 8, 6, 10, 2, 4, 6,
8, 4, 4, 6, 8, 5, 6, 3, 7, 9, 4, 7, 5, 7, 3, 4, 5, 2, 11, 7,
8, 5, 5, 6, 3, 2, 3, 5, 9, 6, 5, 6, 7, 3, 10, 7, 6, 4, 9, 5,
7, 3, 7, 3, 2, 3, 4, 5, 10, 4, 5, 5, 6, 7, 4, 8, 7, 5, 5, 4,
8, 7, 9, 4, 4, 4, 7, 5, 4, 10, 4, 5, 6, 1, 3, 5, 4, 7, 4, 6)

set.seed(123)
qqplot(count1_vector,rbinom(n=100,size=100,p=.05))
qqline(count1_vector,distribution = function(probs) { qbinom(probs,
size=100, prob=0.05) },
       col = "red",
       lwd = 0.5)

When I do this, the line does not pass through the center of my data.I do
expect count1_vector to be 100 samples of binomial with n=100 and p=.05.

Any comments or suggestions for me ?

Note : I built a 95% Confidence interval for my data and I counted how
often out of 100 times did the data fall outside the CI.This I expect to be
binomial with n=100,p=.05. I repeated this a 100 times and obtained
count1_vector.

Best Regards,
Ashim.


On Mon, Apr 17, 2017 at 7:51 PM, Boris Steipe <[hidden email]>
wrote:

> That's not how qqline() works. The line is drawn with respect to a
> _reference_distribution_ which is the normal distribution by default. For
> the binomial distribution, you need to specify the distribution argument.
> There is an example in the help page that shows you how this is done for
> qchisq(). for qbinom() it is:
>
>
> set.seed(123)
> qqplot(rbinom(n=100, size=100, p=0.05),
>        rbinom(n=100, size=100, p=0.05) )
>
> qqline(rbinom(n=100,size=100,p=.05),
>        distribution = function(probs) { qbinom(probs, size=100, prob=0.05)
> },
>        col = "red",
>        lwd = 0.5)
>
>
>
>
> B.
>
>
> > On Apr 17, 2017, at 9:15 AM, Ashim Kapoor <[hidden email]> wrote:
> >
> > Dear Spencer,
> >
> > Okay. Many thanks. My next query is how do I use qqline?
> >
> > When I try
> >
> >> qqline(rbinom(n=100,size=100,p=.05))
> >
> > I don't get the line in the right place.
> >
> > Best Regards,
> > Ashim
> >
> > On Mon, Apr 17, 2017 at 6:31 PM, Spencer Graves <
> > [hidden email]> wrote:
> >
> >>
> >>
> >> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
> >>
> >>> Dear All,
> >>>
> >>> set.seed(123)
> >>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
> >>>
> >>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
> >>>
> >>
> >>
> >>      The distribution is discrete, and points are superimposed. Try the
> >> following:
> >>
> >>
> >> set.seed(123)
> >> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
> >>       jitter(rbinom(n=100,size=100,p=.05) ))
> >>
> >>
> >>      Spencer Graves
> >>
> >>>
> >>> Best Regards,
> >>> Ashim
> >>>
> >>>        [[alternative HTML version deleted]]
> >>>
> >>> ______________________________________________
> >>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide http://www.R-project.org/posti
> >>> ng-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >> ______________________________________________
> >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/posti
> >> ng-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Boris Steipe
As per the help pages, the data samples are expected in the second argument, "y".

So try
  qqplot(rbinom(n=100, size=100, p=0.05), count1_vector)

... and then plot your qqline()

Alternatively, try

qqline(count1_vector,
       distribution = function(probs) { qbinom(probs, size=100, prob=0.05) },
       datax = TRUE, # <- logical. Should data values be on the x-axis?
       col = "red",
       lwd = 0.5)
... and use your original qqplot()


B.


> On Apr 18, 2017, at 12:47 AM, Ashim Kapoor <[hidden email]> wrote:
>
> Dear Boris,
>
> Thank you for your reply.
>
> > dput(count1_vector)
> c(5, 6, 4, 4, 6, 5, 4, 5, 3, 7, 5, 5, 3, 4, 8, 6, 10, 2, 4, 6,
> 8, 4, 4, 6, 8, 5, 6, 3, 7, 9, 4, 7, 5, 7, 3, 4, 5, 2, 11, 7,
> 8, 5, 5, 6, 3, 2, 3, 5, 9, 6, 5, 6, 7, 3, 10, 7, 6, 4, 9, 5,
> 7, 3, 7, 3, 2, 3, 4, 5, 10, 4, 5, 5, 6, 7, 4, 8, 7, 5, 5, 4,
> 8, 7, 9, 4, 4, 4, 7, 5, 4, 10, 4, 5, 6, 1, 3, 5, 4, 7, 4, 6)
>
> set.seed(123)
> qqplot(count1_vector,rbinom(n=100,size=100,p=.05))
> qqline(count1_vector,distribution = function(probs) { qbinom(probs, size=100, prob=0.05) },
>        col = "red",
>        lwd = 0.5)
>
> When I do this, the line does not pass through the center of my data.I do expect count1_vector to be 100 samples of binomial with n=100 and p=.05.
>
> Any comments or suggestions for me ?
>
> Note : I built a 95% Confidence interval for my data and I counted how often out of 100 times did the data fall outside the CI.This I expect to be binomial with n=100,p=.05. I repeated this a 100 times and obtained count1_vector.
>
> Best Regards,
> Ashim.
>
>
> On Mon, Apr 17, 2017 at 7:51 PM, Boris Steipe <[hidden email]> wrote:
> That's not how qqline() works. The line is drawn with respect to a _reference_distribution_ which is the normal distribution by default. For the binomial distribution, you need to specify the distribution argument. There is an example in the help page that shows you how this is done for qchisq(). for qbinom() it is:
>
>
> set.seed(123)
> qqplot(rbinom(n=100, size=100, p=0.05),
>        rbinom(n=100, size=100, p=0.05) )
>
> qqline(rbinom(n=100,size=100,p=.05),
>        distribution = function(probs) { qbinom(probs, size=100, prob=0.05) },
>        col = "red",
>        lwd = 0.5)
>
>
>
>
> B.
>
>
> > On Apr 17, 2017, at 9:15 AM, Ashim Kapoor <[hidden email]> wrote:
> >
> > Dear Spencer,
> >
> > Okay. Many thanks. My next query is how do I use qqline?
> >
> > When I try
> >
> >> qqline(rbinom(n=100,size=100,p=.05))
> >
> > I don't get the line in the right place.
> >
> > Best Regards,
> > Ashim
> >
> > On Mon, Apr 17, 2017 at 6:31 PM, Spencer Graves <
> > [hidden email]> wrote:
> >
> >>
> >>
> >> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
> >>
> >>> Dear All,
> >>>
> >>> set.seed(123)
> >>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
> >>>
> >>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
> >>>
> >>
> >>
> >>      The distribution is discrete, and points are superimposed. Try the
> >> following:
> >>
> >>
> >> set.seed(123)
> >> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
> >>       jitter(rbinom(n=100,size=100,p=.05) ))
> >>
> >>
> >>      Spencer Graves
> >>
> >>>
> >>> Best Regards,
> >>> Ashim
> >>>
> >>>        [[alternative HTML version deleted]]
> >>>
> >>> ______________________________________________
> >>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide http://www.R-project.org/posti
> >>> ng-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >> ______________________________________________
> >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/posti
> >> ng-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: qqplot for binomial distribution

Ashim Kapoor
Dear Boris,

Many thanks,
Ashim

On Tue, Apr 18, 2017 at 7:56 PM, Boris Steipe <[hidden email]>
wrote:

> As per the help pages, the data samples are expected in the second
> argument, "y".
>
> So try
>   qqplot(rbinom(n=100, size=100, p=0.05), count1_vector)
>
> ... and then plot your qqline()
>
> Alternatively, try
>
> qqline(count1_vector,
>        distribution = function(probs) { qbinom(probs, size=100, prob=0.05)
> },
>        datax = TRUE, # <- logical. Should data values be on the x-axis?
>        col = "red",
>        lwd = 0.5)
> ... and use your original qqplot()
>
>
> B.
>
>
> > On Apr 18, 2017, at 12:47 AM, Ashim Kapoor <[hidden email]>
> wrote:
> >
> > Dear Boris,
> >
> > Thank you for your reply.
> >
> > > dput(count1_vector)
> > c(5, 6, 4, 4, 6, 5, 4, 5, 3, 7, 5, 5, 3, 4, 8, 6, 10, 2, 4, 6,
> > 8, 4, 4, 6, 8, 5, 6, 3, 7, 9, 4, 7, 5, 7, 3, 4, 5, 2, 11, 7,
> > 8, 5, 5, 6, 3, 2, 3, 5, 9, 6, 5, 6, 7, 3, 10, 7, 6, 4, 9, 5,
> > 7, 3, 7, 3, 2, 3, 4, 5, 10, 4, 5, 5, 6, 7, 4, 8, 7, 5, 5, 4,
> > 8, 7, 9, 4, 4, 4, 7, 5, 4, 10, 4, 5, 6, 1, 3, 5, 4, 7, 4, 6)
> >
> > set.seed(123)
> > qqplot(count1_vector,rbinom(n=100,size=100,p=.05))
> > qqline(count1_vector,distribution = function(probs) { qbinom(probs,
> size=100, prob=0.05) },
> >        col = "red",
> >        lwd = 0.5)
> >
> > When I do this, the line does not pass through the center of my data.I
> do expect count1_vector to be 100 samples of binomial with n=100 and p=.05.
> >
> > Any comments or suggestions for me ?
> >
> > Note : I built a 95% Confidence interval for my data and I counted how
> often out of 100 times did the data fall outside the CI.This I expect to be
> binomial with n=100,p=.05. I repeated this a 100 times and obtained
> count1_vector.
> >
> > Best Regards,
> > Ashim.
> >
> >
> > On Mon, Apr 17, 2017 at 7:51 PM, Boris Steipe <[hidden email]>
> wrote:
> > That's not how qqline() works. The line is drawn with respect to a
> _reference_distribution_ which is the normal distribution by default. For
> the binomial distribution, you need to specify the distribution argument.
> There is an example in the help page that shows you how this is done for
> qchisq(). for qbinom() it is:
> >
> >
> > set.seed(123)
> > qqplot(rbinom(n=100, size=100, p=0.05),
> >        rbinom(n=100, size=100, p=0.05) )
> >
> > qqline(rbinom(n=100,size=100,p=.05),
> >        distribution = function(probs) { qbinom(probs, size=100,
> prob=0.05) },
> >        col = "red",
> >        lwd = 0.5)
> >
> >
> >
> >
> > B.
> >
> >
> > > On Apr 17, 2017, at 9:15 AM, Ashim Kapoor <[hidden email]>
> wrote:
> > >
> > > Dear Spencer,
> > >
> > > Okay. Many thanks. My next query is how do I use qqline?
> > >
> > > When I try
> > >
> > >> qqline(rbinom(n=100,size=100,p=.05))
> > >
> > > I don't get the line in the right place.
> > >
> > > Best Regards,
> > > Ashim
> > >
> > > On Mon, Apr 17, 2017 at 6:31 PM, Spencer Graves <
> > > [hidden email]> wrote:
> > >
> > >>
> > >>
> > >> On 2017-04-17 7:58 AM, Ashim Kapoor wrote:
> > >>
> > >>> Dear All,
> > >>>
> > >>> set.seed(123)
> > >>> qqplot(rbinom(n=100,size=100,p=.05), rbinom(n=100,size=100,p=.05) )
> > >>>
> > >>> I expect to see 1 clear line,but I don't. What am I misunderstanding?
> > >>>
> > >>
> > >>
> > >>      The distribution is discrete, and points are superimposed. Try
> the
> > >> following:
> > >>
> > >>
> > >> set.seed(123)
> > >> qqplot(jitter(rbinom(n=100,size=100,p=.05)),
> > >>       jitter(rbinom(n=100,size=100,p=.05) ))
> > >>
> > >>
> > >>      Spencer Graves
> > >>
> > >>>
> > >>> Best Regards,
> > >>> Ashim
> > >>>
> > >>>        [[alternative HTML version deleted]]
> > >>>
> > >>> ______________________________________________
> > >>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > >>> https://stat.ethz.ch/mailman/listinfo/r-help
> > >>> PLEASE do read the posting guide http://www.R-project.org/posti
> > >>> ng-guide.html
> > >>> and provide commented, minimal, self-contained, reproducible code.
> > >>>
> > >>
> > >> ______________________________________________
> > >> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > >> https://stat.ethz.ch/mailman/listinfo/r-help
> > >> PLEASE do read the posting guide http://www.R-project.org/posti
> > >> ng-guide.html
> > >> and provide commented, minimal, self-contained, reproducible code.
> > >>
> > >
> > >       [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...