15 Goodness of Fit Test

Instructional video icon

15.1 Using a dataset

Instruction for goodness of fit test using a dataset

  1. Use a dataset in your Rguroo account or recreate the example below by importing the Starburst dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the dataset. Screenshot of the first 5 rows of the Starburst dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Use the Analysis dropdown menu and choose Goodness of Fit (see Figure 15.1).

  2. Select a Dataset, the categorical variable from the Factor dropdown, and if your data is in tabular form where frequencies are given in a separate column, select your Frequency variable. The observed counts appear in the column labeled Obs. Count.

  3. In the column labeled Null Probability, type in the null hypothesis probability corresponding to each level of the factor variable. A few notes:

  • If you leave the Null Probability column blank, by default, equal probabilities are assumed for all levels.
  • You can use fractions or decimal values for the null probabilities. Moreover, if the null probabilities don’t add up to one, they will be normalized internally to add to one.
  1. Under the Test of Hypothesis section, check one or both of the Chi-Square or Simulation checkboxes (with graph, if desired). Also, set the Significance Level.

  2. Click the Preview icon preview icon to view the result.

Goodness of fit test dialog

Figure 15.1: Goodness of fit test dialog.

15.2 Entering data manually

Instruction for goodness of fit test by entering data manually

  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Use the Analysis dropdown menu and choose Goodness of Fit (see Figure 15.2).

  2. In the Factor textbox, enter a label for your categorical variable.

  3. Click the green plus button Green plus button to add a category; a row appears. Type in a label and its corresponding count on the columns labeled Label, and Obs. Count. Repeat this for each level of the categorical variable.

  4. In the column labeled Null Probability, type in the null hypothesis probability corresponding to each level of the factor variable. A few notes:

  • If you leave the Null Probability column blank, by default, equal probabilities are assumed for all levels.
  • You can use fractions or decimal values for the null probabilities. Moreover, if the null probabilities don’t add up to one, they will be normalized internally to add to one.
  1. Under the Test of Hypothesis section, check one or both of the Chi-Square or Simulation checkboxes (with graph, if desired). Also, set the Significance Level.

  2. Click the Preview icon preview icon to view the result.

Rguroo Dialog
Goodness of fit test dialog

Figure 15.2: Goodness of fit test dialog