Professional Documents
Culture Documents
t=c(1,2,3,4,5,6,7,8,9,10,11,12)
> x=c(38,40,40,48,56,57,61,60,57,48,45,38)
> plot(t,x)
> lines(t,x,col="red")
60
55
50
x
45
40
2 4 6 8 10 12
t=c(1,2,3,4,5,6,7,8,9,10,11,12)
> x=c(38,40,40,48,56,57,61,60,57,48,45,38)
> plot(t,x)
> lines(t,x,col="red")
> cos1=2*cos(2*pi*x*12/100)
> sin1=3*sin(2*pi*x*12/100)
> Xt1=cos1+sin1
> fit<-lm(t~Xt1)
> summary(fit)
Call:
lm(formula = t ~ Xt1)
Residuals:
Min 1Q Median 3Q Max
-4.7730 -2.1416 -0.6932 2.8370 6.2270
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.1582 1.2692 5.64 0.000215 ***
Xt1 0.4674 0.5081 0.92 0.379356
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> plot(t,Xt1)
> lines(t,Xt1,col="red")
3
2
1
Xt1
0
-1
-2
-3
2 4 6 8 10 12
cos2=2*cos(2*pi*x*6/100)
sin2=3*sin(2*pi*x*6/100)
> Xt2=cos2+sin2
> fit2<-lm(t~Xt2)
> summary(fit2)
Call:
lm(formula = t ~ Xt2)
Residuals:
Min 1Q Median 3Q Max
-4.1609 -2.7110 -0.5424 2.6675 7.1497
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.2394 1.0649 5.859 0.00016 ***
Xt2 -0.5400 0.5129 -1.053 0.31719
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> plot(t,Xt2)
> lines(t,Xt2,col="red")
2
1
0
Xt2
-1
-2
-3
2 4 6 8 10 12
cos3=2*cos(2*pi*x*4/100)
> sin3=3*sin(2*pi*x*4/100)
> Xt3=cos3+sin3
> fit3<-lm(t~Xt3)
> summary(fit3)
Call:
lm(formula = t ~ Xt3)
Residuals:
Min 1Q Median 3Q Max
-4.943 -2.664 -0.398 2.031 6.057
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.6326 1.0936 6.065 0.000121 ***
Xt3 0.2921 0.4782 0.611 0.554988
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> plot(t,Xt3)
> lines(t,Xt3,col="red")
Xt3
-3 -2 -1 0 1 2 3
2
4
6
t
8
10
12