From ripley at stats.ox.ac.uk  Tue Nov 30 19:08:16 2010
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 30 Nov 2010 18:08:16 +0000 (GMT)
Subject: [Rd] stats::kernel
In-Reply-To: <4CF52FCE.80606@uwaterloo.ca>
References: <4CF52FCE.80606@uwaterloo.ca>
Message-ID: <alpine.LFD.2.00.1011301748550.22358@gannet.stats.ox.ac.uk>

What you are saying is that an undocumented default does not apply to 
your usage.  So all you need to do, surely, is to set the argument 
yourself?

Your 'correction' makes e.g. kernel("daniell") invalid.

I"ve applied a change in R-devel that means 'm' will not need to be 
supplied if 'coef' is numeric.

On Tue, 30 Nov 2010, Pierre Chausse wrote:

>  Hi,
>
> There is a small bug in the kernel() function. Everything is fine when
> we use the format:
>
> kernel("name",m,r)
>
> but if we want the first argument to be a vector, which is useful is we
> are interested in using a method not implemented in kernel(), the
> default value of m is wrong. For example, if we do:
>
> s <- rep(1/11,6)
> k <- kernel(s)
>
> we get the error message
>
> Error in kernel(s) : 'coef' does not have the correct length
>
> The problem is that the default value, which is not indicated in the
> help file,  violate the condition that length(coef) must be equal to
> (m+1). Therefore, the first line of the function, which is:
>
> function (coef, m = length(coef) + 1, r, name = "unknown")
> {
>
> should be changed to
>
> function (coef, m = length(coef) - 1, r, name = "unknown")
> {
>
> bests
>
> -- 
> *Pierre Chauss?*
> Assistant Professor
> Department of Economics
> University of Waterloo
>
> 	[[alternative HTML version deleted]]
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] stats::kernel
Prof Brian Ripley