Help using Base SAS procedures

power function

Reply
Occasional Contributor
Posts: 17

power function

Hello all, I am new to this forum.

I am an ecologist who has been using sas for years to do basic statistics and data manipulations. I am interested in calculating a power function from a set of data in the form:

x y
1 28
2 40
3 45
4 48
5 52
6 54

Is there a way I can do this in proc reg? or is there a different procedure to calculate this? I have spend many hours wading through online documentation.

Thanks in advance.
peat
Valued Guide
Posts: 634

Re: power function

Posted in reply to peatjohnston
Peat,
Please tell us a bit more about what you are looking for. Are you talking about the power of a test (1-beta)? If so:

The power of a statistical test can usually be calculated. It is not real hard to do, but you have to know the right formula and usually an inverse probability function.

In SAS/STAT you also now have the POWER procedure and the Power and Sample Size application.
Art
Occasional Contributor
Posts: 17

Re: power function

Thanks Art,

I am not talking about the power of a test, though I am interested in sample size. These are cumulative species richness curves for which I want to associate a power function in the form:

y=a*x^b

For the original set of numbers I posted, the function is:

y=29.37x^0.358

I want to compare a series of these curves, by looking at the variation of the coefficients with each added sample 'x'. My question is how do I find these coefficients 'a' and 'b' from the given data.

Thanks again,

peat
Respected Advisor
Posts: 2,655

Re: power function

Posted in reply to peatjohnston
Peat,

How about PROC NLIN?

Try this:
data one;
input x y;
cards;
1 28
2 40
3 45
4 48
5 52
6 54
;

proc nlin data=one method=marquardt hougaard;
parms a=3 b=2;
model y=a*x**b;
run;

I think the results will be straightforward.

Now if variances are not gaussian, or there is clustering or hierarchical issues, you may wish to consider PROC NLMIXED.

Steve Denham
Occasional Contributor
Posts: 17

Re: power function

Posted in reply to peatjohnston
Steve,

I think this might work, but how would I output the coefficients into a new data set? I would be looking at getting the coefficients from hundreds of these measures, then plot the mean and + - 1 standard deviation for them.

Thanks,

peat
SAS Super FREQ
Posts: 8,868

Re: power function

Posted in reply to peatjohnston
Hi:
If you use the ODS TRACE statement, you can find out the name of the output object that contains the coefficient and the mean and the std. Then, once you have then output object name(s), you can create an output dataset that contains the data points. From there, it would be fairly easy to graph the points.

For example, if you modified the above PROC NLIN code to use ODS TRACE:
[pre]
ODS TRACE ON/ LABEL;
...PROC NLIN...
ODS TRACE OFF;
[/pre]

Then you would see in your SAS log:
[pre]
Output Added:
-------------
Name: IterHistory
Label: Iterative Phase
Template: stat.nlin.IterHistory
Path: Nlin.IterHistory
Label Path: 'The Nlin Procedure'.'Iterative Phase'
-------------
NOTE: Convergence criterion met.

Output Added:
-------------
Name: ConvergenceStatus
Label: Convergence Status
Template: Stat.nlin.ConvergenceStatus
Path: Nlin.ConvergenceStatus
Label Path: 'The Nlin Procedure'.'Convergence Status'
-------------

Output Added:
-------------
Name: EstSummary
Label: Estimation Summary
Template: stat.nlin.EstSummary
Path: Nlin.EstSummary
Label Path: 'The Nlin Procedure'.'Estimation Summary'
-------------

Output Added:
-------------
Name: ANOVA
Label: Summary Statistics : Dependent Variable y
Template: stat.nlin.ANOVA
Path: Nlin.ANOVA
Label Path: 'The Nlin Procedure'.'Summary Statistics : Dependent
Variable y'
-------------

Output Added:
-------------
Name: ParameterEstimates
Label: Parameter Summary
Template: stat.nlin.ParameterEstimates
Path: Nlin.ParameterEstimates
Label Path: 'The Nlin Procedure'.'Parameter Summary'
-------------

Output Added:
-------------
Name: CorrB
Label: Approximate Correlation Matrix
Template: stat.nlin.CorrB
Path: Nlin.CorrB
Label Path: 'The Nlin Procedure'.'Approximate Correlation Matrix'
-------------

[/pre]

Let's say that you wanted the Parameter Estimates output object, you could create it like this (now that we know the name from the TRACE output):

[pre]
ods output ParameterEstimates=work.parmest;
proc nlin data=one method=marquardt hougaard;
parms a=3 b=2;
model y=a*x**b;
run;

[/pre]

and the output dataset WORK.PARMEST would contain:
[pre]
Obs Parameter Estimate StdErr Alpha LowerCL UpperCL Skewness tValue Probt

1 a 30.1779 1.2717 0.05 26.6473 33.7086 0.0359 23.73 <.0001
2 b 0.3366 0.0301 0.05 0.2531 0.4201 0.0559 11.19 0.0004

[/pre]

ODS TRACE and ODS OUTPUT work with any SAS procedure that creates output objects, so if you find that PROC NLIN is not the procedure you need, then you only need to use ODS TRACE ON/OFF around your new procedure to find out the names of the output objects.

In addition, if you have SAS 9.2, you can try using the ODS GRAPHICS ON/OFF statements around your STAT procedure to see whether there are any automatic graphics associated with your procedure of choice.

cynthia
Ask a Question
Discussion stats
  • 5 replies
  • 1549 views
  • 0 likes
  • 4 in conversation