Displaying 1 result from an estimated 1 matches for "fitlinear".
2007 Nov 27
4
if condition and for cycles
I have two questions about R:
1) Does anyone knows why I get the plots but not the summary results of the
linear fitting when I run this code? When I run it outside the if condition
it works fine.
if (op==4) {
t=1:length(time(SeaIce))
fitlinear=lm(SeaIce~t)
windows()
plot.ts(SeaIce)
lines(ts(fitlinear$fitted.values,start=1979,frequency=12))
summary(fitlinear)
fitlinear=ts(fitlinear$fitted.values,start=1979,frequency=12)
c=cos(2*pi*t/12)
s=sin(2*pi*t/12)
fittotal=lm(SeaIce~t+c+s)
summary(fittotal)
windows()
par(mfrow=c(2,1))
pl...