Displaying 1 result from an estimated 1 matches for "co2data".
Did you mean:
c2data
2009 Feb 10
1
harmonic function fiting? how to do
Dear R Users,
I have a CO2 time series. I want to fit this series seasonal cycle and trend
with fourth harmonic function,
and then compute residuals.
I am doing something like:
file<-read.csv("co2data.csv")
names(file)
attach(file)
fit<-lm(co2~1+time+I(time^2)+sin(2*pi*time)+cos(2*pi*time)+sin(4*pi*time)+cos(4*pi*time)+
sin(6*pi*time)+cos(6*pi*time)+sin(8*pi*time)+cos(8*pi*time),data=file)
fit$residuals
# variable 'co2' is in ppmv and variable 'time' is in the form of d...