Date: Tue, 3 Apr 2007 15:37:01 -0400 "data _null_;" "SAS(r) Discussion" "data _null_;" Re: Fitting power law To: Vijay <200704031833.l33FfsXQ026667@mailgw.cc.uga.edu> text/plain; charset=ISO-8859-1; format=flowed

We best get Cassell to "weight in" on this technique.

data work.yx; input y x @@; obs = _n_; cards; 10 0.001 5 0.003 6 0.06 9 0.07 15 0.09 19 0.10 24 0.11 37 0.14 ;;;; run; proc print; run; data work.by5; if 0 then set work.yx; if _n_ eq 1 then do; declare hash d(dataset:'work.yx',ordered:'a'); d.defineKey('obs'); d.defineData(all: 'yes'); d.defineDone(); end; obs0 = d.num_items; do group = 1 by 1 until(obs gt obs0); do obs = group to group+4 by 1; rc = d.find(); if rc eq 0 then output; end; end; stop; drop rc; run; proc print data=work.by5; run;

proc reg noprint data=work.by5 outest=work.est; by group; model y = x; run; proc contents varnum; proc print; run; proc export replace outfile='regressonEstimates.xls' data=work.est; run;

On 4/3/07, Vijay <vuw100@yahoo.com> wrote: > Hello All, > > I would be gratfeful if someone could help me with this problem, > > I have data like > > y x > 10 0.001 > 5 0.003 > 6 0.06 > 9 0.07 > 15 0.09 > 19 0.10 > 24 0.11 > 37 0.14 > > etc.. > > now I want to fit an equation of the form y=ax^b to the data set > iteratively, that is I use the first 5 points fit the equation, remove the > first point and add the next point and fit the equation, and do the process > iteratively and at each step output both a and b to a text/excel file, > so at first step I fit > > 10 0.001 > 5 0.003 > 6 0.06 > 9 0.07 > 15 0.09 > > and in second step I get rid of the first point i.e. (10,0.001) and add (19 > 0.10) etc.. > > Is there a way I could do this in SAS > > Thank you in advance > > Vijay >

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