平均のサンプリング分布の結果を返す小さなプログラムを作成することで、データ統計の作業を少し楽にできると思いました (標準誤差付き)。この部分は正常に実行されますが、ここで見つけた数式を使用して z スコアを返そうとすると、 が返されます-1#IND
。その式の私の解釈は次のとおりです。
((1 / (sqrt(2 * pi) * stdev)) * pow(e, (normalpow))
どこ
double normalpow = -0.5 * ((mean - popmean) * (mean-popmean) / stdev)
私はもう少し調査を行い、それが何にでも(mean - popmean) * (mean - popmean)
評価されていることを発見しました。に評価される0
というこの問題をどのように回避できますか。normalpow
0
#include <iostream>
#include <string>
#include <sstream>
#include <math.h>
using namespace std;
double number ;
double mean ;
double popmean ;
double stdev ;
double square = 2;
double e = 2.71828182845904523536;
double pi = 3.14159265358979323846;
double normalpow = -0.5*((mean-popmean)*(mean-popmean)/stdev);
int main ()
{
string continuer ;
do
{
cout << "Enter Sample Mean: " << endl;
cin >> mean;
cout << "Enter Population Mean: " << endl;
cin >> popmean;
cout << "Enter Standard Deviation: " << endl;
cin >> stdev;
cout << "Enter Sample Size: " << endl;
cin >> number;
if (stdev == 0)
cout << ((mean-popmean)/(number))<< endl;
else
{
cout << ((mean-popmean)/((stdev)/(sqrt(number))))<< endl;
cout << ((1/(sqrt(2*pi)*stdev))*pow(e, (normalpow)))<< endl;
}
cout << "If you want to continue, Press Y" << endl ;
cin >> continuer;
} while (continuer == "Y" || continuer == "y") ;
return 0;
}