restart:with(Statistics):randomize():
N := 100:
S := Sample(Normal(0, 1), N):infolevel[Statistics] := 1:
# 0 parameter to fit from the sample S CORRECT ANSWER
ChiSquareSuitableModelTest(S, Normal(0, 1), level = 0.5e-1):
print():
# 2 parameters (mean and standard deviation) to fit from the sample S INCORRECT ANSWER
ChiSquareSuitableModelTest(S, Normal(a, b), level = 0.5e-1, fittedparameters = 2):
print():
# verification
m := Mean(S);
s := StandardDeviation(S);
t := sqrt(add((S-~m)^~2) / (N-1));
print():
error "the estimation of the StandardDeviation ChiSquareSuitableModelTest is not correct";
print():
# ONLY 1 parameter (mean OR standard deviation ?) to fit from the sample S STUPID ANSWER
#
# A stupid answer: the parameter to fit not being declared, the procedure should return
# an error of the type "don(t know what is the paramater tio fit"
ChiSquareSuitableModelTest(S, Normal(a, b), level = 0.5e-1, fittedparameters = 1):
print():
WARNING("ChiSquareSuitableModelTest should return it can't fit a single parameter");
print():
ChiSquareSuitableModelTest(S, Normal(a, 1), level = 0.5e-1, fittedparameters = 1): #CORRECT ANSWER
print():
# verification
m := Mean(S);
print():
ChiSquareSuitableModelTest(S, Normal(0, b), level = 0.5e-1, fittedparameters = 1): #CORRECT ANSWER
print():
# verification
s := sqrt((add(S^~2) - 0^2) / N);
print():