This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
thornahawk
μολών λαβέ


Active Member


Joined: 27 Mar 2005
Posts: 569

Posted: 18 Feb 2010 09:20:48 pm    Post subject:

Here's a short program for generating the coefficients a and b of a regression line a+bx corresponding to given data (x and y coordinates in L₁ and L₂, respectively) and passing through a fixed point (X,Y):


Code:
PROGRAM:LINFIX
dim(L₁)→N
If N≠dim(L₂)
Stop
sum((L₁-X)(L₂-Y))/sum((L₁-X)²)→B
Y-XB→A
L₂-(A+BL₁)→RESID
√(1-sum(∟RESID²)/variance(L₂)/(N-1))→R
Disp "{a,b,r}"
{A,B,R}


Apart from the coefficients, the Pearson correlation coefficient r as well as the residuals ∟RESID are generated; you can remove the corresponding lines if you don't need them.

thornahawk
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement