필터 지우기
필터 지우기

Does normpdf() take z values?

조회 수: 3 (최근 30일)
Shawn Simon
Shawn Simon 2016년 5월 3일
답변: Star Strider 2016년 5월 3일
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.

채택된 답변

Star Strider
Star Strider 2016년 5월 3일
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):
  • Y = normpdf(X) uses the standard normal distribution (mu = 0, sigma = 1).
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개)

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by