how to test a hypothesis with t-test or p value
Mostra commenti meno recenti
Hello I am testing the null hypothesis mu=3.4 against mu>3.4, for a sample of size 9. I want to test this with both t-distribution table and p-value but its giving me NaN instead of 0 or 1.this is the code im using :
mu = 3.4; % Population mean
sample=[3.4,3.6,3.8, 3.3,3.4,3.5,3.7,3.6,3.7]
n = numel(sample)
xobs = mean(sample) % Sample mean
s = std(sample) % Sample standard deviation
t = (xobs - mu)/(s/sqrt(n))
p = 1-tcdf(t,n-1)
[h,ptest] = ttest(xobs,mu,0.05,'right')
Thank you
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Hypothesis Tests in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!