本文介绍了识别斜坡上的重大变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一个点,大变化在斜坡上发生.

I am trying to find a point where a big change happens on a slope.

尝试使用具有不同设置的 ecp::e.divisive() 函数,但无法按照我需要的方式识别更改.

Tried to use ecp::e.divisive() function with different settings and couldn't make it identify the change the way I need.

下面的代码和情节应该说明更多.灰线是来自 ecp 包的截断,我试图用它来绘制蓝线(目前是手动绘制的).

Below code and plot should illustrate more. Grey lines are cutoffs coming from ecp package, and I am trying to it to plot blue line (which is at the moment plotted manually).

请告知是否有更适合此任务的软件包.

Please advise if there are better packages for this task.

library("ecp")
#get cutoff points
ecpOutput <- e.divisive(x, k=1)
ecpOutput$estimates

#plot
plot(x, bty = "n")
abline(h = 0, lty = "dashed", col = "grey")

#add ecp estimates
abline(v = ecpOutput$estimates, col = "grey", lty = 2)

#ideal line, doesn't have to be exact, anything around this line is OK
abline(v = 384, col = "blue", lty = 2)

数据: x 是一个排序的 1 列矩阵(ecp 要求的结构).

Data: x is a sorted 1 column matrix (required structure by ecp).

x <- structure(c(-27.0409169663486, -26.129156710088, -24.7600585044449,
-24.3953228174759, -24.1577613311647, -23.5016667274094, -20.6947912955816,
-20.5608424516568, -20.2274448352933, -20.1776769950718, -20.0154244013066,
-19.9185729879804, -18.6495729388285, -18.5966280348446, -18.4877201244377,
-17.8697488852, -17.6964369055135, -17.4580050047899, -17.4503603253745,
-17.2138236467553, -17.1978137674216, -17.0883917900212, -17.0780609255085,
-16.5936774343097, -16.5302509987677, -16.5047064149008, -16.3610339293733,
-16.3179953827084, -15.8098489669017, -15.8017464582135, -15.7931978631991,
-15.7048014947664, -15.6438615495371, -15.5724025176269, -15.4769417976187,
-15.4566078151486, -15.3683766952941, -15.3598144860889, -15.2872530572521,
-15.2615773975834, -15.1553721281872, -15.1253479156971, -14.8574803029005,
-14.7886609612358, -14.7052679457918, -14.6700476095839, -14.4967591359077,
-14.3902100635321, -14.1344579537429, -14.1122694462137, -13.6977777268339,
-13.5002575880219, -13.3931536856711, -13.2720061859572, -13.1630633420915,
-13.120694599871, -13.0989354290794, -13.0305773443162, -13.0247860189105,
-12.9679198987695, -12.9339256928714, -12.7503935672128, -12.6086380226913,
-12.5204925937268, -12.5018027956008, -12.3362734240611, -12.2633206830352,
-12.2389866512024, -12.2261511983906, -12.2082248950284, -12.1988063383678,
-12.1625438078306, -12.105137364671, -12.0283612849999, -12.0207914207455,
-11.9569828730108, -11.9377135887775, -11.7974478043662, -11.7856404961775,
-11.7070359492143, -11.685818522575, -11.6150116648869, -11.5889351441476,
-11.5696939812167, -11.5218497980405, -11.4278460823336, -11.2616735602107,
-11.1371735315344, -11.1101486927449, -11.0545987008828, -11.0497610649959,
-10.9777305856557, -10.9538432991084, -10.8709063558819, -10.8321978567433,
-10.7154060103612, -10.6904665022414, -10.6728147078525, -10.6319097418566,
-10.6084139374132, -10.5435156393802, -10.4969417190754, -10.4910751521816,
-10.4076974735856, -10.1987743033507, -10.1084368444001, -10.067653486032,
-10.0184841375099, -10.0184804878766, -9.98796628047806, -9.92940612537163,
-9.79791464687017, -9.78385633218692, -9.74746828052048, -9.5340969261009,
-9.3872416240278, -9.34975526969295, -9.34350605265574, -9.33678121532548,
-9.28246068708019, -9.26231844050325, -9.24219935644902, -9.22973616812829,
-9.1945301757694, -9.18742543173638, -9.09818179983656, -8.84383892771356,
-8.71390231428188, -8.63727799501085, -8.62365985718404, -8.57368937545283,
-8.56896270190976, -8.51750651338242, -8.36994967607861, -8.34940777555791,
-8.24579609778514, -8.16499004491889, -8.13648089733029, -8.12443902872708,
-8.06884804631702, -8.01978044346555, -8.00857010892087, -7.98752833340474,
-7.98494612290397, -7.92263788171607, -7.92262794402356, -7.91254741704133,
-7.8612668717642, -7.85956255484269, -7.80614005087113, -7.78172738274975,
-7.76590807725416, -7.73362312192246, -7.73353827316045, -7.73074597208869,
-7.66932615651785, -7.63405189653259, -7.52008106079428, -7.4794467369495,
-7.37006671254996, -7.33891732414829, -7.28638734342099, -7.18383241390338,
-7.16967207372779, -7.12414638131948, -7.11845633549842, -7.10069950413643,
-7.08453272839936, -7.06225675561229, -7.01372949292662, -6.97700431366834,
-6.96221498775977, -6.95474531960413, -6.92853733102012, -6.87948984857266,
-6.81875907966932, -6.80049432153244, -6.74491178906506, -6.73722594655536,
-6.65241543109368, -6.64432866218849, -6.57471615362753, -6.538942870458,
-6.48556582657451, -6.44344567639388, -6.44142334658235, -6.40718664187937,
-6.37631310536975, -6.35766817597632, -6.33004629281548, -6.32243131413274,
-6.31465060236999, -6.30957529705468, -6.20042487075657, -6.19852760812695,
-6.19516991943952, -6.19169299941109, -6.14915041772936, -6.1341182105985,
-6.06886854629022, -6.03316938455024, -5.92620275477516, -5.915861751696,
-5.8993712054553, -5.8562854376353, -5.81203754357936, -5.81031989834777,
-5.79005016179402, -5.70715392727825, -5.64380201251138, -5.61822898444235,
-5.61198428778589, -5.55181215637224, -5.5414283688058, -5.51873245882438,
-5.51677200116567, -5.51551938308407, -5.50995967349956, -5.47456882908066,
-5.46182989367447, -5.34425037377986, -5.32571672656563, -5.24036884690065,
-5.2280272754873, -5.13269699736861, -5.13115055948407, -5.09522822858288,
-5.06292167413738, -5.05058297801937, -5.00080776299476, -4.99907315892117,
-4.96652519349395, -4.94319578011658, -4.93410325981468, -4.88778233710964,
-4.86817149761772, -4.86068237590916, -4.86018697766406, -4.79260202993216,
-4.78704006512903, -4.7697286436275, -4.74319640834353, -4.66791717712299,
-4.63451063153309, -4.55913300698176, -4.54773156325591, -4.5029917001588,
-4.50232432311584, -4.48448651461267, -4.48195952916376, -4.45942294767531,
-4.43684117621408, -4.39862573806896, -4.39218230499561, -4.32218627745706,
-4.29986813130089, -4.25622220689577, -4.24164586680005, -4.1312719357839,
-4.12513288512985, -4.07946940297387, -4.07261512152973, -4.01165511465604,
-3.95381138375493, -3.95044337911054, -3.92340302872436, -3.91833355363622,
-3.87865234740553, -3.84667242505411, -3.78315737709957, -3.76505984684618,
-3.76018864171568, -3.71684064078827, -3.70873189126336, -3.69375597807388,
-3.69325959119626, -3.6505984611436, -3.62183744181462, -3.58883235361055,
-3.52391205093927, -3.51617596119693, -3.51388800083065, -3.33813297717772,
-3.26837985172665, -3.25102638292739, -3.24658212799339, -3.22891542458543,
-3.17892565704276, -3.1283260157199, -3.04352634415322, -3.02299584335501,
-3.01373331291241, -2.99552385674378, -2.86372198270148, -2.83811475137176,
-2.77463274263238, -2.69783066358124, -2.69434624147968, -2.65941589188957,
-2.6221506974122, -2.57311913722599, -2.56672727866588, -2.56667581533302,
-2.55574357522681, -2.50395283367281, -2.49786830801457, -2.46604172470746,
-2.42877871397163, -2.4017493435186, -2.369794488014, -2.30769529142191,
-2.28289171086166, -2.24736457553032, -2.22224835097905, -2.21993628534018,
-2.21938775070459, -2.21330765240871, -2.1970203297687, -2.18405609540363,
-2.1707971627096, -2.16975015841871, -2.11020976431672, -1.75392661111203,
-1.73701872449349, -1.7094653013083, -1.68198644925752, -1.67745819232374,
-1.65515644561234, -1.57194744043552, -1.57116047214388, -1.51000042083035,
-1.50463279855355, -1.46346551065156, -1.44224216231154, -1.37311564470336,
-1.32779620730326, -1.32592791352896, -1.31204307149482, -1.27756472934721,
-1.23603794634302, -1.1702376900797, -1.16378397319292, -1.12499060545068,
-1.1088125112075, -0.939262072448041, -0.862163030101959, -0.858354175324213,
-0.654474645495292, -0.628257109630334, -0.606705081751156, -0.550295255225927,
-0.497332185765383, -0.482929007849059, -0.440957523688129, -0.360777543733516,
-0.305426972877309, -0.199639436822714, -0.108018704644053, 0.0346309488381769,
0.034746934017077, 0.0493559949320308, 0.192914632754347, 0.218667918037225,
0.245737147003821, 0.247527541956785, 0.333222558419853, 0.557256844844099,
0.669063496448389, 0.720955292473698, 0.767660102407662, 0.878291398784322,
0.946178076488395, 0.946467111772845, 1.11121506783806, 1.22835778244999,
1.24961769756564, 1.29790330264223, 1.30574614563616, 1.30823862002444,
1.35802473804966, 1.48779920673317, 1.6470804669896, 1.75657725379367,
1.91434060426954, 3.12793082392592, 4.05818631097523, 5.87762107232264,
7.87360999893622, 54.7844606150857), .Dim = c(389L, 1L))

推荐答案

尝试:

e.divisive(diff(x), k = 1, min.size = 2)

这篇关于识别斜坡上的重大变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 15:58