Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Hello,
I was directed here from another forum to repost this request, which I will elaborate a bit more on. I am a high school science teacher and would like to have the ability to perform a linear regression on the TI-83 or 84 in which the y-intercept is forced to be 0 (in other words, 0,0 must be in the solution). This is for graphing data, such as mass vs. volume, in which the dependent variable must be 0 when the independent variable is 0. Graphing manually I can force this, and using Excel, there is an option to set the y-intercept to 0, and I want to emulate that on the 83 or 84.

Thanks,
Lou
I've never seen a TI-83/84 series calculator set up to do this with the built in functions, however I think it would be possible to write a program to approximate this for you to within some number of iterations rather easily. I could give it a shot if you liked.
Elf,
I had been hoping that there was a hidden option in the built-in regression, but if not, then a program will have to do. What is the algorithm that forces the y-intercept to 0? I'm familiar with the standard least-squares regression, but I'm not sure how my request would be implemented.

Lou
Hey Lou! Welcome to Cemetech; it's always great to have people from both sides of the educational system here, students and instructor alike. In my experience and experimentation with graphing calculators over the past twelve years or so, I don't know of any way to do this. It would be easy to write a program that should approximate what you're looking for. It would assume that your X coordinates are in L1 and your Y coordinates are L2, where corresponding elements of the two lists are the coordinates of the same point (ie, (L1(2), L2(2)) is a point). You'd just need to assume a Y intercept of 0 (ie, a fit line Y=MX) and solve for M.
loucasa wrote:
Elf,
I had been hoping that there was a hidden option in the built-in regression, but if not, then a program will have to do. What is the algorithm that forces the y-intercept to 0? I'm familiar with the standard least-squares regression, but I'm not sure how my request would be implemented.

Lou


My initial thought was an iterative approximation of the slope, given a starting range of the maximum and minimum slope it must fall between.

However, it turns out that you can also use Y1 = (sum(L1L2)/sum(L1L1))X if your X data is in L1 and your Y data is in L2. I tested this formula against LINEST with allow_const=false in OpenOffice and the two agreed.
Yup, that looked good to me too, I just came up with something along those lines. Will that work for you, Lou, or do you need a program to generate and graph that?
Kerm, I think it might be a bit better to make him a little program, if nothing else, then just to store that into a function, then automatically display that.

And, nice to see you made it here in one piece Lou.
My programming is a bit rusty these days, so a little push would be appreciated.

Lou
MufinMcFlufin wrote:
Kerm, I think it might be a bit better to make him a little program, if nothing else, then just to store that into a function, then automatically display that.

And, nice to see you made it here in one piece Lou.
Mufin, Lou, then here you go. Some notes, {L1} and {L2} are [2nd][1] and [2nd][2] respectively, {box} is in [2nd][Y1][left][1] when you're in the program editor, and {-} is the negation key, under 3. You can use SourceCoder 2.5 to turn this into a .8xp.


Code:
PROGRAM:ORGNLINR
:Prompt {L1},{L2}
:AxesOn
:{-}1+min({0,min({L1}->Xmin
:1+max({L1}->Xmax
:{-}1+min({0,min({L2}->Ymin
:1+max({L2}->Ymax
:Plot1(Scatter,L1,L2,{box}
:"X(sum({L1}{L2})/sum({L1}{L1}->{Y1}
:DispGraph
:Pause
I wonder if you could do augment({0},L1→L1:augment({0},L2→L2 and then set up a freqlist with 1+E99seq(X=1,X,1,dim(L1→L3 before running LinReg(ax+b) L1,L2,L3.
Weregoose wrote:
I wonder if you could do augment({0},L1→L1:augment({0},L2→L2 and then set up a freqlist with seq(1+E99(X=1),X,1,dim(L1→L3 before running LinReg(ax+b) L1,L2,L3.
Gaming the frequency list, that's not a bad idea! I bet that would work too, if a bit hacky.
Kerm,
Thanks, that will work great to plot the data; is there any way to display the slope before displaying the graph?

Lou
loucasa wrote:
Kerm,
Thanks, that will work great to plot the data; is there any way to display the slope before displaying the graph?

Lou
Sure thing; would you prefer displayed beforehand or overlaid on top? This will do the latter:


Code:
PROGRAM:ORGNLINR
:Prompt {L1},{L2}
:AxesOn
:{-}1+min({0,min({L1}->Xmin
:1+max({L1}->Xmax
:{-}1+min({0,min({L2}->Ymin
:1+max({L2}->Ymax
:Plot1(Scatter,L1,L2,{box}
:"X(sum({L1}{L2})/sum({L1}{L1}->{Y1}
:DispGraph
:Text(56,1,"Y=",(sum({L1}{L2})/sum({L1}{L1})),"X
:Pause
To display the slope on the homescreen beforehand, make a new line above :DispGraph with [2nd] [DEL] [ENTER].

Now put the cursor on the blank line, type [PRGM] [8] to paste Pause, then write the expression at the end of the same line:

:Pause sum(L1L2)/sum(L1
:DispGraph

Another method to get the same slope number: 2-Var Stats :Σxy/Σx

Σxy = [STAT] [5] [►] [5]
Σx = [STAT] [5] [►] [2]
Hi there, sorry to use this ancient thread, I have the same problem, but I use a Ti-84 plus CE. I tried copying the code, but that led to a syntax error. I fixed the issue of the colons appearing twice for me, but it still doesn't work, I assume because the calculators program differently. Could someone please update the code for me? I don't know how to do any of this Smile
bubbleumpaul wrote:
Hi there, sorry to use this ancient thread, I have the same problem, but I use a Ti-84 plus CE. I tried copying the code, but that led to a syntax error. I fixed the issue of the colons appearing twice for me, but it still doesn't work, I assume because the calculators program differently. Could someone please update the code for me? I don't know how to do any of this Smile


This code is not properly formatted for TI-Connect CE. Try using this:


Code:
Prompt L₁,L₂
AxesOn
1+min({0,min(L₁→Xmin
1+max(L₁→Xmax
1+min({0,min(L₂→Ymin
1+max(L₁→Ymax
Plot1(Scatter,L₁,L₂,▫
"X(sum(L₁L₂)/sum(L₁→Y₁
DispGraph
Text(56,1,"Y=",(sum(L₁L₂)/sum(L₁)),"X
Pause
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement