Okay, so I am working with the daily closings of the Dow Jones Industrial Average (DJIA) index from January 1979 to December 1989. I have successfully plotted the time-evolution of the index, but I am stumped as to how to add a trendline (specifically, exponential). You can get the data here:
http://research.stlouisfed.org/fred2/series/DJIA/downloaddata
I just downloaded it to Excel and then imported it to R as a csv file and plotted it.
In addition to that, how can I add a trendline at a specific place? Say, I wanted a trendline from the year 1985 to 1988?
If that's literally what you want to do (I suspect it isn't), then all you have to do is plot and add a curve with the specified function of x:
plot(y~x)
par(new=TRUE)
curve(0.0629*exp(0.0003*x))
If you actually want to fit a curve based on something you do in R, you'll have to generate some kind of model and then plot fitted values from that using basically the same thing but instead of curve you could use lines.
Related
I have managed to plot two different data sets on the same axis however, I'm also looking to plotting another line showing their average.
The main problem is that both data sets have different X (time) values so it's not possible to add an average column at the end and plot that. (See the highlighted row 22 for example, corresponding Time values are different)
Is there any way I can plot an average of two plots on the same axis?
One idea that might work is to place the values of both series, one above the other in two new columns, sort this new data according to time, smooth it, then plot the smoothed combined data. Alternatively, you could do the smoothing by simply plotting the new sorted series, adding a moving average trendline to it, then change the formatting of the new series so that it is no longer visible (but the trendline is). Something like this:
In the above picture, series 3 is the plot of the sorted aggregate data of series 1 and 2. If you change the formatting of series 3 so that there is no line, you get something like this:
For my relatively small mock data sets, the results are admittedly poor (it was based on just 25 data points in each series), but if you have a large amount of closely spaced data, and you play around with the moving average window size, you might get something acceptable. If not, you should probably just interpolate both datasets to obtain two consistent time series.
Please dont eat me because of this question :)
I have some data in excel and I would like to make a graphical representation of those data. Structure of my data:
persons ID : from 1 to 485 to every person, there is one parameter like average jumping distance and another parameter (like height) and finally there is a class to which every person belongs to (1, 2 or 3).
To assign persons to classes I have used k-means algorithm.
Now I would like to make a graph of this result. How can I do it please in excel (or by using another tool)?
Thank you
I would use a scatter (XY chart with markers and no lines). Plot average jumping distance on one axis, height on the second axis. Then for the classes I would separate all the data into 3 series and use different colors for each series. I would adjust the marker size to see which one works best with the data.
Here is a fast example to give you an idea how to it would look like. Its not as easy as just clicking once to insert the chart from the data though:
I have 3 sets of data x,y,z where z represents the scan steps and z=50. Corresponding to z I have a each values of x and y. I want to plot a line or contour plot at 5th, 10th and 20th scan steps. Is it possible and which function should I use?
I don't fully understand how your data is organized, but Matplotlib is the easiest way to pop up a contour plot: see this for example:
http://matplotlib.org/examples/pylab_examples/contour_label_demo.html
If you remove the last past of that URL, you can browse the entire gallery for more examples, some of which may be closer to what you are try to do.
A more involved and more powerful alternative would be Chaco. You can refer to this example:
http://docs.enthought.com/chaco/user_manual/annotated_examples.html#contour-plot-py
Mayavi is for 3D plotting which doesn't seem to be what you are trying to do. If you are curious, checkout:
http://docs.enthought.com/mayavi/mayavi/
Hope this helps.
I need to get Excel to graph about 5 points into a single curve. I'm looking for is the average of all the point if the points don't line up perfectly. I'm not very familiar with graphing on Excel, so it's very possible I've overlooked some option to get what I'm trying to achieve.
This is an example of what I'm looking for:
It looks liek what you're looking to do is add a trendline to a scatterplot.
I've included some screenshots below.
Inital graph showing 3 groups of data we want to 'average':
Adding trendline to the points:
Trendline settings:
Final result:
I'm not great with Math at all and so-so with Excel. I have a requirement to calculate a series of values to apply as an offset for a price schedule. I know what I basically want to achieve with the offsets and how I want them to change across span of values but I don't know how I can plot these values or something close to it in Excel. For an idea of the curve I'm roughly trying to create you can plot these values:
0
20
30
35
38
39
39.5
40
40.5
40.75
41
41.125
41.25
Or if you don't want to use excel you can take a look at this chart image:
Now it was easy to quickly create that by entering some values and tweaking them to get a shape I roughly want, but I need 1000 data points! In other words, instead of the 13 point I provided above I would need 1000. This would be crazy to try and do manually.
I can think of two possible options:
Create the range of values with fewer points, then somehow
extrapolate that data set into more points. Maybe extrapolate isn't
correct but essentially convert 10 points of data into 1000
Interactively draw a curve and then have it plotted to values within
a defined min/max range
I've tried googling for help but I'm just coming up with tons and tons of "how to plot your data" sites - I need to work from the OTHER direction ;)
Thanks for any help or tips.
Like you said, you could draw a curve and plot those points, then put them into some equation solver to get an equation that could describe the curve you're looking for.
But just from looking at your curve above, you might be able to use an equation of the following form.
y = A - (B / x)
To make a curve similar to yours above, you might try...
y = 40 - (5 / x))
You can use a site like https://functionplotter.com/ to plot the function and play with the values of A and B until you have curve that you are satisfied with.
Is this kind of thing you are looking for?
spline interpolation in exel
XlXtrFun.xll
basically you already got 13 y's and 13 implict x's (1 to 13). You provide bunch of "x" values of small increment, like 0.01, 0.02, 0.03, ...,12.999 13.000, to this tool. then this tool will calculate y value for each of the ones. You will plot these as "x y scatter plot"
A simple and very accurate way is to plot the curve as an x-y scatter plot, and then fit a polynomial via Insert Trendline.
In this case a 4th order polynomial provides close to a perfect fit (R2 of .9973)
Y = -0.0139x4 + 0.4819x3 - 6.0607x2 + 33.026x - 26.718
You can also solve this without charts using LINEST, see Walkenbach's guide here. But charts provide the easiest reference