Hello.
I have two graphs:
1. Sunspots vs Years
2. Flux vs Years
with 6th degree polynomial trendlines in each.
I would like to correlate the trendlines of these two separate graphs. How can I do it?
Any help appreciated!
Hello.
I have two graphs:
1. Sunspots vs Years
2. Flux vs Years
with 6th degree polynomial trendlines in each.
I would like to correlate the trendlines of these two separate graphs. How can I do it?
Any help appreciated!
Last edited by Solarmew; 11-16-2012 at 05:42 PM.
Caveat -- I can't readily view your file, and I always have trouble converting a spreadsheet that large, so I can't be certain that I see what you have done so far. It would appear that you have successfully generated the trendlines in the charts, and are looking at doing additional work with those trendlines, is that right?
The first step in manipulating trendlines is to get the coefficients into the spreadsheet with enough precision that they are useful. You can expand the number format to show all the digits, then hand copy them into the spreadsheet if you want. If you are going to do this kind of analysis throughout your career, I would suggest you learn how to use the LINEST() function to generate the coefficients directly in the spreadsheet and save the effort of copying from the chart to the spreadsheet.
What kind of question are you asking? You haven't told us in math/statistical terms how you want to compare the two functions. If you tell us how you want to make the comparison/correlation, we should be able to help you figure out how to put that into Excel.
If your question is less about Excel and more about how to mathematically/statistically/scientifically compare the two curves, I'm not sure if any of us here will have the statistical/scientific background to suggest the best way to make this comparison. I'm sure we could suggest different ideas (ratio of the trendlines, or difference between the trendlines, for example), but those may or may not be correct for your application.
But don't you need to have a linear trendline for LINEST? How do i get all the different slopes for each point on the trendline described by a 6th degree polynomial?
also how do i collapse the long columns of data so it all fits on one page without scrolling? >.<
Last edited by Solarmew; 11-17-2012 at 02:15 PM.
"Correlate the trendlines"? You mean calculate the area between the curves, something else?
Correlate the two datasets?
Entia non sunt multiplicanda sine necessitate
I'd like to compare how the slopes of tangents at each point vary over time i guess
You can get the trendline coefficients on the worksheet using LINEST as MrShorty said. If you had those, you could calculate derivatives to get the slopes at various points.
However, I don't think a polynomial is a good choice for a fit; IMO, a a Fourier series, which has a basic periodicity, would be better.
To do any analysis like that, I think you need to delete the rows with non-numeric data (asterisks) in any of the columns.
@.@ I don't know how to do a Fourier series
I tried pulling out the equation of my trendline:
y = -0.00x6 + 0.69x5 - 3,406.44x4 + 8,995,647.52x3 - 13,360,451,307.07x2 + 10,581,367,714,111.40x - 3,491,265,445,116,520.00
and plugging it into wolframalpha to get the derivative, but it doesn't even look the same there and I don't know why D:
http://www.wolframalpha.com/input/?i...5116520.00000+
Last edited by Solarmew; 11-17-2012 at 03:04 PM.
The Linear in LINEST() refers to a linear function as you would learn in linear algebra (usually an upper division college math course). All polynomials are linear functions in this sense as are many other function types. The help file for LINEST() in the latest versions of Excel has a polynomial example, as do many of our threads here.But don't you need to have a linear trendline for LINEST?
This sounds more like a calculus question than an Excel question. Excel does not inherently know how to take the derivative of a polynomial, but it can be taught how to do fairly easily (if you know how to take derivatives already). I'm sure there are tutorials on the internet for taking derivatives of polynomials if you search for them.How do i get all the different slopes for each point on the trendline described by a 6th degree polynomial?
It looks ok to me, though I admit I didn't go through it thoroughly. It just looks like Wolfram prefers to express the coefficients as fractions rather than decimals.plugging it into wolframalpha to get the derivative, but it doesn't even look the same there and I don't know why
In many cases, I believe that if one understands the math behind a problem, it will be easy to program a spreadsheet (or other programmin language) to do the work. If the math is a mystery, the programming will also be a mystery. Assuming you've had calculus/pre calculus at some point, I would suggest you start by reviewing how to differentiate polynomials so you understand how that works, then it will be easier to put into a spreadsheet.
i know how to differentiate XD and i've checked it and it looks good to me, but i still don't get the right results ... i'm not sure what im missing :\
i've made smaller file with a couple random data sets just to make sure this method works and it does. But for some reason when i try to do THE EXACT SAME THING here, it doesn't work +.+
ung...
y = -0.00006x^6 + 0.68787x^5 - 3406.44262x^4 + 8995647.52492x^3 - 13360451307.06950x^2 + 10581367714111.40000x - 3491265445116520.00000
dy = -0.00036 x^5+3.43935 x^4-13625.8 x^3+26986942.5748x^2-26720902614.13900 x+10581367714111.40000
plugging that in and substituting x values, the slope never changes sign ...
Last edited by Solarmew; 11-17-2012 at 04:47 PM.
bluntly plugging it into mathematica gives the same answers:
this slope should be negative
http://www.wolframalpha.com/input/?i...00+at+x%3D2004
this one should be positive
http://www.wolframalpha.com/input/?i...00+at+x%3D2010
but they're both negative
which leads me to believe it's not the math, but excel ... could it be it generated the wrong equation?
That can be frustrating. Debugging this sort of thing can be frustrating. Sometimes it is as simple as a lost negative sign or a parenthesis out of place or who knows what little thing goes wrong. Sometimes, no matter how sure we are that are doing THE EXACT SAME THING, some little detail is eluding us.i've checked it and it looks good to me, but i still don't get the right results ... i'm not sure what im missing :\
Sometimes when I am debugging something like this, I break it up into as small of steps as I possibly can. Hopefully, then I can pinpoint the step or the term in the equation where it's going wrong.
ok so here are the steps:
1. Add 6th degree polynomial trendline
2. copy the given equation
3. type "derivate (paste equation here)" into mathematica
4. copy the new equation
5. paste that into excel and change all the x's with the first value in the column that is the x-axis
6. drag down to apply the same to the rest of x values
result: slope sign never changes...
i have no idea where this could possibly go wrong ...
Why do you think one of those slopes should be positive and one should be negative?
One observation, your x^6 term has one significant figure (6e-5). Is it really exactly 6.00000000000000e-5, or is that rounded to one sig fig -- meaning it could really be anything between 5.5e-5 and 6.49999999e-5? For whatever reason, when a chart displays the equation, it doesn't usually choose to display all sig figs, which can create all kinds of problems if you assume the coefficient is exactly 6e-5 when it really isn't (this could apply to the other coefficients as well. This is a common mistake we see around here (and a reason I prefer LINEST() over the chart trendlines). Check your equation and make sure all numbers are displayed to their full 15 digit precision.which leads me to believe it's not the math, but excel ... could it be it generated the wrong equation?
y = -0.00006x^6 + 0.68787x^5 - 3406.44262x^4 + 8995647.52492x^3 - 13360451307.06950x^2 + 10581367714111.40000x - 3491265445116520.00000
You have x values in the range of 2000, and you're raising them to the 6th power, resulting in values on the order of 10^20 -- and then multiplying if by a coefficient with one significant digit. The error in that term alone dwarfs all of the other components.
Mr. Shorty might be kind enough to show you how to get the coefficients on the worksheet using LINEST.
the sign should change because i'm looking at it and it's a sinusoidal graph _ _
wtf.jpg
I'm not sure the significant figures would really make that much of a difference, as long as it's still a 6th degree polynomial with alternating signs
if copying won't work, then how can i just pull out full coefficients with the LINEST?
There are several different ways to set it up. From Excel's help file http://office.microsoft.com/en-us/ex...005209155.aspx (just before example 1)Another observation -- what is the chart using for "x" in the regression? It looks like you are using (trying to use/assuming Excel is using) the year number as x. According the your picture, an x of 1994 should output something near 100, but an x of 1994 doesn't yield anything close to 100. It is another common error (especially when using dates) to not know what the chart trendline is using for x. This might be because I can't really see your original spreadsheet you posted, but it looks to me like another part of the problem is that x is not adequately defined, so that we (or at least I) cannot determine what the chart trendline equation is using for x.In addition to using LOGEST to calculate statistics for other regression types, you can use LINEST to calculate a range of other regression types by entering functions of the x and y variables as the x and y series for LINEST. For example, the following formula:
=LINEST(yvalues, xvalues^COLUMN($A:$C))
works when you have a single column of y-values and a single column of x-values to calculate the cubic (polynomial of order 3) approximation of the form:
y = m1*x + m2*x^2 + m3*x^3 + b
hm, well it says it's using =data!$H:$H which is just the H column of years:
2011.99726
2011.994521
2011.991781
2011.989041
2011.986301
2011.983562
etc
>.> ... what else would it be using? %\
how can i use LINEST to process a 6th degree polynomial equation?
Here's something to ponder.
that looks really nice X3 ... but i'm not entirely sure what I'm looking at @.@ I'm kind of a newb when it comes to excel >.<
I'm a physics undergrad and I just started this project last week. I've been told to find sunspot and solar flux data and "correlate" them %\
Still not entirely sure what I'm even supposed to be doing here 8| ... But i laid the two data sets over each other and the trendlines lined up pretty nicely, so I figured maybe I could somehow find the degree of the "niceness" by relating the slopes of the tangent lines to each trendline at each point ...
blarg ...
thanks for bearing with me, guys XD ...
hopefully i can get some kind of half decent results by monday +.+ ...
That only takes a single calculation: =correl(sunspot range, flux range) returns 94%.
you're kitten me -____________________________- ...
ok, well, how about the actual LINEST function then?
I'm reading up the help file, it says:
----------------------
stats Optional. A logical value specifying whether to return additional regression statistics.
If stats is TRUE, LINEST returns the additional regression statistics; as a result, the returned array is {mn,mn-1,...,m1,b;sen,sen-1,...,se1,seb;r2,sey;F,df;ssreg,ssresid}.
If stats is FALSE or omitted, LINEST returns only the m-coefficients and the constant b.
-----------------------
I've set it to TRUE, but i'm not getting anything like {mn,mn-1,...,m1,b....
why is that?
I'm getting #VALUE! error in my main file, and i also made a little test file with 10 values for each, x and y, and that only gives me one number (which i don't even know what it is referring to) for =LINEST(A1:A10,B1:B10,TRUE,TRUE)
edit: sorry about double post again X.x any way i can delete those? I'm not sure why it's happening +.+
edit2: maybe i misunderstand what it's supposed to be doing. I was under the impression that it'll put out a line of numbers that are coefficients of some equation describing the trendline of the given data >.> ...
edit3: yeah, that's totally not what it meant at all _ _ ... guess i should try reading help files if i wanna figure something out ... i think that's why they write them ... +.+
anyways, you guys are awesome XD thanks for yer help
Last edited by Solarmew; 11-17-2012 at 09:52 PM.
You're wasting your time applying a polynomial fit to periodic phenomena, and then trying to do analysis based on the polynomial. Polynomials are not periodic.
Sunspots and some other natural phenomona are periodic; polynomials never are. When you find a mathematical model that fits something well over a long period of time, it can offer insights as to what might give rise to the behavior.
Polynomials can model anything if the order is sufficiently high; I don't see how they provide any insight.
In addition, your 6th-order fit uses seven parameters to achieve R2 of 0.70 and 0.75. The Fourier series uses five parameters and achieves R2 of 0.82 and 0.84; it describes the data better with fewer parameters.
BTW, you have a very pretty dataset.
Last edited by shg; 11-18-2012 at 03:07 PM.
I wish I knew how to use fourier series +.+ ... but i'll look into it, thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks