Re: [R] R Commander QQ Plot with triangular distribution

From: Peter Ehlers <>
Date: Wed, 09 Mar 2011 08:21:21 -0800

On 2011-03-09 07:53, Richard and Barbara Males wrote:
> 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"..
> 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.


I think that the author of the triangle package has chosen an unfortunate name for one of the parameters. Here's a work-around:

## define two new functions dtri() and qtri():

   dtri <- function(q, a=0, b=1, cc=.5) dtriangle(q, a, b, cc)    qtri <- function(p, a=0, b=1, cc=.5) qtriangle(p, a, b, cc)

## now use "tri" as the distribution to pass to qqPlot:

   qqPlot(x, "tri", a=3000, b=5000, cc=4000)

Peter Ehlers

> Thanks.
> Dick Males
> On Tue, Mar 8, 2011 at 11:19 AM, John Fox<> 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
>>> -----Original Message-----
>>> From: []
>>> On Behalf Of Richard and Barbara Males
>>> Sent: March-08-11 10:49 AM
>>> To:
>>> 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
>>> ______________________________________________
>>> mailing list
>>> PLEASE do read the posting guide
>>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 09 Mar 2011 - 16:25:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Mar 2011 - 16:40:20 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive