CurveFitting
Lowess
produces lowess smoothed functions
Calling Sequence
Parameters
Description
Examples
Compatibility
Lowess(xydata, opts)
Lowess(xdata, ydata, opts)
xydata
-
list, listlist, Array, DataFrame, or Matrix of the form x0,1,x0,2,…,x0,M−1,y0,x1,1,x1,2,…,x1,M−1,y1,…,xN,1,xN,2,…,xN,M−1,yN; data points of M dimensions
xdata
list, listlist, Array, DataSeries, or Matrix of the form x0,1,x0,2,…,x0,M−1,x1,1,x1,2,…,x1,M−1,…,xN,1,xN,2,…,xN,M−1; independent values of data points of M dimensions
ydata
list, Array, DataSeries, or Vector of the form y1,y2,…,yN; dependent values of data points
opts
(optional) one or more equations of the form fitorder=n, bandwidth=r, or iters=nonnegint
The Lowess command creates a function whose values represent the result of the lowess data smoothing algorithm applied to the input data.
This command calls Statistics[Lowess]. See its help page for more examples and a detailed description.
with⁡Statistics:
Create a data sample and apply to it some error.
X≔Sample⁡Uniform⁡0,π,200
X≔2.55952994787841,2.84562929519763,0.398940849170435,2.86945487961263,1.98661516237133,0.306432219774318,0.874927958430562,1.71807896311840,3.00809643996240,3.03128673371506,0.495156099507834,3.04920715280643,3.00702865285900,1.52485257225906,2.51415524187245,0.445749079076013,1.32500214706731,2.87686799856516,2.48879272666428,3.01433435793099,2.06007016313017,0.112191547056034,2.66761838926515,2.93422632565759,2.13230937623431,2.38051082755506,2.33461950250529,1.23221752310796,2.05924452437235,0.537798840821172,2.21810920321822,0.100005836322157,0.869979215163289,0.145051701612858,0.305148490360630,2.58696906401403,2.18286849744474,0.996197397016342,2.98521060790962,0.108215553452901,1.37835605710050,1.19870124571845,2.40494191784856,2.49819416754753,0.587077601625226,1.53864022779815,1.39985033469435,2.03045220448505,2.22853534133869,2.37091813587784,0.867158354105291,2.13534893622882,2.05805107666556,0.510859832674940,0.373842242178014,1.56565684452034,3.01512456940131,1.06935329828115,1.83867286686109,0.703125944891039,2.36017507439865,0.801404940693480,1.58951095654316,2.19621429619387,2.79885511322572,3.01370289407711,1.71912828886453,0.435501531198557,0.469020951089329,0.808986039393864,2.64119115514444,0.798851025395767,2.55815122750744,0.765056252712111,2.91936777185323,1.09950642809356,0.617622194485329,0.788803203652482,1.93536142886538,1.48688077073878,1.10477092395412,2.61012511379108,1.83866136917531,1.72700764931232,2.88144887620684,0.897989761635400,2.37881467707075,2.36790978538221,1.19520587794653,1.78386429505166,0.238303278834594,0.169489296463311,1.66754969307643,2.44782604600639,2.93428110394878,0.408112390196775,1.78701223418413,1.47463418961226,0.0373914541076151,1.05910202300229,…,⋯ 100 row vector entries not shown
Yerror≔Sample⁡Normal⁡0,0.1,200
Yerror≔−0.0953810981766894,0.171103963707571,0.0285687899013584,−0.0606979079748253,0.128901014035489,−0.0112726591574468,0.0959342847342146,−0.00314499457928086,−0.00771108360917845,−0.0433343735980858,0.00482823379489400,−0.0965862973322655,0.235332740922138,−0.0694524292206791,−0.105716425581988,0.167202282817078,0.143312197000282,0.0904681118110068,0.00420740059943495,0.151051878859773,−0.0386596747220680,0.0440691237914762,−0.00670225429357946,0.0933890481068025,0.0478184461625122,0.0278017403383086,0.109443084167184,0.0397625283920667,−0.121323537606438,0.261193618963694,0.0993582186147168,0.0255303351071521,−0.0241543939453960,0.0962199411551923,−0.0157960144948491,−0.0342292986942833,−0.0525952037444790,0.150651932610134,0.192128739829213,−0.197094892675294,0.0716624529444702,0.0210781638490448,0.0218981113573270,0.157603381498783,0.0716964674343195,0.0693803864165980,0.0616715533493450,0.0143206648485258,−0.181484887394651,−0.0337656194550488,0.0276303588503054,0.0951330555516539,−0.0429790945303218,0.0455379098359191,0.0366036903524287,−0.0553457126157233,0.106723361618346,0.140201886256280,−0.0720866213397492,−0.137249480688211,0.0549362085338733,−0.00167268056838582,0.129099704821460,0.0254442515639488,−0.0372671496029909,0.00869660121897113,0.0640425662408623,−0.0292282538277321,0.0962534001496196,0.0583098777724654,0.282818705363368,0.135753946910954,−0.166917470877993,0.0935508850482316,−0.00462483722461739,0.105955669223280,0.0633363321550364,−0.234756705334042,−0.146622567958132,0.131133388816615,−0.167983185691991,0.0833409806086111,0.139678949514575,0.0948898999584073,0.201911097408961,0.0463137263598911,−0.131204554889707,0.104905900745445,0.142937189262709,0.126189572096261,0.0812593501961863,−0.00426991039536866,−0.0284706376734075,−0.0256090970343518,−0.0420351675532923,−0.00415469312979765,−0.0337334452865951,−0.135343885108397,−0.146335429275237,0.00740581624632347,…,⋯ 100 row vector entries not shown
Y≔map⁡sin,X+Yerror
Y≔0.454367047823680,0.462765422150169,0.417011371451704,0.208093241995450,1.04368688151902,0.290386326063255,0.863431606558844,0.986028510037196,0.125388971861870,0.0667479930224107,0.479997241960240,−0.00433216009474287,0.369491006894417,0.929492342125722,0.481355758387552,0.598336169048849,1.11325658273403,0.352111636664697,0.611620407680281,0.277966968110887,0.844014702644611,0.156025460819454,0.449723773184358,0.299272415266748,0.894268876685337,0.717506928624505,0.831639936250323,0.982990192299385,0.761738576735361,0.773440413284528,0.897065351753078,0.125369558917136,0.740161140300520,0.240763529723844,0.284638794481224,0.492394052801364,0.765863976074385,0.990062283469757,0.347874168316888,−0.0890904272044914,1.05320289800621,0.952645850199230,0.693708919326861,0.757521280138683,0.625626778338910,1.06886342361315,1.04709583411662,0.910525881763713,0.609891571965787,0.662853704236079,0.790123843673663,0.939961111426311,0.840642423433526,0.534465390413217,0.401798671725056,0.944641080274323,0.232854589833541,1.01709170995567,0.892248495259157,0.509355909689420,0.759222697004252,0.716661533636967,1.12892459124919,0.836162747483787,0.298799518668049,0.136238022700087,1.05306153698097,0.392636918139674,0.548266579652729,0.781897555687775,0.762596553350432,0.852309066164837,0.383981839378259,0.786128462229965,0.215775500347837,0.996939038436453,0.642434607259717,0.474753699054593,0.787656341372445,1.12761454419245,0.725378096076094,0.590139980696884,1.10401710930675,1.08271370183219,0.459130591665432,0.828389469888631,0.559727806794417,0.803680382760712,1.07322838379324,1.10357633664839,0.317313545556865,0.164409075004430,0.966852405590904,0.613828544030345,0.163794594547286,0.392722759490367,0.942982816073745,0.860036098392529,−0.108952687520426,0.879321951048542,…,⋯ 100 row vector entries not shown
Create the function whose graph is the smoothed curve.
L≔CurveFitting:-Lowess⁡X,Y,fitorder=1,bandwidth=0.3:
Plot the data sample, smoothed curve, and the region between the x-axis and the curve for π8≤x≤3⁢π8.
P≔ScatterPlot⁡X,Y
Q≔plot⁡L⁡x,x=0..π
R≔plots:-shadebetween⁡L⁡x,0,x=π8..3⁢π8,showboundary=false,positiveonly
plots:-display⁡P,Q,R
Find the area of the shaded region.
int⁡L,π8..3⁢π8,numeric,ε=0.01
0.538403465288975
And find the maximum.
Optimization:-Maximize⁡L,map⁡unapply,−x,x−π,x,optimalitytolerance=0.001
1.00180213049401101,1.58152459006664
The CurveFitting[Lowess] command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
See Also
Statistics[Lowess]
Download Help Document