ogunmiloro

115 Reputation

6 Badges

3 years, 18 days

MaplePrimes Activity


These are replies submitted by ogunmiloro

@acer oh I checked my book and discovered that the numerator was a mistake. It should be gamma (1).

@acer ok I got you better

(1) gamma 1 should take 1. (Gamma 1=1) and 

(2) tau should take 0.2 (tau= 0.2) 

thanks

@acer (1) Want i intend to do is for MAPLE to compute the gamma of the values obtained  (for instance, the gamma(1)=1, gamma(1/2)=root(Pi), etc.)
(2)  I first picked the value of tau to be tau=0.2. Also taking other values of tau to be 0.4 - 1.0 (that is, if tau ranges between 0.2 - 1.0)
(3) Again, I picked the value of gamma to be gamma=0.2. Also taking other values of gamma to be 0.4 - 1.0 (that is, gamma ranges between 0.2 - 1.0)
(4) I want a 2D Contour Plots
Thanks for your Concern and effort

@tomleslie Thanks for the detailed expanations and corrections of errors.
However, i still have some issues regarding the matrix  results plots of the parameters. I tried writing a code but it wasnt running, check
sim.mw

@mmcdara 

Thank you for the detailed explanation. Please can you suggest a good textbook with theoretical and simulation (Maple, Matlab etc.) techniques of data?
Once again, thanks very much @mmcdara  @Carl Love  @tomleslie

@mmcdara Thank you for the detailed explanation. As you've rightly said (COVID 19 cummulative cases of a particular region).
(1) can a plot be made from the observation of your simulation  ''Observe that the residual sum of square is 1.5e8 instead of 8.3e7''
(2) can the model ''th := x -> a__1*(tanh((x-c__1)*b__1)+d__1) + a__2*(tanh((x-c__2)*b__2)+d__2)''
be used for data on daily active cases which aren't monotonically increasing given below,
or probably another better model.

data:=Vector([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 5, 0, 4, 10, 8, 10, 4, 7, 14, 5, 19, 22, 20, 4, 39, 10, 26, 4, 18, 6, 16, 22, 12, 17, 13, 5, 20, 30, 34, 36, 51, 49, 85, 38, 0, 208, 108, 114, 87, 91, 64, 195, 196, 204, 238, 218, 170, 244, 148, 195, 381, 386, 239, 248, 242, 146, 184, 191, 288, 171, 338, 216, 226, 276, 339, 245, 265, 313, 229, 276, 389, 182, 387, 553, 307, 416, 241, 347, 350, 328, 389, 253, 315, 663, 401, 681, 627, 501, 403, 573, 490, 587, 745, 667, 661, 436, 657, 452, 469, 594, 684, 779, 490, 566, 561, 790, 626, 454, 603, 544, 575, 503, 460, 499, 575, 664, 571, 595, 463, 643, 595, 600, 653, 556, 562, 576, 543, 604, 591, 438, 555, 648, 624, 404, 481, 462, 386, 304, 288, 304, 457, 354, 443, 453, 437, 290, 423, 453, 373, 329, 325, 298, 417, 410, 593, 476, 340, 601, 322, 321, 252, 221, 296, 270, 250, 138, 143, 239, 216, 124, 156, 162, 100, 155, 162, 100, 155, 296, 176, 197, 188, 160, 79, 132, 90, 126, 131, 221, 189, 97, 195, 176, 111, 125, 213, 136, 126, 136, 187, 201, 153, 126, 160, 58, 120, 118, 155, 103, 151, 111, 163, 164, 225, 179, 148, 212, 113, 133, 118, 72, 37, 138, 77, 48, 62, 119, 113, 147, 150, 170, 162, 111, 72, 137, 155, 180, 223, 59, 300, 94, 152, 180, 212, 156, 112, 152, 157, 152, 157, 152, 236, 146, 143, 246, 155, 56, 168, 198, 169, 246, 110, 82, 145, 281, 122, 343, 324, 310, 318, 390, 550, 474, 675, 796, 617, 418, 199, 758, 930, 1145, 806, 920, 501, 356, 999, 1133, 1041, 784, 829, 838, 397]):

@tomleslie thanks for your effort, but i observe that the behavior of the model curve drops to negative between 0 - 50 in the x axis. what could be the effect. Could this be true for a positive (increasing population)?

@tomleslie Thannks very much

@mmcdara yes the analysis of the two graphs

@mmcdara 
Yes the graph of @Carl Love and the histogram-scatterplot diagram you plotted

@mmcdara 

Once again, thanks for your positive effort towards this work.
My question is how do i analyze this graph analytically, especially when it declines and later peaks high reaching 0.8 value?
The analysis of the grahical behavior as regards the transition

@mmcdara 
Thanks, it worked perfectly well

@Carl Love 
Pls i have problems running the code on my PC with my MAPLE version. It gave errors
 

P:= <0.6199, 0.1450, 0.0636, 0.1549, 0.0166;
     0.6550, 0.0002, 0.0870, 0.1827, 0.0751;
     0.2990, 0.1294, 0.0010, 0.4925, 0.0781;  
     0.2773, 0.7184, 0.0043, 0,      0;
     0.0009, 0.6229, 0.3762, 0,      0
>:

V:= [S, I__1, I__2, I__3, R]:

n:= nops(V):

GT:= GraphTheory:  LA:= LinearAlgebra:

MC:= GT:-Graph(
    V,
    {seq(seq([[V[i],V[j]], P[i,j]], i= 1..n), j= 1..n)}
);
    

Error, (in GraphTheory:-Graph) invalid edge/arc: [[I__1, I__1], 0.2e-3]

 

GT:-DrawGraph(MC);

Error, invalid input: GraphTheory:-DrawGraph expects its 1st argument, H, to be of type {GRAPHLN, list(GRAPHLN), set(GRAPHLN)}, but received MC

 

Find long-term probability of being in each state:

V =~ LA:-LinearSolve(
    <P-Matrix(n, shape= identity) | <seq(1, 1..n)>>^+,
    <seq(0, 1..n), 1>
);

Error, invalid input: seq received 1 .. n, which is not valid for its 2nd argument, i

 

 


 

Download Markov_chain.mw

@mmcdara
Thank you very much for the detailed analysis. However, i have problems running the codes on my PC using. The codes were giving errors. I'm not sure if my Maple version supports your code but i attached it.

 

restart:

with(Statistics):

P:= <0.6199, 0.1450, 0.0636, 0.1549, 0.0166;

     0.6550, 0.0002, 0.0870, 0.1827, 0.0751;

     0.2990, 0.1294, 0.0010, 0.4925, 0.0781;  

     0.2773, 0.7184, 0.0043, 0,      0;

     0.0009, 0.6229, 0.3762, 0,      0

>;

 

P := Matrix(5, 5, {(1, 1) = .6199, (1, 2) = .1450, (1, 3) = 0.636e-1, (1, 4) = .1549, (1, 5) = 0.166e-1, (2, 1) = .6550, (2, 2) = 0.2e-3, (2, 3) = 0.870e-1, (2, 4) = .1827, (2, 5) = 0.751e-1, (3, 1) = .2990, (3, 2) = .1294, (3, 3) = 0.10e-2, (3, 4) = .4925, (3, 5) = 0.781e-1, (4, 1) = .2773, (4, 2) = .7184, (4, 3) = 0.43e-2, (4, 4) = 0, (4, 5) = 0, (5, 1) = 0.9e-3, (5, 2) = .6229, (5, 3) = .3762, (5, 4) = 0, (5, 5) = 0})

(1)

# Generate REP=100 random perturbations of the stochastic matrix P.
# The perturbations are stochastic matrices too (Q[1], ...Q[100]).
#
# The idea is to generate random perturbations of each row such that the sum of their elements still equal 1.
# This can be done using Dirichlet distributions with ad hoc parameters.
# For the sake of simplicity each parameter is proportional to p[i, j] (p[i,j]*100).
#
# Remark : The Gamma Distribution is defined for strictly positivee parameters.
# Then lines 4 and 5 must be treated separately

alpha := [1.$5]: # "Equal" perturbations
REP   := 100:

Q := NULL:

for r from 1 to REP do
  X := NULL:
  for i from 1 to 3 do
    alpha := [entries(P[i], nolist)*100]:
    G  := seq(Sample(GammaDistribution(1, alpha[i]), 1)[1], i=1..5):
    GG := add(G):
    X  := X, convert([G/~GG], Vector[row]);
  end do:
  for i from 4 to 5 do
    alpha := [entries(P[i, 1..3], nolist)*100]:
    G  := seq(Sample(GammaDistribution(1, alpha[i]), 1)[1], i=1..3), 0$2:
    GG := add(G):
    X  := X, convert([G/~GG], Vector[row]);
  end do:
  Q := Q, <X>
end do:

Error, invalid input: add expects 2 arguments, but received 1

 

# Example
# Compute the Mean of the stochastic matrices

MeanStochasticMatrix := Matrix(5, 5, (i, j) -> Mean([seq(Q[k][i, j], k=1..REP)]));
# Verify the mean of stochastic perturbations is itself a stochastic matrix
% . Vector(5, 1)

Error, (in Matrix) invalid subscript selector

 

Warning, inserted missing semicolon at end of statement

 

Vector(5, {(1) = 74206.7589871089, (2) = 74206.7589871089, (3) = 74206.7589871089, (4) = 74206.7589871089, (5) = 74206.7589871089})

(2)

# Standard deviation of  stochastic matrices

SdevMatrix := Matrix(5, 5, (i, j) -> StandardDeviation([seq(Q[k][i, j], k=1..REP)]));
 

Error, (in Matrix) invalid subscript selector

 

# 1% and 99% Quantiles

Q01Matrix := Matrix(5, 5, (i, j) -> sort([seq(Q[k][i, j], k=1..REP)])[2]);
Q99Matrix := Matrix(5, 5, (i, j) -> sort([seq(Q[k][i, j], k=1..REP)])[99]);

Error, (in Matrix) invalid subscript selector

 

Error, (in Matrix) invalid subscript selector

 

# Other choices of the parameters "alpha" of the Dirichlet distributions will lead to other quantiles.
# So it's up to you to define what these alpha are

``


 

Download Dirichlet_Markov_Chain.mw

 

@Carl Love Thanks for the wonderful job done and your unalloyed support to this work
I still have some problems;
(1) The matrix P values are estimates, How do i obtain the standard deviation and 99% confidence interval values for each estimated values in the matrix P
(2) I also need to plot a curve describing the first transition and the cummulative transtion of the matrix

1 2 3 4 5 6 Page 2 of 6