[R] R Commander QQ Plot with triangular distribution

John Fox jfox at mcmaster.ca
Wed Mar 9 17:14:47 CET 2011


Dear Dick,

> -----Original Message-----
> From: Richard and Barbara Males [mailto:rbmales at gmail.com]
> Sent: March-09-11 10:54 AM
> To: John Fox
> Cc: r-help at r-project.org
> Subject: Re: [R] R Commander QQ Plot with triangular distribution
> 
> Thank you for your prompt reply, I apologize for posting as an R
> Commander question.  Your response is pointing me in the right
> direction, but I am still not quite there.   The triangle package has
> a qtriangle and dtriangle.   The formal arguments are a, b, and c.
> (formals(qtriangle))  When I use R Commander as:
> 
> qqPlot(Transfer5000$Transfer.Rate, dist="triangle",
> a=3000,b=5000,c=4000)
> 
> I get the error message:
> 
> Error in qqPlot.default(Transfer5000$Transfer.Rate, dist = "triangle",
> :
>   argument 5 matches multiple formal arguments
> 
> and I am unclear as to how to specify that the "c" argument needs to
> pertain specifically to the qtriangle (or perhaps dtriangle) function
> arguments, that is, how to avoid a conflict with other arguments of
> qqPlot that are ambiguous when passed "c"..

I don't see a way around this problem, short of something like writing cover
functions yourself with different argument names, e.g., qtri <- function(p,
A, B, C) qtriangle(p, a=A, b=B, c=C).

> 
> Again, sorry to post here, as this has clearly wandered into other
> territory.  My exploratory searches to resolve this take me well beyond
> my current ability in R.  If there is not an obvious answer, I will re-
> post specifically on the topic of specifying formal arguments of
> distributions to qqPlot.

No need to apologize -- this is a reasonable question and reveals a flaw in
the interface to qqPlot(), and it's not obvious how to fix it. Suggestions
would be appreciated. 

Best,
 John

> 
> Thanks.
> 
> Dick Males
> 
> On Tue, Mar 8, 2011 at 11:19 AM, John Fox <jfox at mcmaster.ca> wrote:
> > Dear R. Males,
> >
> > This isn't really an R Commander question, since the qqPlot() function
> > is in the car package and is just invoked by the R Commander.
> >
> > From ?qqPlot: "distribution: root name of comparison distribution -
> > e.g., "norm" for the normal distribution ... Any distribution for
> > which quantile and density functions exist in R (with prefixes q and
> > d, respectively) may be used." Thus, if there's a qtriangle() and
> > dtriangle(), I suppose that you should be able to get a QQ plot.
> > Further from ?qqPlot: " ...    arguments such as df to be passed to
> > the appropriate quantile function." Thus, you should *name* the
> > arguments to be passed to qtriangle() -- perhaps (of course, you
> should use the correct names) min=3000, max=5000, mode=4000.
> >
> > I hope this helps,
> >  John
> >
> > --------------------------------
> > John Fox
> > Senator William McMaster
> >  Professor of Social Statistics
> > Department of Sociology
> > McMaster University
> > Hamilton, Ontario, Canada
> > http://socserv.mcmaster.ca/jfox
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: r-help-bounces at r-project.org
> >> [mailto:r-help-bounces at r-project.org]
> >> On Behalf Of Richard and Barbara Males
> >> Sent: March-08-11 10:49 AM
> >> To: r-help at r-project.org
> >> Subject: [R] R Commander QQ Plot with triangular distribution
> >>
> >> I am attempting to use the R Commander Graphs Quantile-Comparison
> >> functionality on a dataset, to compare with a triangular
> distribution.
> >>   I have the package triangle.   My question is on the syntax of how
> >> to specify the parameters of the theoretical distribution in the
> >> Parameters field of the dialog box.  For example, the theoretical
> >> distribution has min of 3000, max of 5000, mode of 4000.   When I
> >> enter this info as 3000,5000,4000 in the parameters field, I get:
> >>
> >> qqPlot(EmpiricalData$Value, dist="triangle", 3000,5000,4000)
> >>
> >> it produces a plot, but I am not sure that this is correct.
> >>
> >> I have searched for examples, not found anything.  Any help much
> >> appreciated.
> >>
> >> R. Males
> >> Cincinnati, Ohio, USA
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> 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.
> >
> >



More information about the R-help mailing list