Solved
Contributor
Posts: 58

# 95% CI (Confidence Interval)

Hello
I have need the last modification in my proc programming that can also estimate the 95% CI (Confidence Interval), though my proc programming estimate 95% CL but I need 95% CI (Confidence Interval).
Best regards,

data exp;
set geumar2;
if expno=1;
run;
;

proc nlin data=exp method=marquardt;
parms B=0.5 R=0.1;
delta=0.000001;
s=sow**(1-B)-R*(1-B)*time;
if s>0 then stx=s**(1/(1-B));
else stx=0;
model stw=stx;
sb=(sow**(1-B+delta)-R*(1-B+delta)*time);
if sb>0 then sdb=(stx-sb**(1/(1-B+delta)))/delta;
else sdb=0;
der.B=sdb;
sr=(sow**(1-B)-(R-delta)*(1-B)*time);
if sr>0 then sdr=(stx-sr**(1/(1-B)))/delta;
else sdr=0;
der.R=sdr;
output out=expp p=pstw r=stw_residual;
run;
proc summary data=expp;
var stw_residual stw;
output out=stats css(stw)=sstot uss(stw_residual)=ssres N=N;
run;
data expp;
set stats;
rsquared=1-(ssres/sstot);
adjrsquared = 1-(1-rsquared)*(N-1) / (N- 2 -1);
run;
proc print data=expp;
run;

Accepted Solutions
Solution
‎09-25-2015 06:23 AM
Valued Guide
Posts: 684

## Re: 95% CI (Confidence Interval)

I was confused by your request, because NLIN automatically gives you the 95% confidence intervals for the parameter estimates. Bootstrap gives an alternative approach. But now I think you are requesting a way to program this outside of NLIN, possibly in the same data step used for the R2 calcuation. You know that you can use an ODS output statement to get the parameter estimates and confidence intervals saved as a data file. Then you would have them for other processing. The default method for the confidence interval is

estimate +/- t.SE,

where t is the 97.5 percentile of the t distrubiton with the error degrees of freedom (with large df, t is about 2). Thus, you can check your work.

All Replies
Posts: 5,053

## Re: 95% CI (Confidence Interval)

Confidence intervals of predicted means or
confidence intervals of individual predictions or
confidence intervals of parameter estimates ?
PG
Posts: 2,055

## Re: 95% CI (Confidence Interval)

You can get confidence intervals for the parameters using the BOOTSTRAP command in PROC NLIN.

You can get confidence intervals for the predicted values using the OUTPUT statement in PROC NLIN.

--
Paige Miller
Contributor
Posts: 58

## Re: 95% CI (Confidence Interval)

I'm looking for confidence intervals for the parameters. But sir(s) I don't have full command over SAS programming as I'm Fisheries specialist. I need you to insert the modify program into my above proc program please.
Posts: 2,055

## Re: 95% CI (Confidence Interval)

Surely you can look up the BOOTSTRAP command in SAS Help. It's not really that hard to use.

--
Paige Miller
Contributor
Posts: 58

## Re: 95% CI (Confidence Interval)

Sir
I search but couldn't understand. Please you modify my proc program.
Super User
Posts: 20,735

## Re: 95% CI (Confidence Interval)

UmarKhan wrote:
But sir(s) I don't have full command over SAS programming as I'm Fisheries specialist. I need you to insert the modify program into my above proc program please.

That's not how this forum works. Your entire program above was written by people on this forum. I question how you can interpret the results if you don't understand how things are calculated. Are you even certain it's doing what you want/need?

If you want someone to write programs for you, hire a consultant. If you want HELP then please feel free to post questions here. Your questions are beyond the help category at this point and more do my work for me.

Contributor
Posts: 58

## Re: 95% CI (Confidence Interval)

Dear Reeza
I am trying to learn sas programming but due to a big difference between my field and such programming that creates a barrier in my learning. I have try this http://www.ats.ucla.edu/stat/sas/faq/bootstrap.htm but couldn't get any idea.

P.S I can interpret the result and have used sas in my all publication. It doesn't mean that if someone can't write sas program he would also can't interpret the result.
Only adjusted r2 is inserted in above proc program, and I have 12 more such proc. I just need one more thing that is 95% ci and for which I dontu think to hire a consultant if I have approach to expert like you through sas community.
Super User
Posts: 20,735

## Re: 95% CI (Confidence Interval)

But how do you know the programmer inputted the correct options to generate said output?

Your original code is from this question, albeit you modified it from the sample provided.

https://communities.sas.com/t5/SAS-Statistical-Procedures/Exponential-regression-and-square-root-mod...

Re: current question - here's the documentation for the bootstrap statement.

http://support.sas.com/documentation/cdl/en/statug/66859/HTML/default/viewer.htm#statug_nlin_syntax0...

Good Luck

Posts: 5,053

## Re: 95% CI (Confidence Interval)

"But how do you know the programmer inputted the correct options to generate said output?"

Rhetorical question, I hope.

PG
Posts: 2,655

## Re: 95% CI (Confidence Interval)

Not rhetorical at all, PG. Shoot, some days I put gunk into code that I have no idea as to what is going to happen.

Contributor
Posts: 58

## Re: 95% CI (Confidence Interval)

Dear Reeza
the proc program I have and the one suggested in this group both are different. The suggested ones generate very different values than mine ones. And I got these oroc from my Lab.
And I fist make calculations with hand for few samples than I match it with sas results, in this way I varify sas results.

Still J didn't get my answer .
Posts: 5,053

## Re: 95% CI (Confidence Interval)

I find the structure of your model equation quite strange, with parameter B being used both as an exponent and as a factor... but that is not a SAS issue. Try adding the statement

``bootstrap / bootci(BC) bootplots(all);``

to proc NLIN to get the confidence intervals. Look at the scatter graph (produced if ods graphics is on) to see the relationship between your parameter estimates.

PG
Contributor
Posts: 58

## Re: 95% CI (Confidence Interval)

Sir I didn't get any result. I got this error: ERROR: Procedure BOOTSTRAP not found.

Can't I get the 95% CI like the ones (95% CL, see the attach image) genereted by my proc automatically?

Posts: 5,053

## Re: 95% CI (Confidence Interval)

At this point, I can only quote @PaigeMiller "Surely you can look up the BOOTSTRAP command in SAS Help. It's not really that hard to use." and point you to @Reeza's references above.

Ultimately, you will need to show some basic understanding of the statistical procedures you are using to defend your results.

PG
🔒 This topic is solved and locked.