compare function values with constant
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ronald Singer
le 8 Août 2017
Réponse apportée : Torsten
le 8 Août 2017
Hello guys, i want to compare one constant value (LR2) with some function values of the chi-square function. If the function value and the constant value are equal, the loop should stop and should show me, for which value of my parameter the function has the same value as the constant.
I tried this:
LR2=0.0634
for alpha=0:0.001:0.999
if chi2inv(alpha,1)==LR2
x=alpha
break
end
end
x
I know that at one point, chi2inv is exactly 0.0634. I also tried:
LR2=0.0634
tolerance=1e-3
for alpha=0:0.001:0.999
if abs(chi2inv(alpha,1)-LR2)<tolerance
x=alpha
break
end
end
x
Hope yu understand the question. Thanks for the help.
Sincerly, Ronald Singer
0 commentaires
Réponse acceptée
Torsten
le 8 Août 2017
Why don't you simply calculate chi2cdf(LR2,1) ?
Best wishes
Torsten.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Hypothesis Tests dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!