CODAP › Forums › CODAP Help Forum › Trouble: regression with pseudocategorical 3rd variable
 This topic has 1 reply, 2 voices, and was last updated 2 weeks, 2 days ago by Bill Finzer.

AuthorPosts

Andrew RossParticipant
I’m having trouble with doing different regression lines according to a categorical 3rd (“middleof’thegraph”) 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://cfmshared.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 lowerleft 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 leastsquares 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 equalssigns.]
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.
July 16, 2021 at 3:39 pm #6592Bill FinzerKeymasterHi 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:
 DragĀ Company Number all the way to the left in the case table so that you get a new table with just three rows.
 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.)
 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 weeks, 2 days ago by Bill Finzer.
Attachments:

AuthorPosts
 You must be logged in to reply to this topic.