[Rd] Documentation examples for lm and glm

2018-12-13 Thread Thomas Yee

Hello,

something that has been on my mind for a decade or two has
been the examples for lm() and glm(). They encourage poor style
because of mismanagement of data frames. Also, having the
variables in a data frame means that predict()
is more likely to work properly.

For lm(), the variables should be put into a data frame.
As 2 vectors are assigned first in the general workspace they
should be deleted afterwards.

For the glm(), the data frame d.AD is constructed but not used. Also,
its 3 components were assigned first in the general workspace, so they
float around dangerously afterwards like in the lm() example.

Rather than attached improved .Rd files here, they are put at
www.stat.auckland.ac.nz/~yee/Rdfiles
You are welcome to use them!

Best,

Thomas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Documentation examples for lm and glm

2018-12-16 Thread Thomas Yee
folk who have a data 
frame

but want to reference the contents across a wider range of functions
without using with() a lot. lm() can reasonably omit the data 
argument

there, too.

So while there are good reasons to use data frames, there are also 
good

reasons to provide examples that don't.

Steve Ellison



-Original Message-
From: R-devel [mailto:r-devel-boun...@r-project.org] On Behalf Of 
Ben

Bolker
Sent: 13 December 2018 20:36
To: r-devel@r-project.org
Subject: Re: [Rd] Documentation examples for lm and glm


 Agree.  Or just create the data frame with those variables in it
directly ...

On 2018-12-13 3:26 p.m., Thomas Yee wrote:

Hello,

something that has been on my mind for a decade or two has
been the examples for lm() and glm(). They encourage poor style
because of mismanagement of data frames. Also, having the
variables in a data frame means that predict()
is more likely to work properly.

For lm(), the variables should be put into a data frame.
As 2 vectors are assigned first in the general workspace they
should be deleted afterwards.

For the glm(), the data frame d.AD is constructed but not used. 
Also,
its 3 components were assigned first in the general workspace, 
so they

float around dangerously afterwards like in the lm() example.

Rather than attached improved .Rd files here, they are put at
www.stat.auckland.ac.nz/~yee/Rdfiles
You are welcome to use them!

Best,

Thomas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



***
This email and any attachments are confidential. Any 
u...{{dropped:12}}


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel





__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Extending deriv3()

2007-10-14 Thread Thomas Yee
Hello,

I was wondering if the functions deriv3(), deriv() etc. could be extended
to handle psigamma() and its special cases (digamma(), trigamma()
etc.). From the error message it seems that 'psigamma' needs to be
added to the derivatives table.
This might be easy since psigamma() has a deriv argument.

Additionally, this error message is also obtained when requesting for
the Hessian of the gamma and lgamma functions:

d3 = deriv(~  gamma(y), namev="y", hessian= TRUE)
d3 = deriv(~ lgamma(y), namev="y", hessian= TRUE)

Another class of special functions worth adding are the Bessel functions.

Thanks

Thomas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel