[R] R Commander QQ Plot with triangular distribution

Richard and Barbara Males rbmales at gmail.com
Wed Mar 9 17:34:54 CET 2011


Wow, quick response, works perfectly, just as needed.

Thanks to both of you for pointing me in the right direction, and for
your contributions to the R community.

Dick

On Wed, Mar 9, 2011 at 11:21 AM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
> 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.
>
> Dick,
>
> 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<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.
>>>
>>>
>>
>> ______________________________________________
>> 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