Using Drupal and Views Dataviz to teach statistics concepts

Generate live data charts using Views Dataviz

    I am a pretty big fan of using Views Dataviz to create clean, colorful charts from real-time data, and for my middle school outreach program, I discovered a way to not only teach about the design of experiments, but also leverage my Drupal website to show how measuring a simgle item is different from measuring a population.

 

How to do it

  1. If you are starting with a fresh Drupal site, you will want the needed dependencies for Views Dataviz (Chaos Tools, Views 7.x-3.x), and for core, be sure to enable Fields, Number, and maybe Contextual Links to help with editing. Entity/Automatic Entity Labels is also helful if you don't need to have students enter a title.
  2. Create a new Content Type with the same name as what you will be doing the experiment on. I did an experiment on apples from my apple tree, and we had both qualitative and quantiative observations to record, so in my case, I created two content types: Qualitative Apple and Quantitative Apple.
  3. For your content type, add a text field called "Category" so that you can compare categories. Note that Dataviz isn't doing well with scatter plots yet.
  4. Now, add a field for students to input their data. For my qualitative observations, I asked students to report how red their apple was, ranging from 0 (green) to 100 (fully red). Using Select Options, I was able to add a description also, i.e. "25% red: This apple is still mostly green"
  5. Next up, go to /admin/people/permissions and give anonymous users permission to create nodes of your content type. This way students can enter their data without having to log in to your site.
  6. Finally, set up a view with two page views within it. The first is going to be a table; this will let you see the data as you set everything up. You will need to turn on aggregation under the advanced options tab, and depending on your situation, you may want to COUNT responses, AVERAGE submitted data, or get the MAX and MIN values of data. You can report the same field multiple times, and choose different function for each one. Assuming you used "All displays" when making edits, everything should already be set up for the second page, and you just need to override the view type to make it a Dataviz instead of a table. If you are unfamiliar with using Dataviz, remember that the last field is the X axis, and all fields before it are Y axes.
  7. Now, create a few pieces of sample content and see what happens. Once you have everything looking good, try it with your students!

Dataviz example

 

As you can see here, we tried an experiment with apples picked on the sunny and shady side of a tree, also picked on different days. The results did not turn out as expected, but that was actually a good thing! We were planning to discuss experimental validity, and it turned out that the odd case of apples becoming less ripe with time was in fact a case of experimental error.

 

Potential issues

    The single biggest issue I had when using this with actual students, was getting them to enter data into the computer. We only had two laptops to work with, so I learned mid-calls that instead of giving students a URL, I needed to create a bookmark and add it to the bookmarks toolbar (Firefox). This way, it was just a button students could push. Further, the students had difficulty understanding that they needed to do something beyond filling out the worksheet, even after they read the instructions out loud.

 

How else could this be used?

    Views Dataviz can allow you and your students to look at class-wide data gathering, and with Fields, you can also create a wide variety of custom data types for students to use. In my particular case I used this method to have students compare individual results with a class average result, but in addition, you could also use this to ask students questions, and get a distribution of answers in a non-paper format. Further, it's also possible for students to make entries over time, and thereby create a time-based chart of data. In a later post, I will go into further detail about how to do this with Dataviz and Rules.