Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to add confidence intervals (bounds) to Logistic function

Subject: how to add confidence intervals (bounds) to Logistic function

From: david

Date: 18 Apr, 2011 12:24:07

Message: 1 of 3

Dear guys,

I want to add confidence intervals to logistic function.

Logistic function which is defined as : y = exp(z) / (1+exp(z)), also z = a+b*x.

For the convenience I provide the code:

a=-5;

b=38;

x=0.01:0.01:0.5;

z=a+b.*x;

y = exp(z)./(1+exp(z));

figure(1);plot(x,y);hold on;

Could anyone tell me how to calculate confidence intervals for y in the plot of fig1 (x&y plot).

Let's start with 95% two-tail.

Thank you in advance.

David

Subject: how to add confidence intervals (bounds) to Logistic function

From: david

Date: 3 May, 2011 13:15:05

Message: 2 of 3

Could anyone help me please?

Thanks.

Dawei

Subject: how to add confidence intervals (bounds) to Logistic function

From: Andrew O'Connor

Date: 3 May, 2011 13:47:05

Message: 3 of 3

The fisher information matrix is:
             _____________________________
I(u,s) = | 1/n(3s^2) | 0 |
              --------------------------------------------------
              | 0 | (pi^2 + 3) / n(9s^2) |
             ---------------------------------------------------
Where n is the number of sample points.

Variance co-variance matrix is the inverse of the Fisher Information Matrix... I^-1

You can then use that to calculate the confidence intervals on u and s using the positions on the I^-1 matrix

Var(u) = I^-1(1,1) %Row 1 Col 1
Var(s) = I^-1(2,2) %Row 2 Col 2

Where s is the point estimate parameter from MLE.

Where p is your confidence number (eg. 0.9)

Then you can assume the confidence intervals follow a normal distribution (not always true unless you do inf samples but a quick and dirty way to do it):

u_low = u - InvNorm[ (1+p)/2] sqrt[ Var(u)]
u_upper = u + InvNorm[ (1+p)/2] sqrt[ Var(u)]

For s (noting that it must be greater then 0) it can be assumed that this is a truncated normal distribution:

s_lower = s. exp{ InvNorm[ (1+p)/2] sqrt[ Var(u)] / -s }
s_upper = s. exp{ InvNorm[ (1+p)/2] sqrt[ Var(u)] / s } note not negative on denominator

From there you have the confidence intervals of your parameter estimates.

Now you can do the pdf, cdf etc confidence intervals using a very quick monte carlo at each point.

I'm sure there is a quicker way though...

Good luck..

Occa

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us