Sinusoidal Regression

1,724 views
Skip to first unread message

Microgees

unread,
May 26, 2011, 7:29:33 AM5/26/11
to tinspire
Recently I did a maths test and it required me to use the sinusoidal
regression function from the List&Spreadsheet application to find the
sine graph function. Here are the four points that were given:
(4.5,0.82),(11.2,0.08),(17.4,0.92),(23.6,0.39). And it came up with
the Singular Matrix Error. From the education technology site of
Texas Instruments, it says "A minimum of two points from two cycles of
the sine wave are needed to generate an answer," which isn't in this
case cause the four provided points seem to be within one cycle. All
my classmates could find the answer using their Casio Classpad 330. I
would like to know how can I do this question using a Ti nspire.

John Hanna

unread,
May 26, 2011, 9:49:15 AM5/26/11
to tins...@googlegroups.com

Try adding an initial period to the sinreg function. This works on the TI-84.

 

On the TI-Nspire, use 2pi as the optional period in the Sinreg dialog box. This produces the desired sine function for your data.

 

But... only 4 data points are not enough to determine that the data is sinusoidal (or any other function for that matter).

 

 

John Hanna

jeh...@optonline.net

www.johnhanna.us

T3 - Teachers Teaching with Technology

"A cowchip is paradise to a fly."

--

To post to this group, send email to tins...@googlegroups.com

To unsubscribe send email to tinspire+u...@googlegroups.com

For more options, visit this group at

http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB

The tns documents shared by group members are archived at

http://lafacroft.com/archive/nspire.php

image001.gif

Sean Bird

unread,
May 26, 2011, 10:01:24 AM5/26/11
to tins...@googlegroups.com
I guess that 'optional' period for the algorithm to start looking for a regression isn't so optional when you only have 4 data points.

Thanks John.
image001.gif

John Hanna

unread,
May 26, 2011, 11:55:29 AM5/26/11
to tins...@googlegroups.com

LogisticReg also fails unless the data is logistic enough.

 

John Hanna

jeh...@optonline.net

www.johnhanna.us

T3 - Teachers Teaching with Technology

"A cowchip is paradise to a fly."

 

--

image001.gif

Nelson Sousa

unread,
May 26, 2011, 12:32:45 PM5/26/11
to tins...@googlegroups.com

I remember one situation where a few points (5 or 6) were somewhat over an exponential curve and someone tried to do a logistic reg on a TI calculator (don't remember which one, but they all returned the same) and got a domain error. The problem was that a Casio calculator was in fact returning a valid logistic expression.

"Small" catch: the data points ranged from 1 to 10, perhaps, and the logistic curve that "best fits" the points went from 0 to 40k or something like that. 

Typically TI calculators are more demanding with the suitability of the regression, whereas Casio returns results as long as the algorithm doesn't blow up.

Cheers,
Nelson

PS: 4 points for a sinusoidal regression is waaaaaay too little! Don't try to get stuff from your data that just isn't there.
image001.gif

Al Coons

unread,
May 26, 2011, 1:07:25 PM5/26/11
to tins...@googlegroups.com
I have found some easier ways to do modeling/regression. At least they are much easier and more consistent for me as compared to the way that I was originally shown at TI Demonstrations. Maybe you already know this but I am going to keep posting basic ideas and questions on the assumption that there are many lurking relatively new Nspire users that would value these type of discussions.

------------------

Page 1: Lists & Spreadsheet
Enter data in two columns as we always do.

------------
Page 2: Data and Statistics

Instead of cursoring to add variables

MENU
2. Plot Properties
5. Add X Variable

MENU
2. Plot Properties
Add Y Variable

---------------
Instead of going to Page 1 and putting the information about the LSR model in the middle of the spreadsheet:

Page 3: Calculator

MENU
6. Statistics
2. Stat Results
Enter


Al
---------
Al Coons
Buckingham Browne and Nichols School
80 Gerry's Landing Road
Cambridge, MA
02138

617-800-2264 (w)
al_c...@bbns.org

AP Statistics Site: http://www.bbn-school.org/us/math/ap_stats

John Hanna

unread,
May 26, 2011, 8:50:18 PM5/26/11
to tins...@googlegroups.com

Here’s an example of Logistic Regression sensitivity.

 

The data is the number of infections of the Swine Flu a few years ago.

 

There are notes in the doc telling you what to do.

 

John Hanna

jeh...@optonline.net

www.johnhanna.us

T3 - Teachers Teaching with Technology

"A cowchip is paradise to a fly."

 

image001.gif
Swine Flu data.tns

John Losse

unread,
May 27, 2011, 3:41:07 PM5/27/11
to tins...@googlegroups.com, jeh...@optonline.net
Regarding John Hanna's remark that Logisitc regression sometimes fails if the data is not logistic enough , I am attaching a file in which the data appears quite logistic - probabilities that a room with n people has at least two with a common birthday.

Logistic regression succeeds with n = 2 . . . 40, but changing 40 to 50 (formulas for columns 1 and 2 in L&S) produces an "excessive iterations" error.

I am pretty sure this worked in Version 1.??? of the Teacher Software.  The TI-84 calculates a logistic regression for n=50, though it takes a couple of minutes.
BDay.tns

John Losse

unread,
May 27, 2011, 7:06:25 PM5/27/11
to tins...@googlegroups.com, jeh...@optonline.net
Regarding the "excessive iterations" error mentioned in my last post, I have just discovered that the "d not equal zero" form of logisitc regression allows you to specify the number of iterations. Using iterations = 64 gives a good regression to the birthday problem data.  It comes up with d= -.118 for data which lis between 0 and 1.  Not sure why the iterations option is missing in the d=0 regression if it is so critical.

John Hanna

unread,
May 27, 2011, 8:20:56 PM5/27/11
to tins...@googlegroups.com

Bday is not logistic.

 

John Hanna

jeh...@optonline.net

www.johnhanna.us

T3 - Teachers Teaching with Technology

"A cowchip is paradise to a fly."

 

John Losse

unread,
May 27, 2011, 8:45:03 PM5/27/11
to tins...@googlegroups.com
(Responding to John Hanna)

True.  My point is that it sure looks logistic - a logistic regression is plausible if you only saw the data and didn't know how it was generated.

As a later post mentioned, a d < > 0 regression produces a good logistic fit, as does the TI-84, so I'm thinking TI can make a d=0 regression work on the Nspire as well.

JL


John Hanna

unread,
May 28, 2011, 7:56:13 AM5/28/11
to tins...@googlegroups.com

(responding to everyone)

 

Re: Bday

 

Our (the tech ed community) infatuation with built-in regressions as a means for finding mathematical models is a source of frustration to me. While the Bday data looks logistic, doing a logistic regression points out that the regression result is not a good fit. An examination of the residuals displays a pattern, so some other rule is at work. The Statistician would do another regression on the residuals and then combine the two functions to get a ‘better’ fit, but this leads us down the path to ruin since our original assumption was wrong. We’re adding fuel to the fire of damnation, but its close enough for government work, eh?

 

The real model is already in the spreadsheet, where the probabilities are defined! Why pursue ugly mathematics when the real answer is so beautiful?

 

I also have another activity (“Choose a Model”) where the data is not what it appears to be. The underlying mathematical model is not on our list of available regressions and attempting one gives a residuals plot that contains a pattern (strikingly similar patterns at that!). A little digging is needed to uncover the mathematical treasure.

 

Apologies in advance ; )

