n=input('Please enter your choice: n= ');
negative=input('Please enter your choice: negative= ');
confidence=input('Please enter your choice: confidence= ');
pos=nnegative;
z = norminv(1(1confidence)/2);
phat = 1.0*pos/n;
value=(phat + z*z/(2*n)  z * sqrt((phat*(1phat)+z*z/(4*n))/n))/(1+z*z/n);
kill=1value;
fprintf('%.8f ', kill);
I made this code in MATLAB some time ago but I’ve forgotten what it does and can’t figure it out. What does it do.
What does this MATLAB code do?
Moderators: phlip, Moderators General, Prelates

 Posts: 44
 Joined: Sun May 01, 2011 5:18 am UTC
What does this MATLAB code do?
Last edited by blademan9999 on Wed Oct 24, 2018 10:19 am UTC, edited 1 time in total.
http://officeofstrategicinfluence.com/spam/
That link kills spam[/size][/b][/u]
That link kills spam[/size][/b][/u]
Re: What does this code do?
Which language?

 Posts: 44
 Joined: Sun May 01, 2011 5:18 am UTC
Re: What does this MATLAB code do?
Matlab
http://officeofstrategicinfluence.com/spam/
That link kills spam[/size][/b][/u]
That link kills spam[/size][/b][/u]
Re: What does this MATLAB code do?
Could you make some 3D plots of kill for a chosen n with negative=[0..n] (best be integers) and confidence=[0.9..0.9]?
I have no idea. All I can see is that for large values of z (confidence approaching 1) kill approaches 1 (0 for large negative values) and for values near 0 kill approaches negative/n. So some conditional probability based on the confidence parameter, but no idea if it has a name or is written down correctly in the first place.
I have no idea. All I can see is that for large values of z (confidence approaching 1) kill approaches 1 (0 for large negative values) and for values near 0 kill approaches negative/n. So some conditional probability based on the confidence parameter, but no idea if it has a name or is written down correctly in the first place.
 phlip
 Restorer of Worlds
 Posts: 7566
 Joined: Sat Sep 23, 2006 3:56 am UTC
 Location: Australia
 Contact:
Re: What does this MATLAB code do?
Judging mostly based on the variable names, I'm guessing it's some sort of confidence interval calculation...
Like, say you do a test 100 times, and get 75 successes. The thing you're testing probably has a probability of success somewhere around 3/4, but you can't be sure exactly where. But if you run that code and enter, for instance, 100; 75; 0.9 and then 100; 75; +0.9 you get the results 0.673 and 0.814... so you can be 90% sure that the real probability is somewhere between 67.3% and 81.4%.
At least, that's my halfremembered understanding of the theory. I don't recognise the actual formula, though. It's been a long time since I've done any stats (and even when I did, I didn't really understand the actual formulae... if you say the words "student's t test" to me, my eyes reflexively glaze over).
[edit]
Aha, I found it: Wilson score interval.
Like, say you do a test 100 times, and get 75 successes. The thing you're testing probably has a probability of success somewhere around 3/4, but you can't be sure exactly where. But if you run that code and enter, for instance, 100; 75; 0.9 and then 100; 75; +0.9 you get the results 0.673 and 0.814... so you can be 90% sure that the real probability is somewhere between 67.3% and 81.4%.
At least, that's my halfremembered understanding of the theory. I don't recognise the actual formula, though. It's been a long time since I've done any stats (and even when I did, I didn't really understand the actual formulae... if you say the words "student's t test" to me, my eyes reflexively glaze over).
[edit]
Aha, I found it: Wilson score interval.
Code: Select all
enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵╰(ಠ_ಠ ⚠) {exit((int)⚠);}
Who is online
Users browsing this forum: No registered users and 5 guests