- Y = normpdf(X) uses the standard normal distribution (mu = 0, sigma = 1).
Does normpdf() take z values?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shawn Simon
el 3 de Mayo de 2016
Respondida: Star Strider
el 3 de Mayo de 2016
I am asking this because I have created a program in which a user inputs a some data, then inputs either a z value or an x value and the output is the probability . If the elements within the input data is less than 30, then the program uses the std() function for standard deviation. However, if the data exceeds 30 elements, then the program finds the population standard deviation, and uses that for sigma.
If the user inputs an x value, this is easy in that I can just use the given x, mu and respective sigma for the normpdf() calculation. However, if the user inputs a z value, I am not sure if I should use mu = 0 and sigma = 1 in normpdf(), or if I should change the z value to an x value, then use the respective mu and sigma values.
0 comentarios
Respuesta aceptada
Star Strider
el 3 de Mayo de 2016
The z-statistic normalises the data to have a mean of 0 and a standard deviation of 1, so using this syntax (from the documenation):
So here ‘X’ would be the z-statistic.
You will probably have to test for the number of inputs to your function (using nargin) and then have your function determine how to deal with the data it receives. For example if it receives only one input, it would interpret that as a z-statistic, if separate mu and sigma you would have to use other function syntax calls to normpdf.
So it seems normpdf can do everything you want. You just have to determine how to call it in your function.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Hypothesis Tests 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!