Define the function test_statistic which takes in an expected proportion and an actual proportion, and returns the value of the second test statistic in the previous question. Assume that you are taking in proportions, but you want to return your answer as a percentage.

Respuesta :

Answer:

Previous question is not given.

I'll assume that the test statistic is calculated as thus;

(Expected Proportion - Actual Proportion) * 100

The function goes as follows.

#function is written in Python Programming Language.

def test _statistic(expected, actual)

return 100 * abs(expected - actual)

The first line of the program defines the function test_statistic along with two parameters.

The parameters are expected and actual.

expected represents expected proportion whole actual represents actual proportion

The second line calculates the value of the test_statistic.

First the absolute value is calculated to remove all negative signs. Since the results is needed in percentage, it's then multiplied by 100.