Appendix a to applied probability: directory of m-functions and m  (Page 18/24)

 Page 18 / 24

japprox.m Assumes discrete setup and calculates basic quantities for a pair of random variables as in jsimple. Plots the regression line and regression curve.

% JAPPROX file japprox.m Basic quantities for ac pair {X,Y} % Version of 5/7/96% Assumes tuappr has set X, Y, PX, PY, t, u, P EX = total(t.*P) % E[X]EY = total(u.*P) % E[Y] EX2 = total(t.^2.*P) % E[X^2]EY2 = total(u.^2.*P) % E[Y^2] EXY = total(t.*u.*P) % E[XY]VX = EX2 - EX^2 % Var[X] VY = EY2 - EY^2 % Var[Y]cv = EXY - EX*EY; % Cov[X,Y] = E[XY]- E[X]E[Y]if abs(cv)>1e-9 % to prevent roundoff error masking zero CV = cvelse CV = 0end a = CV/VX % regression line of Y on X isb = EY - a*EX % u = at + b R = CV/sqrt(VX*VY);disp(['The regression line of Y on X is: u = ',num2str(a),'t + ',num2str(b),])disp(['The correlation coefficient is: rho = ',num2str(R),])disp(' ') eY = sum(u.*P)./sum(P); % eY(t) = E[Y|X = t]RL = a*X + b; plot(X,RL,X,eY,'-.')grid title('Regression line and Regression curve')xlabel('X values') ylabel('Y values')legend('Regression line','Regression curve') clear eY % To conserve memoryclear RL disp('Calculate with X, Y, t, u, P, as in joint simple case')

Calculations and tests for independent random variables

mgsum.m function [z,pz] = mgsum(x,y,px,py) determines the distribution for the sum of an independent pair of simple random variables from their distributions.

function [z,pz] = mgsum(x,y,px,py)% MGSUM [z,pz] = mgsum(x,y,px,py) Sum of two independent simple rv% Version of 5/6/96 % Distribution for the sum of two independent simple random variables% x is a vector (row or column) of X values % y is a vector (row or column) of Y values% px is a vector (row or column) of X probabilities % py is a vector (row or column) of Y probabilities% z and pz are row vectors [a,b]= meshgrid(x,y); t = a+b;[c,d] = meshgrid(px,py);p = c.*d; [z,pz]= csort(t,p);

mgsum3.m function [w,pw] = mgsum3(x,y,z,px,py,pz) extends mgsum to three random variables by repeated application of mgsum. Similarly for mgsum4.m.

function [w,pw] = mgsum3(x,y,z,px,py,pz)% MGSUM3 [w,pw] = mgsum3(x,y,z,px,py,y) Sum of three independent simple rv% Version of 5/2/96 % Distribution for the sum of three independent simple random variables% x is a vector (row or column) of X values % y is a vector (row or column) of Y values% z is a vector (row or column) of Z values % px is a vector (row or column) of X probabilities% py is a vector (row or column) of Y probabilities % pz is a vector (row or column) of Z probabilities% W and pW are row vectors [a,pa]= mgsum(x,y,px,py); [w,pw]= mgsum(a,z,pa,pz);

mgnsum.m function [z,pz] = mgnsum(X,P) determines the distribution for a sum of n independent random variables. X an n -row matrix of X -values and  P an n -row matrix of P -values (padded with zeros, if necessary, to make all rows the same length.

function [z,pz] = mgnsum(X,P)% MGNSUM [z,pz] = mgnsum(X,P) Sum of n independent simple rv% Version of 5/16/96 % Distribution for the sum of n independent simple random variables% X an n-row matrix of X-values % P an n-row matrix of P-values% padded with zeros, if necessary % to make all rows the same length[n,r] = size(P);z = 0; pz = 1;for i = 1:n x = X(i,:);p = P(i,:);x = x(find(p>0)); p = p(find(p>0)); [z,pz]= mgsum(z,x,pz,p); end

Questions & Answers

how can chip be made from sand
Eke Reply
is this allso about nanoscale material
Almas
are nano particles real
Missy Reply
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
Lale Reply
no can't
Lohitha
where is the latest information on a no technology how can I find it
William
currently
William
where we get a research paper on Nano chemistry....?
Maira Reply
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
Maira Reply
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
Google
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
Hafiz Reply
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
Jyoti Reply
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
A fair die is tossed 180 times. Find the probability P that the face 6 will appear between 29 and 32 times inclusive
Samson Reply

Read also:

Get Jobilize Job Search Mobile App in your pocket Now!

Source:  OpenStax, Applied probability. OpenStax CNX. Aug 31, 2009 Download for free at http://cnx.org/content/col10708/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Applied probability' conversation and receive update notifications?

 By Michael Sag By Brooke Delaney By Sandhills MLT By Jazzycazz Jackson By Richley Crapo By Rhodes By Charles Jumper By Keyaira Braxton By Richley Crapo By Christine Zeelie