Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Re: power function

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 07-02-2010 09:39 AM
(4075 views)

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

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

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

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

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.