LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 22 Oct 2003 13:10:38 -0500
Reply-To:     Robin High <robinh@UNLSERVE.UNL.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Robin High <robinh@UNLSERVE.UNL.EDU>
Subject:      Re: SAS/IML
Comments: To: sonia afroz <afroz_sonia@HOTMAIL.COM>
In-Reply-To:  <>
Content-Type: TEXT/PLAIN; charset=US-ASCII


It seems your IML program is not complete since the regression procedure is written as a module that begins with START. A few embellishments seem to make it work:

proc iml; use inmoodata;

read all var {rp12} into y ; read all var { x1 x2 x3 } into x; print x, y;

start reg(x,y); reset print; n=nrow(x); /* number of observations */ k=ncol(x); /* number of variables */ xpx=x`*x; /* cross-products */ xpy=x`*y; xpxi=inv(xpx); /* inverse crossproducts */ b=xpxi*xpy; /* parameter estimates */ yhat=x*b; /* predicted values */ resid=y-yhat; /* residuals */ sse=resid`*resid; /* sum of squared errors */ dfe=n-k; /* degrees of freedom error */ mse=sse/dfe; /* mean squared error */ rmse=sqrt(mse); /* root mean squared error */ covb=xpxi#mse; /* covariance of estimates */ stdb=sqrt(vecdiag(covb)); /* standard errors */ t=b/stdb; /* ttest for estimates=0 */ probt=1-probf(t#t,1,dfe); /* significance probability */ print name b stdb t probt; finish;

RUN reg(x,y); * The RUN statement executes the module;


Robin High University of Oregon

Back to: Top of message | Previous page | Main SAS-L page