I have this code:
ChiSq_Variance_test=function(critical_Chi_score,critical_Chi_square){
alfa=0.01;
n=120;
s_square=169;
sigma_square=225;
critical_Chi_square=qchisq(alfa,s-1);
Chi_square_score=(n-1)*s_square/sigma_square;
print(critical_Chi_square);
print(Chi_square_score);
}ChiSq_Variance_test(6)
and it gives me this error:
Error: unexpected symbol in:"enter code here }ChiSq_Variance_test"
If you know a solution please help me! Thank for your time!
In R, in order to place two instructions on the same line, you should use semicolons like this: n=120 ; b= 120
. However, at the end of a line, you do not need semicolons
Your code should be like this:
ChiSq_Variance_test=function(critical_Chi_score,critical_Chi_square){
alfa=0.01
n=120
s_square=169
sigma_square=225
critical_Chi_square=qchisq(alfa,s-1)
Chi_square_score=(n-1)*s_square/sigma_square
print(critical_Chi_square)
print(Chi_square_score)
}
ChiSq_Variance_test(6)
or like this:
ChiSq_Variance_test=function(critical_Chi_score,critical_Chi_square){
alfa=0.01
n=120
s_square=169
sigma_square=225
critical_Chi_square=qchisq(alfa,s-1)
Chi_square_score=(n-1)*s_square/sigma_square
print(critical_Chi_square)
print(Chi_square_score)
} ; ChiSq_Variance_test(6)