testing hypothesis that p=alpha at 5% & 1%

3 views (last 30 days)
Jardine Shi
Jardine Shi on 19 Nov 2020
Answered: Rohit Pappu on 23 Nov 2020
%does this mean that I just need to change the value of p ? to either 5% or 1% ?
p=0.05
n=9
% create a 1x(n+1) vector y containing the probabilities with which a
% Bin(n,p) random variable is equal to the values 0,1,2,...,n
x=0:n;
y=binopdf(x,n,p);
% create a 1x(n+1) vector z containing the values taken by the standardized
% sample mean when the mean is equal to the values 0,1/n,2/n,...,1
z = (x/n-p)/sqrt(p*(1-p)/n);
%plotting the PMF of sample mean
bar(z,y);
xlabel('Observation')
ylabel('Probability')

Answers (1)

Rohit Pappu
Rohit Pappu on 23 Nov 2020
To test the hypothesis at various confidence levels, Lilliefors test can be used .
Example
[h,p] = lillietest(x, 'Alpha', 0.05) %% Alpha is a name-value pair argument which takes a value between 0 and 1
Additional documentation about Lilliefors test can be found here

Tags

Community Treasure Hunt

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

Start Hunting!