Hi,

 

I have a dataframe Wash2005, which has daily weather data.  I am doing a
regression by month as follows: 

# FM10 Regression by Month 

# Plot 12 Month of OFM10, FFM10 

for(i in 1:12) {

Temp <- subset (Wash2005, MM == i)

assign( paste('Wash2005FM10', strtrim(month.name[i],3),
sep=""),lm(Temp$FM10.1 ~ Temp$FM10))

}

 

Wash2005FM10Jan, Wash2005FM10Feb, etc holds the regression results for
each month.

 

Now, I want to sum up the residuals of all the 12 regression.  How can I
do that in a loop? 

For (i in 1:12){

Temp <- paste('sum(Wash2005FM10', strtrim(month.name[i],3),
'$residual**2)',sep="")

}

 

Temp will give a string "sum(Wash2005FM10Jan$residual**2)".  How can I
get R to evaluate this string? 

 

Thank you.  

 

 

Daniel Chan

Meteorologist

Georgia Forestry Commission

P O Box 819

Macon, GA 

31202

Tel: 478-751-3508

Fax: 478-751-3465

 


	[[alternative HTML version deleted]]

