cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to interpret the returned vector of loess(vx,vy,span)

Newbie

How to interpret the returned vector of loess(vx,vy,span)

Hello everyone,

I am using "loess" function to generate a regression curve for my experimental data. I understand that loess(vx,vy,span) returns a vector that includes the smoothed coordinates of vy and information of a set of 2nd order polynomials. I know I can use interp(vs,vx,vy,x) to get the interpolated y-value corresponding to x using the output vector vs from loess. However, I want to know the meaning of the values in the vector returned by loess, so that I can utilize the regression curve generated by loess in my own program for subsequent calculations. In other words, I want to reproduce the smoothed curve generated by loess without using interp function. Here is an example, suppose

vx=[0, 10, 15, 20],

and vy=[0, 227.04, 362.78, 517.35],

loess(vx, vy, 2) will then give,

loess(vx, vy, 2)=[1, 52, 0.067, 226.546, 363.622, 517.047, -0.067, 0.494, -0.842, 0.303, 1, 4, 2, 7, 5, 1.049e3, 849, 1, 1, 1, 0, 0, 0, 0, 10, 0, 15, 0, 0, 0, 0, -0.1, 20.1, -1.877, 19.412, 520.281, 32.372, 226.546, 25.807, 0.067, 19.475, 363.622, 29.064, 1, 1, 1, 1, 1, 1.251, 0.67, 0.455, 2].

So far, what I've figured out is that, the first element, 1, of the returned vector, indicates that it was loess that had been used; the 2nd element, 52, indicates that there is a total of 52 elements in this vector; the last element, 2, is the value of 'span' used in loess; the 3rd to 6th elements are the smoothed coordinates (or knodes on the smoothed curve) of vy; and the 7th to 10th elements are the difference between the original vy and the smoothed vy (3rd element to 6th elements in this case). MathCAD's manual mentioned that loess(vx,vy,span) uses a set of 2nd polynomials that best fit the neighborhood of x and y data values in vx and vy. So, I believe the rest elements in the returned loess vector must be information of these 2nd polynomials, but I just couldn't figured out what and where exactly are they. My question is basically how interp(vs,vx,vy,x) interprets the vs vector produced by loess. Thank you.

10 REPLIES 10

Re: How to interpret the returned vector of loess(vx,vy,span)

I believe (from what I've read reinforced by what you've written) that loes is a close relatiive of the spline functions--that it fits a sequence of 2nd order polynomials through the data rather than one smooth curve. The difference between the spline functions and loes is that loes constrains (via span) how many curves it uses, so it does not have to precisely match every point. (The spline functions match each point, and use as many segments as needed to do so.

For data fitting (generally) I/we/you would like one smooth curve, preferrably one with some physical rationale if we are measuring some physical event. Mathcad has a number of those functions, each will determine a set of coefficients for its' particular function that best fit the data supplied. If a polynomial fit will do, I suggest that you look at the regress function, which allows you to choose the order of your polynomial. While regress creates a vs vector and uses interp, it is fairly easy to deduce the basic polynomial from the vector.

If you have a function in mind that doesn't have a built-in fitting function, Genfit will allow you to develop the least squares fit to your own function (with work.)

There are also programs available that will fit a host of functions and summarize and order the best fits; try a web search for "curve expert".

Re: How to interpret the returned vector of loess(vx,vy,span)

Here's what the good old Mathcad Treasury has to say on the subject.

To summarize: you don't want to know what the output is

Re: How to interpret the returned vector of loess(vx,vy,span)

Thanks, RJ. I understand that in most cases, you may not care about what the output of loess is. However, since I need to use the output of loess in my own program, I DO need to understand what the output is in this case. The file you posted is helpful and it mentioned that there were more infomation in the next section about how loess works. Do you happen to have the next section? Thank you.

Re: How to interpret the returned vector of loess(vx,vy,span)

Thanks, RJ. I understand that in most cases, you may not care about what the output of loess is. However, since I need to use the output of loess in my own program, I DO need to understand what the output is in this case.

Perhaps, but the Treasury is usually very informative, so when it says you don't need to know, what it probably means is that half of the algorithm is in loess, and the other half is in interp. So, since you don't know what interp does, the output of loess really is useless to you.

Do you happen to have the next section?

Sure. I have all the sections

It doesn't give you the answer though.

Re: How to interpret the returned vector of loess(vx,vy,span)

Can you put it on Prime 3.0 version?

Re: How to interpret the returned vector of loess(vx,vy,span)

Sorry, your question is not clear. What do you want in Prime 3.0?

Re: How to interpret the returned vector of loess(vx,vy,span)

I have one big trouble, i'm making a Marshall Hot mix asphalt sheet, and in the end, i need to do some plots of the results, like (Porcentajes, Vacíos) and intercept the result in 4% and the result intercept in the other variables like VAM, Densidad, Flujo, etc.

In excel you make a tendence line with a ecuation, and i love mathcad and i need to prove to other team mates that work with Mathcad i better than excel.

Can you help me?

https://www.dropbox.com/s/q0q7l9i12eo22ez/Dise%C3%B1o%20de%20mezcla%20asf%C3%A1ltica%20EP-EMPROVIAL....

Captura de pantalla 2014-11-27 a las 13.38.51.png

El mensaje fue editado por: Cristóbal Vélez Valdiviezo

Re: How to interpret the returned vector of loess(vx,vy,span)

Look up "regression" (I guess, regresión in Spanish) in the help. See the attached file for examples.

To attach a file to a post click on "Use Advanced Editor" in the top right corner of the edit box when you are posting. No need for Dropbox.

Re: How to interpret the returned vector of loess(vx,vy,span)

Thank you very much. I will try to do my best with your help.

Re: How to interpret the returned vector of loess(vx,vy,span)

So you need the inverse of Vacios(Porcentajes) and thought you need to know more about the output of loess?

All you need is a simple solve block.

Find attached some variants using simple linear interpolation, spline interpolation and polynomial regression. The concept may be applied to any of th fit functions, too, if you find that more appropriate.

Announcements