Skip to content
Prev 228691 / 398500 Next

Odp: Help me with prediction in linear model

Thanks Murphy and pikal,

I need another help,for fitting first fourier transformation ,i used
following thing .Please advise on this


beer_monthl has 400+ records

EXample:
beer
1 93.2
2 96.0
3 95.2
4 77.1
5 70.9
6 64.8




time<-seq(1956,1995.2,length=length(beer_monthly))
sin.t<-sin(2*pi*time)
cos.t<-cos(2*pi*time)
beer_fit_fourier=lm(beer_monthly[,1]~poly(time,2)+sin.t+cos.t) #this is not
working
beer_fit_fourier=lm(beer_monthly[,1]~time+time2+sin.t+cos.t) #it is working


#prediction is not workinng

tpred_four <- data.frame(time = seq(1995, 1998, length = 20))
predict(beer_fit_fourier, newdata = tpred_four)

Is there any way to fit first fourier  frequency ,

Please assist.

Thanks in advance