s-news
[Top] [All Lists]

[S] Question on weighted non linear regression

To: "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
Subject: [S] Question on weighted non linear regression
From: Abd Rahman Kassim <rahmank@frim.gov.my>
Date: Mon, 28 Feb 2000 22:24:09 +0800
Sender: owner-s-news@wubios.wustl.edu
Please disregard my previous question which was not correctly addressed. My 
new question is as follows:

I am analysing data using nls regression at different weight. I've tested 
the two "similar" forms of nls function:        

a) nls.fm1 <- nls( (~sqrt(bat^0)*(bag -(b0* bat^b2 * exp(b1 * bat + b3 *
                idp1 + b4 *idp2+ b5 * idp3 + b6 * idp4 + b7 * idp5)))), start = 
nls.st, 
trace = T)

b) nls.fm0 <- nls( ((bag ~(b0* bat^b2 * exp(b1 * bat + b3 * idp1 + b4 *
                idp2+ b5 * idp3 + b6 * idp4 + b7 * idp5)))), start = nls.st, 
trace = T)

I get similar results for the root mean square error (rmse) for both model 
from the program output. But when I calculated rmse by writing S-code (see 
below) from the above model, I get different results for the  rmse and 
similarly the r-square value and  mean of the predicted dependent variable 
(i.e. predicted bag).

Example of the S-code to calculate the mean, rmse and r-square are written 
as follows:
        
        b<-bag  #predictor variable i.e. bag
        z1<-nls.fm0$fitted
        m<-mean(bag)
        mz<-mean(z1) # mean of the predicted dependent variable
        rmse<-(sum((b-z1)^2)/(n-8))^.5 #residual mean square error
        r<-sum((z1-m)^2)/sum((b-m)^2) #r-square

where  n is the number of observations

The output of my calculation:

                   n       m        rmse           r            mz
   nls.fm1 541 27.148 34.6513 1.8637 -0.0005073
  nls.fm0 541 27.148 18.3243 0.1735 27.0900049

Note: The r-square is greater than zero for nls.fm1

I get the same value for the calculated rmse and nls regression output for 
the nls.fm0 but not for the nls.fm1.

What should be correct way to calculate the rmse and mean of the weighted 
nls regression? The reason for the calculation of rmse and mean is to 
determine the Furnival Index as a means to select the best fit equation.

Any comment is appreciated.

Abd Rahman Kassim
Hill Forest Silviculture
Forest Research Institute Malaysia (FRIM)
Kepong 52109
Kuala Lumpur

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>