Trouble: regression with pseudo-categorical 3rd variable

CODAP Forums CODAP Help Forum Trouble: regression with pseudo-categorical 3rd variable

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6560 Score: 0
    Andrew Ross
    Participant

    I’m having trouble with doing different regression lines according to a categorical 3rd (“middle-of’-the-graph”) variable, when that variable was originally numeric.

    I’m using this file, https://codap.concord.org/app/static/dg/en/cert/index.html#shared=https://cfm-shared.concord.org/UawUu8atSM7s5TuTF7eS/file.json

    I make a graph with x=wnh_pct and y=C.A.P. , then drag CompanyNumber to the middle of the graph. Then I click the word “CompanyNumber” in the lower-left of the figure (the legend) to get a menu, and select “Treat as Categorical”. Then I use the ruler icon and ask to add a least-squares line (which really means 3 lines, since CompanyNumber has 3 possible values). No trendlines appear on the graph, and 3 copies of a yellow box appear, saying:

    C.A.P.=
    r^2=

    [That is, there’s nothing after the equals-signs.]

    The same thing happens if I add the regression line before dragging CompanyNumber to the middle of the graph.

    I had tried posting to the Forum about this a few months ago, but I guess something went wrong in the process of trying to post. Back then, it did make a difference whether the 3rd variable was added before versus after asking for regression line(s), but it just led to 2 different ways of incorrect results. I can’t remember what the other version was, though.

    I know that I could have students create a column that does the translation from numeric CompanyNumber to something like CompanyLetter that CODAP would then automatically treat as categorical. But I want part of the exercise to include the switch from numeric to categorical without having to type in a complicated formula to turn the numbers into categories.

    • This topic was modified 2 years, 9 months ago by admin.
    • This topic was modified 2 years, 9 months ago by admin.
    • This topic was modified 2 years, 9 months ago by admin.
    #6592
    Bill Finzer
    Keymaster

    Hi Andrew,

    You’ve definitely uncovered a bug. Switching the legend attribute to categorical should produce the three lines. We’ll fix it!

    Meanwhile, here’s another workaround that might work for your students:

    1. Drag Company Number all the way to the left in the case table so that you get a new table with just three rows.
    2. Edit the three numbers so they are no longer pure numbers. (In the screen shot you’ll see that I just added the letter ‘A’ after each.)
    3. Now, as shown in the screenshot, the desired three lines appear.

    Hope this helps. And sorry for the trouble posting.

    Bill

    • This reply was modified 2 years, 9 months ago by Bill Finzer.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.