[R] trigonometric regression
William Simpson
william.a.simpson at gmail.com
Thu Jun 17 14:34:55 CEST 2010
Yes, I want the same test as is done for b[1] and b[2] in the summary
table -- for H0: b[]==0.
OK, do F-test on full model with cf and sf vs reduced model with intercept only.
I want to test
y~cf + sf
vs
y~ intercept (ie mean) -- I guess I just use var(y)
Thanks Duncan for your help
Bill
On Thu, Jun 17, 2010 at 11:18 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> William Simpson wrote:
>>
>> Suppose I do a trigonometric regression
>> fit<-lm(y~ cf + sf)
>> where cf and sf are the cos and sine components.
>>
>> b<-coef(fit)
>> I have the fitted sine component b[2] and the cos component b[3].
>> Doing summary(fit) gives me the p-values and SEs for b[2] and b[3].
>>
>> But I want the amplitude of the fitted waveform
>> amp<-sqrt(b[2]^2+b[3]^2)
>>
>> Can someone please tell me how to get the p-value for amp?
>>
>
> "the p-value for amp" is ambiguous; p-values refer to tests, not functions.
> But let's assume you want to test whether amp = 0. Then this is achieved
> by an F test comparing the model with cf and sf versus one without it.
> You'll see it in summary(fit) at the bottom of the display. If you want to
> include other covariates in the model, you can use anova, e.g.
>
> anova(lm(y ~ other), lm(y ~ cf + sf + other))
>
> Duncan Murdoch
>
>
>
>
>
More information about the R-help
mailing list