John Hanna

jeh...@optonline.net

www.johnhanna.us

T3 - Teachers Teaching with Technology

"A cowchip is paradise to a fly."

 

From: tins...@googlegroups.com [mailto:tins...@googlegroups.com] On Behalf Of John Losse
Sent: Friday, May 27, 2011 8:45 PM
To: tins...@googlegroups.com
Subject: Re: [tinspire] Sinusoidal Regression

 

(Responding to John Hanna)

Nelson Sousa

unread,
May 28, 2011, 8:01:36 AM5/28/11
to tins...@googlegroups.com
I remember once some teacher suggested a quadratic regression over a
set of points of pressure vs. volume collected with a pressure sensor.

His argument: it was a very good fit. Indeed, if you have 7 or 8
points with some slight curvature a quadratic fit passes quite near
all the points. And r^2 was of about 0.97, which is pretty awesome.

Another suggested an exponential fit. r^2 was of about 0.98 in this case.

Sooooooo..... because it looks good is enough for us?

By the way, a power fit had r^2 of over 0.99 with b = -0.98 or -0.97.


Nelson

Andy Kemp

unread,
May 28, 2011, 8:24:41 AM5/28/11
to tins...@googlegroups.com
I went to an excellent talk by Jim Nakamoto at this year's T^3 conference where he talked about the Anscombe Data Sets...

If you haven't seen them they are an excellent example of why simple finding regression lines can completely miss the true underlying patters!


Cheers
Andy

John Losse

unread,
May 28, 2011, 10:28:18 AM5/28/11
to tins...@googlegroups.com
These are all valid points, and illuminating.  My original post on this subject was to add to the examples in this thread of situations where the software simply failed to produce a result - a regression line of a certain type.

The Anscombe Data Set example emphasizes the importance of looking at the data graphically, in addition to its statistical characteristics.

The graph of birthday probabilities looks like this:

It would not be unreasonable, in the absence of knowledge of how the numbers were generated, to attempt a logistic regression, and the software errors out - you have no chance to look at residuals, etc.  This will no doubt be fixed by TI.

I have also noticed that, in the BDay file (I'll attach it again), if you change the 40's to 50's, get the "excessive iterations" message, go to the graph page, highlight the graph of f2 and press delete, the software crashes.

I am using Version 3.0.2.1791 on a Mac with OS 10.6.7

Again, just pointing out some areas of possible improvement in the software.





BDay.tns

Ray Fox

unread,
May 28, 2011, 9:28:29 PM5/28/11
to tins...@googlegroups.com
This is the same process I've been using.
It seems simplier to me also.
 
Keneth Ray Fox

Travis Bower

unread,
May 28, 2011, 10:51:48 PM5/28/11
to tins...@googlegroups.com
We make a document and do both.  I send out a document the first time and it contains directions.   They then can refer back to 'Regression'.  Next year I will probably add how to do it on Notes.  It may be confusing at first, but I value the variety.  Granted, it is good to make one method stick, before diversifying.
Reply all
Reply to author
Forward
0 new messages