i want to compute a cdf for t distribution

2 visualizaciones (últimos 30 días)
elham kreem
elham kreem el 1 de Mzo. de 2018
Comentada: Star Strider el 1 de Mzo. de 2018
i want to compute a cdf for t distribution from a to b , i wrote this code but it didn't run
for i=1:50
fa(i)=cdf('t', 'mu' =-2, 'sigma'= 4 , 'nu'= 6 , astar(i))
fb(i)=cdf('t', 'mu' =-2, 'sigma'= 4 , 'nu'= 6, bstar(i))
end
astar and bstar are points of the integral
sorry for a weak my language

Respuesta aceptada

Star Strider
Star Strider el 1 de Mzo. de 2018
You are not calling cdf correctly. Also the functions are vectorised, so you do not need the loops.
Try this:
fa = cdf('T', nu, astar);
fb = cdf('T', nu, bstar);
It is probably best to use the tcdf (link) function instead, since cdf appears to be deprecated in a future release of MATLAB.
  2 comentarios
elham kreem
elham kreem el 1 de Mzo. de 2018
thanks for you , your answer for stander dist. and i apply it as : fa = cdf('T', 'nu', 6, astar) the result is : fa =
1.0000 1.0000
but if i want cdf for non stander distribution for t, I apply this code
fa=cdf('T', 'mu' ,-2, 'sigma', 4 , 'nu', 6 , astar)
but the result is :
fa =
NaN NaN
Star Strider
Star Strider el 1 de Mzo. de 2018
My pleasure.
In the t-distribution, ‘nu’ is calculated as described in Compute Student's t cdf (link). You use the mean (‘mu’), standard deviation (‘sigma’) and number of observations (‘n’) to calculate it. There is only one parameter.
If you use my code, you get the correct result:
astar = linspace(1E-5, 2, 5);
nu = 6;
fa = cdf('T', nu, astar)
I again urge you to use the tcdf function (that I linked to in my Answer), instead of cdf.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by