<< Chapter < Page Chapter >> Page >

qsample.m Simulates a sample for a given population density. Determines sample parameters and approximate population parameters. Assumes dfsetup or acsetup has been run. Takes asinput the distribution matrices X , P X and the sample size n . Uses a random number generator to obtain the probability matrix U and uses the m-function dquant to determine the sample. Assumes dfsetup or acsetup has been run.

% QSAMPLE file qsample.m Simulates sample for given population density % Version of 1/31/96% Determines sample parameters % and approximate population parameters.% Assumes dfsetup or acsetup has been run X = input('Enter row matrix of VALUES ');PX = input('Enter row matrix of PROBABILITIES '); n = input('Sample size n = ');m = length(X); U = rand(1,n);T = dquant(X,PX,U); ex = sum(T)/n;EX = dot(X,PX); vx = sum(T.^2)/n - ex^2;VX = dot(X.^2,PX) - EX^2; disp('The sample is in column vector T')disp(['Sample average ex = ', num2str(ex),])disp(['Approximate population mean E(X) = ',num2str(EX),])disp(['Sample variance vx = ',num2str(vx),])disp(['Approximate population variance V(X) = ',num2str(VX),])
Got questions? Get instant answers now!

targetset.m Setup for arrival at a target set of values. Used in conjunction with the m-procedure targetrun to determine the number of trials needed to visit k of a specified set of target values. Input consists of the distribution matrices X , P X and the specified set E of target values.

% TARGETSET file targetset.m Setup for sample arrival at target set % Version of 6/24/95X = input('Enter population VALUES '); PX = input('Enter population PROBABILITIES ');ms = length(X); x = 1:ms; % Value indicesdisp('The set of population values is') disp(X);E = input('Enter the set of target values '); ne = length(E);e = zeros(1,ne); for i = 1:nee(i) = dot(E(i) == X,x); % Target value indices endF = [0 cumsum(PX)];A = F(1:ms); B = F(2:ms+1);disp('Call for targetrun')
Got questions? Get instant answers now!

targetrun.m Assumes the m-file targetset has provided the basic data. Input consists of the number r of repetitions and the number k of the target states to visit. Calculates and displays various results.

% TARGETRUN file targetrun.m Number of trials to visit k target values % Version of 6/24/95 Rev for Version 5.1 1/30/98% Assumes the procedure targetset has been run. r = input('Enter the number ofrepetitions '); disp('The target set is')disp(E) ks = input('Enter the number of target values to visit ');if isempty(ks) ks = ne;end if ks>ne ks = ne;end clear T % Trajectory in value indices (reset)R0 = zeros(1,ms); % Indicator for target value indices R0(e) = ones(1,ne);S = zeros(1,r); % Number of trials for each run (reset) for k = 1:rR = R0; i = 1;while sum(R)>ne - ks u = rand(1,1);s = ((A<u)&(u<= B))*x'; if R(s) == 1 % Deletes indices as values reachedR(s) = 0; endT(i) = s; i = i+1;end S(k) = i-1;end if r == 1disp(['The number of trials to completion is ',int2str(i-1),])disp(['The initial value is ',num2str(X(T(1))),])disp(['The terminal value is ',num2str(X(T(i-1))),])N = 1:i-1; TR = [N;X(T)]'; disp('To view the trajectory, call for TR')else [t,f]= csort(S,ones(1,r)); D = [t;f]'; p = f/r;AV = dot(t,p); SD = sqrt(dot(t.^2,p) - AV^2);MN = min(t); MX = max(t);disp(['The average completion time is ',num2str(AV),])disp(['The standard deviation is ',num2str(SD),])disp(['The minimum completion time is ',int2str(MN),])disp(['The maximum completion time is ',int2str(MX),])disp(' ') disp('To view a detailed count, call for D.')disp('The first column shows the various completion times;') disp('the second column shows the numbers of trials yielding those times')plot(t,cumsum(p)) gridtitle('Fraction of Runs t Steps or Less') ylabel('Fraction of runs')xlabel('t = number of steps to complete run') end
Got questions? Get instant answers now!

Questions & Answers

general equation for photosynthesis
Ojasope Reply
6CO2 + 6H2O + solar energy= C6H1206+ 6O2
Anastasiya
meaning of amino Acids
AJAYI Reply
a diagram of an adult mosquito
mubarak Reply
what are white blood cells
Mlungisi Reply
white blood cell is part of the immune system. that help fight the infection.
MG
what about tissue celss
Mlungisi
Cells with a similar function, form a tissue. For example the nervous tissue is composed by cells:neurons and glia cells. Muscle tissue, is composed by different cells.
Anastasiya
I need further explanation coz celewi anything guys,,,
Calvin Reply
hey guys
Isala
on what?
Anastasiya
hie
Lish
is air homogenous or hetrogenous
damiane Reply
homogenous
Kevin
why saying homogenous?
Isala
explain if oxygen is necessary for photosynthesis
Allice Reply
explain if oxygen is necessary for photosynthesis
Allice Reply
Yes, the plant does need oxygen. The plant uses oxygen, water, light, and produced food. The plant use process called photosynthesis.
MG
By using the energy of sunlight, plants convert carbon dioxide and water into carbohydrates and oxygen by photosynthesis. This happens during the day and sunlight is needed.
NOBLE
no. it s a product of the process
Anastasiya
yet still is it needed?
NOBLE
no. The reaction is: 6CO2+6H20+ solar energy =C6H12O6(glucose)+602. The plant requires Carbon dioxyde, light, and water Only, and produces glucose and oxygen( which is a waste).
Anastasiya
what was the question
NOBLE Reply
joining
Godfrey
the specific one
NOBLE
the study of non and living organism is called.
Godfrey
Is call biology
Alohan
yeah
NOBLE
yes
Usher
what Is ecology
Musonda Reply
what is a cell
Emmanuel Reply
A cell is a basic structure and functional unit of life
Ndongya
what is biolgy
Hawwi Reply
is the study of living and non living organisms
Ahmed
may u draw the female organ
MARTIN Reply
i dont understand
Asal
:/
Asal
me too
DAVID
anabolism and catabolism
Sani Reply
Anabolism refers to the process in methabolism in which complex molecules are formed "built" and requires energy to happen. Catabolism is the opposite process: complex molecules are deconstructed releasing energy, such as during glicolysis.
Anastasiya
Explain briefly independent assortment gene .
Otu Reply
hi
Amargo
hi I'm Anatalia
Joy
what do you mean by pituitary gland
Digambar
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





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?

Ask
Brooke Delaney
Start Exam
Madison Christian
Start Flashcards
JavaChamp Team
Start Quiz