Dear R users,

I am comparing two data sets (CO2 observation vs. CO2 simulation, during

1993-2002).

In order to do it I am calculating Root-Mean-Square(RMS) difference

with following formula:

> sqrt(sum((observed_residual - simulated_residual)^2)/n) # 'n' is number of

observations

Residuals are computed by fitting a harmonic function on both the data:

>testfit<-lm(co2obs~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)

#

>testfit1<-lm(co2model~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)#

'time' is time of observation

testfit$residuals # observed.residuals # (saved in seperate file by

write.table)

testfit1$residuals # modeled.residuals# (saved in seperate file by

write.table)

I am interested to to see climatology of RMS difference (all Jan months, all

Feb months, all March months,.............,all Dec months),

So I am computing like following:

time_span <- file[(file$mo==1),] # for 'Jan' month (similarly for other

months)

time_span

sub_seaobs <- (time_span$observed. residual)

sub_seaobs

sub_seatm3 <- (time_span$modeled.residual)

sub_seatm3

sqrt(sum((sub_seaobs-sub_seatm3)^2)/n) # 'n' is number of observation in

particular month

QUESTION:

I want to know if I am doing right and is it best way of computing

clomatology of Root-Mean-Square difference between two data sets.

--

Yogesh K. Tiwari (Dr.rer.nat),

Scientist,

Indian Institute of Tropical Meteorology,

Homi Bhabha Road,

Pashan,

Pune-411008

INDIA

Phone: 0091-99 2273 9513 (Cell)

: 0091-20-258 93 600 (O) (Ext.250)

Fax : 0091-20-258 93 825

[[alternative HTML version deleted]]

______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide

http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.