# 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

what is the coefficient of -4×
-1
Shedrak
the operation * is x * y =x + y/ 1+(x × y) show if the operation is commutative if x × y is not equal to -1
An investment account was opened with an initial deposit of $9,600 and earns 7.4% interest, compounded continuously. How much will the account be worth after 15 years? Kala Reply lim x to infinity e^1-e^-1/log(1+x) given eccentricity and a point find the equiation Moses Reply 12, 17, 22.... 25th term Alexandra Reply 12, 17, 22.... 25th term Akash College algebra is really hard? Shirleen Reply Absolutely, for me. My problems with math started in First grade...involving a nun Sister Anastasia, bad vision, talking & getting expelled from Catholic school. When it comes to math I just can't focus and all I can hear is our family silverware banging and clanging on the pink Formica table. Carole I'm 13 and I understand it great AJ I am 1 year old but I can do it! 1+1=2 proof very hard for me though. Atone hi Adu Not really they are just easy concepts which can be understood if you have great basics. I am 14 I understood them easily. Vedant find the 15th term of the geometric sequince whose first is 18 and last term of 387 Jerwin Reply I know this work salma The given of f(x=x-2. then what is the value of this f(3) 5f(x+1) virgelyn Reply hmm well what is the answer Abhi If f(x) = x-2 then, f(3) when 5f(x+1) 5((3-2)+1) 5(1+1) 5(2) 10 Augustine how do they get the third part x = (32)5/4 kinnecy Reply make 5/4 into a mixed number, make that a decimal, and then multiply 32 by the decimal 5/4 turns out to be AJ how Sheref can someone help me with some logarithmic and exponential equations. Jeffrey Reply sure. what is your question? ninjadapaul 20/(×-6^2) Salomon okay, so you have 6 raised to the power of 2. what is that part of your answer ninjadapaul I don't understand what the A with approx sign and the boxed x mean ninjadapaul it think it's written 20/(X-6)^2 so it's 20 divided by X-6 squared Salomon I'm not sure why it wrote it the other way Salomon I got X =-6 Salomon ok. so take the square root of both sides, now you have plus or minus the square root of 20= x-6 ninjadapaul oops. ignore that. ninjadapaul so you not have an equal sign anywhere in the original equation? ninjadapaul hmm Abhi is it a question of log Abhi 🤔. Abhi I rally confuse this number And equations too I need exactly help salma But this is not salma it's Faiza live in lousvile Ky I garbage this so I am going collage with JCTC that the of the collage thank you my friends salma Commplementary angles Idrissa Reply hello Sherica im all ears I need to learn Sherica right! what he said ⤴⤴⤴ Tamia hii Uday hi salma hi Ayuba Hello opoku hi Ali greetings from Iran Ali salut. from Algeria Bach hi Nharnhar what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks. Kevin Reply a perfect square v²+2v+_ Dearan Reply kkk nice Abdirahman Reply Jeannette has$5 and \$10 bills in her wallet. The number of fives is three more than six times the number of tens. Let t represent the number of tens. Write an expression for the number of fives.
What is the expressiin for seven less than four times the number of nickels
How do i figure this problem out.
how do you translate this in Algebraic Expressions
why surface tension is zero at critical temperature
Shanjida
I think if critical temperature denote high temperature then a liquid stats boils that time the water stats to evaporate so some moles of h2o to up and due to high temp the bonding break they have low density so it can be a reason
s.
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
A fair die is tossed 180 times. Find the probability P that the face 6 will appear between 29 and 32 times inclusive