regression on multiple attributes at once

Tags:
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15726 Score: 0
    goldenj
    Participant

    Multiple instances of timed data, I’d love to be able to do regression on all the data for a single activity. Students are choosing an activity, then collecting counts at 10, 20, 30, 40 and 60 seconds.

    Data file

    With the transposed data, I can use the multiple attributes on the y-axis to see all the signatures data together, but can’t figure out how to get a regression on all the data together. The only workaround I can think of is to find the average for each time category (10 sec, 20 sec…) and do regression on that.

    With the original data, I can’t figure out a way to treat the attributes as numerical data to get a time vs count graph.

    Any ideas or workarounds? Also okay to tell me what I’m doing just doesn’t make sense! Thanks for any help.

    #15731
    Dan Damelin
    Keymaster

    Can you clarify what this is a dataset of? What does a single row represent? Why are there multiple instances of the same thing in column 1, for example, “typing” is there several times? What does each numerical column represent?

    It might be helpful if you could provide a narrative description of how this data was generated.

    #15754
    Andrew Ross
    Participant

    Unfortunately, I can’t think of a way to do the analysis with the current data format.

    I am guessing that another way to express the data is something like this:

    <style type=”text/css”>td {border: 1px solid #cccccc;}br {mso-data-placement:same-cell;}</style>
    <table dir=”ltr” style=”table-layout: fixed; font-size: 10pt; font-family: Arial; width: 0px; border-collapse: collapse; border: none;” border=”1″ cellspacing=”0″ cellpadding=”0″ data-sheets-root=”1″ data-sheets-baot=”1″><colgroup><col width=”100″ /><col width=”100″ /><col width=”100″ /><col width=”100″ /></colgroup>
    <tbody>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>ParticipantName</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>Activity</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>Duration</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>HowManyTimes</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonA</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>signatures</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>10</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>2</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonA</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>signatures</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>20</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>4</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonA</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>signatures</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>30</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>6</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonA</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>signatures</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>40</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>8</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonA</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>signatures</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>50</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”></td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonA</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>signatures</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>60</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>12</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonB</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>typing</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>10</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>12</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonB</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>typing</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>20</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>22</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonB</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>typing</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>30</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>30</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonB</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>typing</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>40</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>39</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonB</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>typing</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>50</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”></td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonB</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>typing</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>60</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>56</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonC</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>texting</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>10</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>12</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonC</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>texting</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>20</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>22</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonC</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>texting</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>30</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>30</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonC</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>texting</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>40</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>39</td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonC</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>texting</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>50</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”></td>
    </tr>
    <tr style=”height: 21px;”>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>PersonC</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom;”>texting</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>60</td>
    <td style=”overflow: hidden; padding: 2px 3px 2px 3px; vertical-align: bottom; text-align: right;”>56</td>
    </tr>
    </tbody>
    </table>
    etc.; though it’s possible that PersonA could have data from more than one activity.

     

    I transformed your data table into this new format in this Google Sheet; look in row 26 etc. There might have been a better (more elegant) way to do it, which I look forward to learning about from anyone who knows it!

    If that’s right and it’s formatted that way, then you could make a scatterplot with x=duration, y=count, with the legend variable (the variable that you “drop in the middle of the graph” to color the dots by) being the activity. Then if you add a trendline, you should get one trendline for each activity.

    Visually, that might be a bit much. And it’s not clear which trendline is for which activity. You could make another graph with x=activity (and no y axis) to show dots for each activity, then select the dots for one activity, then on the scatterplot use the “View” icon and click “Hide Unselected Cases”. You could repeat (having to make a separate graph each time, I think) for the other activities.

    To get the trendline slope and intercept etc. in a table, you can make columns in CODAP like this (feel free to use better column names; ignore whatever you don’t want)

    column name: corr ; formula: correlation(Duration,HowManyTimes)

    column name: linSlope ; formula: linRegrSlope(Duration,HowManyTimes)

    column name: linIntercept ; formula: linRegrIntercept(Duration,HowManyTimes)

    column name: DurationCount ; formula: count(Duration)

    column name: resultCount ; formula: count(HowManyTimes)

    At first all of those will have the same values, aggregating across all the activities in the table. But if you drag the “activity” column to the far left (so a yellow box appears that says “drop attribute to create new collection”), then the results will be different for the rows with different activities. You can also drag corr, linSlope, etc. all the way to the left as well to get a little table that summarizes by activity.

    I tried it all in this codap file.

    The data formatting issue reminds of what people in the R software universe call “tidy” data. The data that you have is in “wider” form, while the format I’m suggesting is “longer”; see https://tidyr.tidyverse.org/articles/pivot.html .

     

    #15945
    goldenj
    Participant

    The data was collected by a class performing different physical tasks over a minute.

    Andrew: this was super helpful. Not sure how to duplicate everything you did, but it is the direction I want to go, and that format of data entry had not occurred to me at all.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.