Re: [R] Variable name as string

2010-10-17 Thread Peter Dalgaard
On 10/17/2010 11:25 AM, Jan private wrote: > So here is the next version. > > Why does the intercept needs lower.tail=TRUE to give the same result as > summary() for value=0? It doesn't. Or rather: For all coefficients, lower/upper tail depends on the _sign_ of t, so presumably you have a negati

Re: [R] Variable name as string

2010-10-17 Thread Jan private
So here is the next version. Why does the intercept needs lower.tail=TRUE to give the same result as summary() for value=0? # See Verzani, simpleR (pdf), p. 80 coeff.test <- function(lm.result, idx, value) { # idx = 1 is the intercept, idx>1 the other coefficients # null hypothesis: coeff = v

Re: [R] Variable name as string

2010-10-17 Thread Peter Dalgaard
On 10/17/2010 05:41 AM, Jan private wrote: > Also, as a non-professional, I would like to know whether the function > is valid for all coefficients of lm(), e.g. coeff.test(lm(N ~ D + H), H, > "H", 70). I am aware that Verzani gives a different formula for testing > the intercept. In a word, no,

Re: [R] Variable name as string

2010-10-16 Thread Jan private
> coeffname <- deparse(substitute(var)) > > Is that what you wanted? > Yes! That gets rid of the extra parameter. Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-p

Re: [R] Variable name as string

2010-10-16 Thread Greg Snow
[mailto:r-help-boun...@r- > project.org] On Behalf Of Jan private > Sent: Saturday, October 16, 2010 9:41 PM > To: r-help > Subject: [R] Variable name as string > > Hello, > > from Verzani, simpleR (pdf), p. 80, I created the following function to > test the coefficien

[R] Variable name as string

2010-10-16 Thread Jan private
Hello, from Verzani, simpleR (pdf), p. 80, I created the following function to test the coefficient of lm() against an arbitrary value. coeff.test <- function(lm.result, var, coeffname, value) { # null hypothesis: coeff = value # alternative hypothesis: coeff != value es <- resid(lm.result)