admin管理员组文章数量:1123181
I am depicting the 14 day spei conditions leading up to and following wildfires. I'm looking for trends in variability or dips. In my study region, n = 399. As one could expect, there is a lot of variability.
geom_smooth
oversimplifies the data and effectively drives the trend to the zero line, while geom_quantile
misses the very non-linear trends and dips I am seeking. I wish there was a way to do multiple smoother lines representing the smoother weighted by different quantiles. I've looked over the documentation for geom_smooth
, and geom_quantile
, and don't see anything relating one to the other. Is this possible? Right now a stripped down version of my plot looks like this:
Here's the code to create it.
ggplot(data = drought3,
aes(x = diff_days, y = spei14d))+
geom_smooth(span = 0.1)+
geom_quantile(quantiles = c(0.2,0.5,0.7,0.9))+
geom_vline(xintercept = 0)+
geom_hline(yintercept = 0)+
theme_bw(10)+
labs(x = "Days till/since fire",
y = "14 Day SPEI")
And here's some sample data (about 10 fires out of my 399).
structure(list(diff_days = c(-49, -49, -49, -49, -49, -49, -49,
-49, -49, -49, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48,
-47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -46, -46, -46,
-46, -46, -46, -46, -46, -46, -46, -45, -45, -45, -45, -45, -45,
-45, -45, -45, -45, -44, -44, -44, -44, -44, -44, -44, -44, -44,
-44, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -42, -42,
-42, -42, -42, -42, -42, -42, -42, -42, -41, -41, -41, -41, -41,
-41, -41, -41, -41, -41, -40, -40, -40, -40, -40, -40, -40, -40,
-40, -40, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -38,
-38, -38, -38, -38, -38, -38, -38, -38, -38, -37, -37, -37, -37,
-37, -37, -37, -37, -37, -37, -36, -36, -36, -36, -36, -36, -36,
-36, -36, -36, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -33, -33, -33,
-33, -33, -33, -33, -33, -33, -33, -32, -32, -32, -32, -32, -32,
-32, -32, -32, -32, -31, -31, -31, -31, -31, -31, -31, -31, -31,
-31, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -29, -29,
-29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28,
-28, -28, -28, -28, -28, -27, -27, -27, -27, -27, -27, -27, -27,
-27, -27, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -23, -23, -23, -23, -23, -23, -23,
-23, -23, -23, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22,
-21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -20, -20, -20,
-20, -20, -20, -20, -20, -20, -20, -19, -19, -19, -19, -19, -19,
-19, -19, -19, -19, -18, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -16, -16,
-16, -16, -16, -16, -16, -16, -16, -16, -15, -15, -15, -15, -15,
-15, -15, -15, -15, -15, -14, -14, -14, -14, -14, -14, -14, -14,
-14, -14, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -12,
-12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -11, -11, -11,
-11, -11, -11, -11, -11, -11, -10, -10, -10, -10, -10, -10, -10,
-10, -10, -10, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8,
-8, -8, -8, -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7,
-7, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5,
-5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37,
37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44,
44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49), spei14d = c(-1.69000005722046,
-0.811219203758178, -0.46000000834465, -0.992645950939344, 0.480137197209931,
0.239999994635582, 0.319999992847443, 0.081293444126801, -0.43774733383111,
2.08999991416931, 0.0842905125601223, 0.727154719448018, 0.372192969120908,
-1.27999997138977, -1.52379684205999, -1.45000004768372, 0.701203443580892,
-0.801965666256297, -2.08999991416931, -0.922905455244348, 0.554863375985872,
-0.899999976158142, -0.921034205084045, 0.22235028207671, -1.27999997138977,
-0.191171079054627, -0.620000004768372, -1.27999997138977, 0.319999992847443,
0.256744179684062, -0.239999994635582, -0.516524758691481, 0.0299999993294477,
-0.411032553994378, -0.539569748624948, -0.18516886616112, 0.446381573883915,
0.640398811378366, -0.389999985694885, -0.800000011920929, -1.60603115347658,
0.381357679900069, -1.00999999046326, 0.781996125097187, 0.306382127146863,
0.210153843316582, 0.100000001490116, 0.737539561100032, 0.762423325122289,
0.0689926661132017, 1.12999999523163, 0.0325697497758746, 1.45000004768372,
-0.606920297352084, -1.69000005722046, 1.40421618294746, -1.69000005722046,
0.269222322466833, 0.197280667796409, -0.665185202051092, -0.46000000834465,
0.47960157671782, -1.39772729695162, -0.742016151646878, -1.45000004768372,
-1.27999997138977, -0.100000001490116, -1.45000004768372, -0.867812917517829,
1.31156328972381, -1.19793720389695, -0.100000001490116, 0.389999985694885,
-0.666796569078594, -1.00999999046326, -0.442273076598104, -1.56793976607519,
0.719507324560058, -1.27999997138977, -0.899999976158142, 0.337844750677346,
-0.800000011920929, -1.12999999523163, 0.343706685187267, -0.528671854226164,
0.0299999993294477, 0.401841447982572, -0.878850389027648, -2.08999991416931,
0.626177880960779, -0.460306515867226, 0.800000011920929, 1.45000004768372,
-2.08596368123599, 0.166181819953702, -0.545834896212284, -1.00999999046326,
-0.896894954437535, -0.939531760100972, 0.403229963082522, 0.159485874406213,
-0.620000004768372, 0.4519038725996, -0.189113745402183, -0.800000011920929,
1.27999997138977, 0.30447660728393, -1.00999999046326, -1.27999997138977,
-0.9850927229274, 0.392472590124322, 0.170000001788139, 0.00779255276384057,
-0.392741103333092, 0.970952366337632, -0.254212906160144, -0.538284860380211,
0.783254786754568, 0.310556485469989, -0.100000001490116, -0.335438589815209,
-0.110579375650298, -0.859735129839075, -0.72208801914284, 0.570972234654574,
-0.18109004804833, 0.712006668249766, 0.0420449994774776, -0.170000001788139,
-0.688781393819459, 1.15368458259545, -0.559692325041844, 2.08999991416931,
-0.273452249921444, -0.0299999993294477, 1.36023463636549, 1.07171427862985,
-0.0299999993294477, 0.0588042750524117, 1.69000005722046, 1.27999997138977,
1.12999999523163, 1.12999999523163, 1.33947281521389, 0.100000001490116,
-0.332348872866894, -0.351454535087982, 2.07968000041934, 0.893914569081785,
-1.00728728974057, -1.00540403026961, 0.11227430644471, -0.709999978542328,
0.131976626926988, -0.539934917275483, 1.45000004768372, 0.663649154257372,
2.08574326467439, -0.491881011658118, -0.170000001788139, -0.11687777863298,
-0.450398430434738, 1.27999997138977, -1.69000005722046, -0.13650113031369,
-0.19993458581039, -0.663333343578131, 0.317312276298535, 2.08999991416931,
-0.899999976158142, 1.27999997138977, -1.13001623954354, -0.620000004768372,
-0.979151217289913, 1.69000005722046, 2.08999991416931, 0.899999976158142,
0.0299999993294477, 0.80222966552711, -0.94083977781371, 2.08999991416931,
-0.709999978542328, -0.314217372726894, -0.899999976158142, -0.170000001788139,
-0.0299999993294477, 0.899999976158142, 1.27999997138977, -1.00999999046326,
-0.103224720604969, -1.27999997138977, 1.10066666073269, -0.464923086074682,
1.12454769238339, 0.709999978542328, -1.45000004768372, 0.281318287684552,
-1.005495457211, 1.00999999046326, 0.315452189331523, -0.336464779897475,
-0.175648131964351, -0.0963892159155916, -0.0299999993294477,
-1.27999997138977, 0.637302898272439, -0.691037596818229, 1.69000005722046,
0.800000011920929, -0.756666662516417, 0.540571827790028, -0.277510562228339,
-0.709999978542328, -0.709999978542328, -0.800000011920929, -0.989122330059186,
-0.709999978542328, -1.45000004768372, -0.709999978542328, 0.469999998807907,
1.45000004768372, 1.44026501174062, 1.12887835421513, 0.141899642300889,
0.494881108235358, -1.27999997138977, -0.0990813662911572, -0.800000011920929,
0.389999985694885, -1.00999999046326, -0.0305172407247236, -0.319999992847443,
-1.45000004768372, -0.32127520298073, -0.346299547784129, 0.709999978542328,
0.17425185320554, 0.540000021457672, -0.554913712247469, -0.791185246409043,
-1.13531252430187, -0.976105432461755, -0.734193760749354, 0.24726100414031,
1.69000005722046, -2.08999991416931, 0.800000011920929, -0.756839396606003,
-0.106812601225839, -0.899711040965577, -1.45000004768372, -1.17901839811104,
-1.03522792551034, -0.196113474297185, -0.0663127892987494, -0.100000001490116,
-1.45000004768372, -1.00999999046326, -1.22251079296428, -0.889214516943812,
0.629999995231628, -0.63730171398364, -2.08999991416931, -0.389999985694885,
-1.080086539275, 1.21875626253123, -0.170000001788139, 2.08999991416931,
0.288134379376588, -0.9220329625317, 0.380598180786482, -0.0210400995235881,
-0.425544038955412, -0.721226976571151, -0.0299999993294477,
-1.69000005722046, 0.389999985694885, -1.55914081984508, -1.00999999046326,
0.469999998807907, -0.698968705340956, -1.12999999523163, -1.27999997138977,
0.862290164422939, 0.170000001788139, 1.41859683643226, 0.390222620239727,
1.00999999046326, -1.00999999046326, -0.580615390264071, -0.442566441579941,
-0.100000001490116, 0.389999985694885, 0.241230763838841, -0.766827224748921,
0.949428554014726, -0.654075408372047, -1.00999999046326, 0.0945447544081505,
1.26299853937185, -0.319999992847443, 0.899999976158142, 0.850402003946017,
-0.495259502892527, -0.0287564760411805, -0.788796439665704,
-1.2512241785902, -0.899999976158142, -0.589230243205582, -0.800000011920929,
-1.45000004768372, -0.809377690299677, -0.867123516293826, -0.800000011920929,
-0.46000000834465, -2.08999991416931, -0.603676693406582, 0.457925797840596,
-1.14122919862239, -0.0299999993294477, -1.12999999523163, 0.629999995231628,
0.239999994635582, 0.260809561852101, -1.12999999523163, -1.45000004768372,
-0.794688569025499, -1.0457680059443, 0.389999985694885, -0.46000000834465,
0.468994264192238, 0.451096601453525, -0.793641314558361, -1.01998564365776,
0.253791229851665, 0.651309803831798, -0.425066944163112, -0.0864604555942649,
0.469999998807907, -0.540000021457672, -1.00999999046326, -0.0253615378946639,
0.0482963826246516, -0.709999978542328, -0.485812167271725, -0.760646884485441,
-1.27999997138977, -0.895657396287769, 0.629999995231628, -0.702267826657768,
-2.08999991416931, -0.470014509744492, 0.0299999993294477, -0.660919681963525,
-1.45000004768372, -2.08999991416931, 0.230479098681767, -0.720758954404513,
-1.44717099951544, -0.389999985694885, -0.100000001490116, -0.61560518538725,
-0.277266709452863, -0.228847954479924, 0.124188509139781, -0.896835694671659,
-0.538422556410373, 0.800000011920929, -0.0737801879651738, 0.0299999993294477,
-1.2546093504255, -0.476712473943259, 0.327278244414591, 0.321356891226469,
-2.08999991416931, -1.27522792806009, -0.0224155188982232, -0.0960568251489913,
-0.709999978542328, -1.27999997138977, -0.230901029538721, -1.45000004768372,
1.45000004768372, -1.45000004768372, 0.727827477416421, -1.00999999046326,
0.337090530266961, 0.317247304736927, -0.633728164381101, 0.469999998807907,
-1.00999999046326, -1.12999999523163, -0.709999978542328, -1.27999997138977,
0.319999992847443, -2.08999991416931, -1.0519844423352, -0.319999992847443,
0.411725385313295, -0.298648136525335, -0.64605213676962, 0.561169029373518,
-0.170000001788139, -1.12999999523163, -0.620000004768372, 1.45000004768372,
-0.607441393728771, -0.620000004768372, -0.440282120033064, -0.170000001788139,
-1.45000004768372, 0.46329498538348, -0.899999976158142, -1.27999997138977,
0.166792126480989, 0.100000001490116, -0.857057314603284, -1.27999997138977,
-0.462927888264825, -2.08999991416931, 2.08999991416931, -0.398732094859784,
-2.08999991416931, -1.69000005722046, -0.709999978542328, -0.559745836736367,
-0.540000021457672, -0.363462695053646, -0.898233972374703, -1.45000004768372,
0.4576292121674, 0.150088497278588, -0.709999978542328, 0.68888266451199,
-0.379321746684241, -0.170000001788139, -1.27999997138977, -2.08999991416931,
-0.0299999993294477, -0.234940202434013, -2.08999991416931, -0.239999994635582,
-0.709999978542328, -1.25172772457462, -1.26594325352538, -1.87553091268973,
-0.983126736268765, -1.12999999523163, -0.899999976158142, -1.27999997138977,
-1.27999997138977, -0.709999978542328, -1.27999997138977, -1.45000004768372,
-1.12999999523163, -0.800000011920929, -2.08999991416931, -0.389999985694885,
-0.899999976158142, -0.709999978542328, -0.540000021457672, -1.12999999523163,
-1.09991485827627, -1.12999999523163, -1.12999999523163, -2.08999991416931,
-0.418580396952641, -1.69000005722046, -0.845934954842901, -1.69000005722046,
-1.45000004768372, -1.16369073479762, -0.800000011920929, -1.13028230384422,
-0.451865799493368, -1.13181620109011, -0.44865922255223, -0.811162228106867,
-1.45000004768372, -1.1283031387893, -2.08999991416931, -2.08999991416931,
-1.12999999523163, -1.27999997138977, -1.69295572118806, -0.540000021457672,
-0.648754900194465, -1.27999997138977, -2.08999991416931, -1.69000005722046,
-1.00999999046326, -1.69000005722046, -1.7094079450165, -0.389999985694885,
-1.00999999046326, -2.08999991416931, -1.27999997138977, -2.08999991416931,
-2.08999991416931, -2.08999991416931, -1.12999999523163, -1.24682877043651,
-1.66492542935841, -1.3066870373931, -2.08999991416931, -0.398635812925698,
-0.319999992847443, 0.209147945115679, -0.899999976158142, -1.05229542114101,
-1.69000005722046, -2.08999991416931, -2.08999991416931, -1.83937798310346,
-1.69000005722046, -1.12999999523163, -2.08999991416931, -0.922328764633585,
-1.69000005722046, 1.69000005722046, -1.03543669412368, -2.08999991416931,
-1.45000004768372, -0.709999978542328, -2.08999991416931, -2.08999991416931,
-2.08999991416931, -1.45000004768372, -1.30810145699646, -2.08999991416931,
-2.08999991416931, 0.641007538430171, -1.95424621370522, 0.170000001788139,
-1.12999999523163, -1.4098303168623, -1.39798071333557, -0.899999976158142,
-0.451001724636616, -2.08841261314967, -2.08999991416931, -2.08999991416931,
-1.69000005722046, -2.08999991416931, -1.69000005722046, 0.129362003193793,
-2.08999991416931, -2.08999991416931, -2.08999991416931, -1.36326977654374,
0.465720446769074, -0.899999976158142, -0.709999978542328, -1.27999997138977,
-2.08999991416931, 1.12706121960465, -1.69000005722046, 0.851851845229114,
0.709999978542328, -2.08999991416931, -2.08999991416931, -1.69000005722046,
-1.69000005722046, -0.100000001490116, -1.45000004768372, -2.08999991416931,
-1.00999999046326, -1.12999999523163, -2.08999991416931, -2.08999991416931,
-2.08999991416931, -1.69000005722046, -2.08999991416931, -1.07609480121604,
-2.08999991416931, 0.319999992847443, -2.08999991416931, -1.27999997138977,
-2.08999991416931, -1.69000005722046, 1.69000005722046, 0.307797181019643,
-0.610467756633862, -2.08999991416931, -0.332294708866042, 1.27999997138977,
0.53007662581758, -1.69000005722046, 0.494191859460848, 0.629999995231628,
-2.08999991416931, 0.800000011920929, -2.08999991416931, -2.08999991416931,
-1.71358106709141, -2.08999991416931, -2.08999991416931, -0.977285115813168,
-1.81324276053677, -0.23797687345502, -2.08999991416931, -0.620000004768372,
-1.69000005722046, 0.800000011920929, 1.27999997138977, -1.69000005722046,
-0.239999994635582, -0.709999978542328, -0.800000011920929, -1.12999999523163,
-2.08999991416931, -1.93868279230984, -1.27999997138977, -1.69000005722046,
1.12999999523163, 0.00102865192627979, -0.170000001788139, -1.6776037823841,
-2.02174202735873, 0.540000021457672, -0.100000001490116, 0.801691235410029,
-0.514750920274871, -0.934292147676629, -0.446210794347143, 0.893244928068886,
-0.239999994635582, -2.08973714533571, -0.660766871489874, -2.04682274020131,
1.45000004768372, -0.800000011920929, -1.00999999046326, 0.732872406721274,
-1.69000005722046, -1.12999999523163, -2.07491476141333, -1.27999997138977,
-2.08999991416931, 1.27999997138977, 1.04084256898409, -1.72837957441171,
-1.00999999046326, 0.00604075677909792, -1.45000004768372, -1.69000005722046,
-1.36488112836451, -2.08999991416931, -0.620000004768372, -0.00233045683624785,
0.319999992847443, 0.169200150777587, -0.31107651704171, 0.271673830758248,
-0.433913043382005, 1.00999999046326, 0.469999998807907, -0.0355576175920805,
-1.37148685455322, 0.0427033318802541, -0.899999976158142, 0.115030303784521,
-1.69000005722046, -0.100652682145576, 0.899999976158142, -1.45000004768372,
-1.12999999523163, 0.322959128289561, 1.69000005722046, -0.389924965639154,
0.899999976158142, 0.487659747493856, 1.00999999046326, 0.833258928598038,
0.721710841471432, -0.540000021457672, -1.45000004768372, -1.46168004814784,
-0.800000011920929, -1.80615722091958, -1.45583946397415, 0.938015749827321,
0.179260982754003, -0.190126957495636, -1.45000004768372, 0.170000001788139,
-2.08999991416931, -0.386046855096125, 0.533415655957328, -0.540000021457672,
0.0177188652019796, -0.319999992847443, 0.170000001788139, -0.949612738874345,
1.05490210801444, -0.609756177796092, 1.00999999046326, 0.0987166680954397,
0.545116299036553, 1.69000005722046, 0.100000001490116, 0.657292578556654,
1.68368185780877, -0.000678336965144333, -1.69000005722046, 1.13166017577187,
0.0325697497758746, 0.100000001490116, -0.394686156946933, -0.709999978542328,
-2.08999991416931, 0.749304797480451, 0.319999992847443, 0.629999995231628,
0.629999995231628, -0.381736917399234, -0.655115122370788, 0.899917806918834,
-0.620000004768372, 0.538716237258497, 1.27999997138977, 1.12999999523163,
0.202368837594592, 0.540000021457672, 0.488356587544892, 0.16995653702488,
1.00999999046326, -0.527325679502055, 1.09645594290501, 0.170000001788139,
0.375627756735071, 2.08999991416931, -1.00999999046326, -0.794365826452049,
-1.27999997138977, -1.69000005722046, 1.27999997138977, 0.473239441588925,
-0.319999992847443, -0.899999976158142, -1.45000004768372, -0.850562341026688,
-0.800000011920929, -0.899999976158142, -0.540000021457672, -1.58847958535014,
0.389999985694885, 0.105442430243387, -0.859516676481903, -1.67523082586435,
-1.00999999046326, -0.166389216309695, 2.08999991416931, 0.372062996696166,
0.504699754992743, 0.496937180298785, 1.00999999046326, -0.339328350771719,
0.957900164519684, 0.239999994635582, 0.176598601138856, -0.100000001490116,
-0.389999985694885, -1.45000004768372, 0.899999976158142, -0.455922975555279,
-2.08999991416931, 0.263962842397184, 0.116409966871902, 0.182873560506422,
0.718126392391412, 0.0937564011429301, 0.469999998807907, -0.736599988407559,
-1.69000005722046, -1.12999999523163, 0.239999994635582, 0.263181294111732,
-1.00999999046326, 0.596369138003481, 1.45000004768372, 1.30074268626914,
1.23571426414308, -1.69000005722046, -0.245027080113684, 1.45000004768372,
-0.239999994635582, 0.389999985694885, 1.45000004768372, -0.417469985349687,
-0.939030282425158, 2.08999991416931, -1.12999999523163, -1.16628471248566,
0.0656820628151826, -1.00999999046326, 0.688577569218288, 0.232065992576833,
-0.426246572765586, 0.683783560373741, 0.286841934180129, -2.08999991416931,
-1.69000005722046, -1.36594049069136, 2.08999991416931, 0.239999994635582,
1.69000005722046, -0.425000000039825, 0.660863712401399, -0.211897587868515,
0.395522831831701, 1.69000005722046, 0.430865259861408, 1.37698017403451,
1.4413239902174, 1.27999997138977, 0.358462632430353, 1.00999999046326,
-0.170000001788139, -0.302293417174338, -0.105006623761543, 0.100000001490116,
0.899999976158142, -0.398607877111214, 1.45000004768372, 0.166020065230404,
0.469999998807907, -0.321714635169103, 0.779910694674722, -0.319999992847443,
0.899999976158142, 1.27999997138977, -0.389999985694885, 0.243886035801202,
-1.00999999046326, 0.319999992847443, -0.742050604004358, 0.100000001490116,
2.08999991416931, 0.239999994635582, 2.08999991416931, 0.319999992847443,
0.187951153278189, 0.314290680529451, 2.08999991416931, -0.0244502627939298,
1.69000005722046, 0.652601830201143, 0.389999985694885, -0.616952769151027,
-0.899999976158142, 1.45000004768372, 0.554042677351191, 0.699139475282552,
0.239999994635582, -0.461875741360196, 0.159131580544636, 2.08999991416931,
-0.251369958482667, 1.12999999523163, 2.08999991416931, -0.384846367666455,
-0.800000011920929, 0.0748000007122755, -0.293028536156198, -0.100000001490116,
0.559896491956335, 0.536384440270851, 0.624262875256518, -1.24801125714742,
1.12999999523163, -0.238620935965415, 1.91507713041675, 1.69000005722046,
-1.45000004768372, -0.032846521479825, 0.627047869277761, 0.209782062016263,
0.272268156153561, -0.044301074278611, 0.179260982754003, -1.00378792665117,
2.08999991416931, 2.08999991416931, -0.459622127536438, 0.171350739448079,
0.42885713492121, -0.249147630929654, -0.620000004768372, 2.08999991416931,
1.01561841991151, 0.170000001788139, -0.46000000834465, 1.69000005722046,
-1.12999999523163, 0.878630040392184, -0.354165766654509, -1.69000005722046,
-0.184971231695423, 0.100000001490116, 0.0673993807912123, -0.317404696879499,
1.00999999046326, 0.100000001490116, -0.604000008106232, 0.170000001788139,
0.467361110620774, -2.05348540440635, 2.08999991416931, -1.00999999046326,
-0.0299999993294477, -0.345194293446646, 0.25012490516809, 0.242346604044907,
0.54098000009729, -0.620000004768372, -0.0710693647589728, -0.605970495776881,
0.319999992847443, 0.739990688814505, 0.159975469334588, 1.45000004768372,
-1.27999997138977, -2.08999991416931, 0.496728715222974, -1.69000005722046,
0.899999976158142, 1.27999997138977, 0.319999992847443, 0.468449872184824,
0.319999992847443, 1.05885828422011, -0.709999978542328, 0.203876025212443,
0.30008711214754, 2.08999991416931, 1.06630708200095, 2.08999991416931,
0.800000011920929, 1.27999997138977, 0.542264672489192, -1.00999999046326,
-0.256443713224975, -0.393138777127894, 2.08999991416931, 0.270038308140419,
0.432330432264314, 0.170000001788139, -0.587828953554364, 0.469066665321589,
0.096774117913944, 2.08999991416931, 0.392073655884718, -0.899999976158142,
0.196113474297185, -1.69000005722046, -2.08999991416931, -1.00999999046326,
-0.322569742951974, 0.0511938622590812, 1.27999997138977, 0.239999994635582,
-0.620000004768372, 0.206122447317341, 1.45048723369648, -1.45000004768372,
-1.69000005722046, 1.57975615040074, 0.639407959705533, 2.08999991416931,
0.381825500114594, -1.45000004768372, -0.239999994635582, -1.69000005722046,
0.469999998807907, -0.63675652895038, -0.378741970942428, -1.74985897478901,
0.166028003340797, 0.849405953712329, 0.709999978542328, -1.69000005722046,
-1.01828570025308, 1.12999999523163, -2.08999991416931, -1.69000005722046,
2.08999991416931, -1.69000005722046, -0.898779534184233, -1.27999997138977
)), class = c("grouped_df", "tbl_df", "tbl", "data.frame"), row.names = c(NA,
-990L), groups = structure(list(diff_days = c(-49, -48, -47,
-46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34,
-33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21,
-20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8,
-7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49), .rows = structure(list(1:10, 11:20,
21:30, 31:40, 41:50, 51:60, 61:70, 71:80, 81:90, 91:100,
101:110, 111:120, 121:130, 131:140, 141:150, 151:160, 161:170,
171:180, 181:190, 191:200, 201:210, 211:220, 221:230, 231:240,
241:250, 251:260, 261:270, 271:280, 281:290, 291:300, 301:310,
311:320, 321:330, 331:340, 341:350, 351:360, 361:370, 371:380,
381:390, 391:400, 401:410, 411:420, 421:430, 431:440, 441:450,
451:460, 461:470, 471:480, 481:490, 491:500, 501:510, 511:520,
521:530, 531:540, 541:550, 551:560, 561:570, 571:580, 581:590,
591:600, 601:610, 611:620, 621:630, 631:640, 641:650, 651:660,
661:670, 671:680, 681:690, 691:700, 701:710, 711:720, 721:730,
731:740, 741:750, 751:760, 761:770, 771:780, 781:790, 791:800,
801:810, 811:820, 821:830, 831:840, 841:850, 851:860, 861:870,
871:880, 881:890, 891:900, 901:910, 911:920, 921:930, 931:940,
941:950, 951:960, 961:970, 971:980, 981:990), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -99L), .drop = TRUE, class = c("tbl_df",
"tbl", "data.frame")))
I am depicting the 14 day spei conditions leading up to and following wildfires. I'm looking for trends in variability or dips. In my study region, n = 399. As one could expect, there is a lot of variability.
geom_smooth
oversimplifies the data and effectively drives the trend to the zero line, while geom_quantile
misses the very non-linear trends and dips I am seeking. I wish there was a way to do multiple smoother lines representing the smoother weighted by different quantiles. I've looked over the documentation for geom_smooth
, and geom_quantile
, and don't see anything relating one to the other. Is this possible? Right now a stripped down version of my plot looks like this:
Here's the code to create it.
ggplot(data = drought3,
aes(x = diff_days, y = spei14d))+
geom_smooth(span = 0.1)+
geom_quantile(quantiles = c(0.2,0.5,0.7,0.9))+
geom_vline(xintercept = 0)+
geom_hline(yintercept = 0)+
theme_bw(10)+
labs(x = "Days till/since fire",
y = "14 Day SPEI")
And here's some sample data (about 10 fires out of my 399).
structure(list(diff_days = c(-49, -49, -49, -49, -49, -49, -49,
-49, -49, -49, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48,
-47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -46, -46, -46,
-46, -46, -46, -46, -46, -46, -46, -45, -45, -45, -45, -45, -45,
-45, -45, -45, -45, -44, -44, -44, -44, -44, -44, -44, -44, -44,
-44, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -42, -42,
-42, -42, -42, -42, -42, -42, -42, -42, -41, -41, -41, -41, -41,
-41, -41, -41, -41, -41, -40, -40, -40, -40, -40, -40, -40, -40,
-40, -40, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -38,
-38, -38, -38, -38, -38, -38, -38, -38, -38, -37, -37, -37, -37,
-37, -37, -37, -37, -37, -37, -36, -36, -36, -36, -36, -36, -36,
-36, -36, -36, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35,
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -33, -33, -33,
-33, -33, -33, -33, -33, -33, -33, -32, -32, -32, -32, -32, -32,
-32, -32, -32, -32, -31, -31, -31, -31, -31, -31, -31, -31, -31,
-31, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -29, -29,
-29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28,
-28, -28, -28, -28, -28, -27, -27, -27, -27, -27, -27, -27, -27,
-27, -27, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -25,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -23, -23, -23, -23, -23, -23, -23,
-23, -23, -23, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22,
-21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -20, -20, -20,
-20, -20, -20, -20, -20, -20, -20, -19, -19, -19, -19, -19, -19,
-19, -19, -19, -19, -18, -18, -18, -18, -18, -18, -18, -18, -18,
-18, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -16, -16,
-16, -16, -16, -16, -16, -16, -16, -16, -15, -15, -15, -15, -15,
-15, -15, -15, -15, -15, -14, -14, -14, -14, -14, -14, -14, -14,
-14, -14, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -12,
-12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -11, -11, -11,
-11, -11, -11, -11, -11, -11, -10, -10, -10, -10, -10, -10, -10,
-10, -10, -10, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8,
-8, -8, -8, -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7,
-7, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5,
-5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34,
34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37,
37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44,
44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49), spei14d = c(-1.69000005722046,
-0.811219203758178, -0.46000000834465, -0.992645950939344, 0.480137197209931,
0.239999994635582, 0.319999992847443, 0.081293444126801, -0.43774733383111,
2.08999991416931, 0.0842905125601223, 0.727154719448018, 0.372192969120908,
-1.27999997138977, -1.52379684205999, -1.45000004768372, 0.701203443580892,
-0.801965666256297, -2.08999991416931, -0.922905455244348, 0.554863375985872,
-0.899999976158142, -0.921034205084045, 0.22235028207671, -1.27999997138977,
-0.191171079054627, -0.620000004768372, -1.27999997138977, 0.319999992847443,
0.256744179684062, -0.239999994635582, -0.516524758691481, 0.0299999993294477,
-0.411032553994378, -0.539569748624948, -0.18516886616112, 0.446381573883915,
0.640398811378366, -0.389999985694885, -0.800000011920929, -1.60603115347658,
0.381357679900069, -1.00999999046326, 0.781996125097187, 0.306382127146863,
0.210153843316582, 0.100000001490116, 0.737539561100032, 0.762423325122289,
0.0689926661132017, 1.12999999523163, 0.0325697497758746, 1.45000004768372,
-0.606920297352084, -1.69000005722046, 1.40421618294746, -1.69000005722046,
0.269222322466833, 0.197280667796409, -0.665185202051092, -0.46000000834465,
0.47960157671782, -1.39772729695162, -0.742016151646878, -1.45000004768372,
-1.27999997138977, -0.100000001490116, -1.45000004768372, -0.867812917517829,
1.31156328972381, -1.19793720389695, -0.100000001490116, 0.389999985694885,
-0.666796569078594, -1.00999999046326, -0.442273076598104, -1.56793976607519,
0.719507324560058, -1.27999997138977, -0.899999976158142, 0.337844750677346,
-0.800000011920929, -1.12999999523163, 0.343706685187267, -0.528671854226164,
0.0299999993294477, 0.401841447982572, -0.878850389027648, -2.08999991416931,
0.626177880960779, -0.460306515867226, 0.800000011920929, 1.45000004768372,
-2.08596368123599, 0.166181819953702, -0.545834896212284, -1.00999999046326,
-0.896894954437535, -0.939531760100972, 0.403229963082522, 0.159485874406213,
-0.620000004768372, 0.4519038725996, -0.189113745402183, -0.800000011920929,
1.27999997138977, 0.30447660728393, -1.00999999046326, -1.27999997138977,
-0.9850927229274, 0.392472590124322, 0.170000001788139, 0.00779255276384057,
-0.392741103333092, 0.970952366337632, -0.254212906160144, -0.538284860380211,
0.783254786754568, 0.310556485469989, -0.100000001490116, -0.335438589815209,
-0.110579375650298, -0.859735129839075, -0.72208801914284, 0.570972234654574,
-0.18109004804833, 0.712006668249766, 0.0420449994774776, -0.170000001788139,
-0.688781393819459, 1.15368458259545, -0.559692325041844, 2.08999991416931,
-0.273452249921444, -0.0299999993294477, 1.36023463636549, 1.07171427862985,
-0.0299999993294477, 0.0588042750524117, 1.69000005722046, 1.27999997138977,
1.12999999523163, 1.12999999523163, 1.33947281521389, 0.100000001490116,
-0.332348872866894, -0.351454535087982, 2.07968000041934, 0.893914569081785,
-1.00728728974057, -1.00540403026961, 0.11227430644471, -0.709999978542328,
0.131976626926988, -0.539934917275483, 1.45000004768372, 0.663649154257372,
2.08574326467439, -0.491881011658118, -0.170000001788139, -0.11687777863298,
-0.450398430434738, 1.27999997138977, -1.69000005722046, -0.13650113031369,
-0.19993458581039, -0.663333343578131, 0.317312276298535, 2.08999991416931,
-0.899999976158142, 1.27999997138977, -1.13001623954354, -0.620000004768372,
-0.979151217289913, 1.69000005722046, 2.08999991416931, 0.899999976158142,
0.0299999993294477, 0.80222966552711, -0.94083977781371, 2.08999991416931,
-0.709999978542328, -0.314217372726894, -0.899999976158142, -0.170000001788139,
-0.0299999993294477, 0.899999976158142, 1.27999997138977, -1.00999999046326,
-0.103224720604969, -1.27999997138977, 1.10066666073269, -0.464923086074682,
1.12454769238339, 0.709999978542328, -1.45000004768372, 0.281318287684552,
-1.005495457211, 1.00999999046326, 0.315452189331523, -0.336464779897475,
-0.175648131964351, -0.0963892159155916, -0.0299999993294477,
-1.27999997138977, 0.637302898272439, -0.691037596818229, 1.69000005722046,
0.800000011920929, -0.756666662516417, 0.540571827790028, -0.277510562228339,
-0.709999978542328, -0.709999978542328, -0.800000011920929, -0.989122330059186,
-0.709999978542328, -1.45000004768372, -0.709999978542328, 0.469999998807907,
1.45000004768372, 1.44026501174062, 1.12887835421513, 0.141899642300889,
0.494881108235358, -1.27999997138977, -0.0990813662911572, -0.800000011920929,
0.389999985694885, -1.00999999046326, -0.0305172407247236, -0.319999992847443,
-1.45000004768372, -0.32127520298073, -0.346299547784129, 0.709999978542328,
0.17425185320554, 0.540000021457672, -0.554913712247469, -0.791185246409043,
-1.13531252430187, -0.976105432461755, -0.734193760749354, 0.24726100414031,
1.69000005722046, -2.08999991416931, 0.800000011920929, -0.756839396606003,
-0.106812601225839, -0.899711040965577, -1.45000004768372, -1.17901839811104,
-1.03522792551034, -0.196113474297185, -0.0663127892987494, -0.100000001490116,
-1.45000004768372, -1.00999999046326, -1.22251079296428, -0.889214516943812,
0.629999995231628, -0.63730171398364, -2.08999991416931, -0.389999985694885,
-1.080086539275, 1.21875626253123, -0.170000001788139, 2.08999991416931,
0.288134379376588, -0.9220329625317, 0.380598180786482, -0.0210400995235881,
-0.425544038955412, -0.721226976571151, -0.0299999993294477,
-1.69000005722046, 0.389999985694885, -1.55914081984508, -1.00999999046326,
0.469999998807907, -0.698968705340956, -1.12999999523163, -1.27999997138977,
0.862290164422939, 0.170000001788139, 1.41859683643226, 0.390222620239727,
1.00999999046326, -1.00999999046326, -0.580615390264071, -0.442566441579941,
-0.100000001490116, 0.389999985694885, 0.241230763838841, -0.766827224748921,
0.949428554014726, -0.654075408372047, -1.00999999046326, 0.0945447544081505,
1.26299853937185, -0.319999992847443, 0.899999976158142, 0.850402003946017,
-0.495259502892527, -0.0287564760411805, -0.788796439665704,
-1.2512241785902, -0.899999976158142, -0.589230243205582, -0.800000011920929,
-1.45000004768372, -0.809377690299677, -0.867123516293826, -0.800000011920929,
-0.46000000834465, -2.08999991416931, -0.603676693406582, 0.457925797840596,
-1.14122919862239, -0.0299999993294477, -1.12999999523163, 0.629999995231628,
0.239999994635582, 0.260809561852101, -1.12999999523163, -1.45000004768372,
-0.794688569025499, -1.0457680059443, 0.389999985694885, -0.46000000834465,
0.468994264192238, 0.451096601453525, -0.793641314558361, -1.01998564365776,
0.253791229851665, 0.651309803831798, -0.425066944163112, -0.0864604555942649,
0.469999998807907, -0.540000021457672, -1.00999999046326, -0.0253615378946639,
0.0482963826246516, -0.709999978542328, -0.485812167271725, -0.760646884485441,
-1.27999997138977, -0.895657396287769, 0.629999995231628, -0.702267826657768,
-2.08999991416931, -0.470014509744492, 0.0299999993294477, -0.660919681963525,
-1.45000004768372, -2.08999991416931, 0.230479098681767, -0.720758954404513,
-1.44717099951544, -0.389999985694885, -0.100000001490116, -0.61560518538725,
-0.277266709452863, -0.228847954479924, 0.124188509139781, -0.896835694671659,
-0.538422556410373, 0.800000011920929, -0.0737801879651738, 0.0299999993294477,
-1.2546093504255, -0.476712473943259, 0.327278244414591, 0.321356891226469,
-2.08999991416931, -1.27522792806009, -0.0224155188982232, -0.0960568251489913,
-0.709999978542328, -1.27999997138977, -0.230901029538721, -1.45000004768372,
1.45000004768372, -1.45000004768372, 0.727827477416421, -1.00999999046326,
0.337090530266961, 0.317247304736927, -0.633728164381101, 0.469999998807907,
-1.00999999046326, -1.12999999523163, -0.709999978542328, -1.27999997138977,
0.319999992847443, -2.08999991416931, -1.0519844423352, -0.319999992847443,
0.411725385313295, -0.298648136525335, -0.64605213676962, 0.561169029373518,
-0.170000001788139, -1.12999999523163, -0.620000004768372, 1.45000004768372,
-0.607441393728771, -0.620000004768372, -0.440282120033064, -0.170000001788139,
-1.45000004768372, 0.46329498538348, -0.899999976158142, -1.27999997138977,
0.166792126480989, 0.100000001490116, -0.857057314603284, -1.27999997138977,
-0.462927888264825, -2.08999991416931, 2.08999991416931, -0.398732094859784,
-2.08999991416931, -1.69000005722046, -0.709999978542328, -0.559745836736367,
-0.540000021457672, -0.363462695053646, -0.898233972374703, -1.45000004768372,
0.4576292121674, 0.150088497278588, -0.709999978542328, 0.68888266451199,
-0.379321746684241, -0.170000001788139, -1.27999997138977, -2.08999991416931,
-0.0299999993294477, -0.234940202434013, -2.08999991416931, -0.239999994635582,
-0.709999978542328, -1.25172772457462, -1.26594325352538, -1.87553091268973,
-0.983126736268765, -1.12999999523163, -0.899999976158142, -1.27999997138977,
-1.27999997138977, -0.709999978542328, -1.27999997138977, -1.45000004768372,
-1.12999999523163, -0.800000011920929, -2.08999991416931, -0.389999985694885,
-0.899999976158142, -0.709999978542328, -0.540000021457672, -1.12999999523163,
-1.09991485827627, -1.12999999523163, -1.12999999523163, -2.08999991416931,
-0.418580396952641, -1.69000005722046, -0.845934954842901, -1.69000005722046,
-1.45000004768372, -1.16369073479762, -0.800000011920929, -1.13028230384422,
-0.451865799493368, -1.13181620109011, -0.44865922255223, -0.811162228106867,
-1.45000004768372, -1.1283031387893, -2.08999991416931, -2.08999991416931,
-1.12999999523163, -1.27999997138977, -1.69295572118806, -0.540000021457672,
-0.648754900194465, -1.27999997138977, -2.08999991416931, -1.69000005722046,
-1.00999999046326, -1.69000005722046, -1.7094079450165, -0.389999985694885,
-1.00999999046326, -2.08999991416931, -1.27999997138977, -2.08999991416931,
-2.08999991416931, -2.08999991416931, -1.12999999523163, -1.24682877043651,
-1.66492542935841, -1.3066870373931, -2.08999991416931, -0.398635812925698,
-0.319999992847443, 0.209147945115679, -0.899999976158142, -1.05229542114101,
-1.69000005722046, -2.08999991416931, -2.08999991416931, -1.83937798310346,
-1.69000005722046, -1.12999999523163, -2.08999991416931, -0.922328764633585,
-1.69000005722046, 1.69000005722046, -1.03543669412368, -2.08999991416931,
-1.45000004768372, -0.709999978542328, -2.08999991416931, -2.08999991416931,
-2.08999991416931, -1.45000004768372, -1.30810145699646, -2.08999991416931,
-2.08999991416931, 0.641007538430171, -1.95424621370522, 0.170000001788139,
-1.12999999523163, -1.4098303168623, -1.39798071333557, -0.899999976158142,
-0.451001724636616, -2.08841261314967, -2.08999991416931, -2.08999991416931,
-1.69000005722046, -2.08999991416931, -1.69000005722046, 0.129362003193793,
-2.08999991416931, -2.08999991416931, -2.08999991416931, -1.36326977654374,
0.465720446769074, -0.899999976158142, -0.709999978542328, -1.27999997138977,
-2.08999991416931, 1.12706121960465, -1.69000005722046, 0.851851845229114,
0.709999978542328, -2.08999991416931, -2.08999991416931, -1.69000005722046,
-1.69000005722046, -0.100000001490116, -1.45000004768372, -2.08999991416931,
-1.00999999046326, -1.12999999523163, -2.08999991416931, -2.08999991416931,
-2.08999991416931, -1.69000005722046, -2.08999991416931, -1.07609480121604,
-2.08999991416931, 0.319999992847443, -2.08999991416931, -1.27999997138977,
-2.08999991416931, -1.69000005722046, 1.69000005722046, 0.307797181019643,
-0.610467756633862, -2.08999991416931, -0.332294708866042, 1.27999997138977,
0.53007662581758, -1.69000005722046, 0.494191859460848, 0.629999995231628,
-2.08999991416931, 0.800000011920929, -2.08999991416931, -2.08999991416931,
-1.71358106709141, -2.08999991416931, -2.08999991416931, -0.977285115813168,
-1.81324276053677, -0.23797687345502, -2.08999991416931, -0.620000004768372,
-1.69000005722046, 0.800000011920929, 1.27999997138977, -1.69000005722046,
-0.239999994635582, -0.709999978542328, -0.800000011920929, -1.12999999523163,
-2.08999991416931, -1.93868279230984, -1.27999997138977, -1.69000005722046,
1.12999999523163, 0.00102865192627979, -0.170000001788139, -1.6776037823841,
-2.02174202735873, 0.540000021457672, -0.100000001490116, 0.801691235410029,
-0.514750920274871, -0.934292147676629, -0.446210794347143, 0.893244928068886,
-0.239999994635582, -2.08973714533571, -0.660766871489874, -2.04682274020131,
1.45000004768372, -0.800000011920929, -1.00999999046326, 0.732872406721274,
-1.69000005722046, -1.12999999523163, -2.07491476141333, -1.27999997138977,
-2.08999991416931, 1.27999997138977, 1.04084256898409, -1.72837957441171,
-1.00999999046326, 0.00604075677909792, -1.45000004768372, -1.69000005722046,
-1.36488112836451, -2.08999991416931, -0.620000004768372, -0.00233045683624785,
0.319999992847443, 0.169200150777587, -0.31107651704171, 0.271673830758248,
-0.433913043382005, 1.00999999046326, 0.469999998807907, -0.0355576175920805,
-1.37148685455322, 0.0427033318802541, -0.899999976158142, 0.115030303784521,
-1.69000005722046, -0.100652682145576, 0.899999976158142, -1.45000004768372,
-1.12999999523163, 0.322959128289561, 1.69000005722046, -0.389924965639154,
0.899999976158142, 0.487659747493856, 1.00999999046326, 0.833258928598038,
0.721710841471432, -0.540000021457672, -1.45000004768372, -1.46168004814784,
-0.800000011920929, -1.80615722091958, -1.45583946397415, 0.938015749827321,
0.179260982754003, -0.190126957495636, -1.45000004768372, 0.170000001788139,
-2.08999991416931, -0.386046855096125, 0.533415655957328, -0.540000021457672,
0.0177188652019796, -0.319999992847443, 0.170000001788139, -0.949612738874345,
1.05490210801444, -0.609756177796092, 1.00999999046326, 0.0987166680954397,
0.545116299036553, 1.69000005722046, 0.100000001490116, 0.657292578556654,
1.68368185780877, -0.000678336965144333, -1.69000005722046, 1.13166017577187,
0.0325697497758746, 0.100000001490116, -0.394686156946933, -0.709999978542328,
-2.08999991416931, 0.749304797480451, 0.319999992847443, 0.629999995231628,
0.629999995231628, -0.381736917399234, -0.655115122370788, 0.899917806918834,
-0.620000004768372, 0.538716237258497, 1.27999997138977, 1.12999999523163,
0.202368837594592, 0.540000021457672, 0.488356587544892, 0.16995653702488,
1.00999999046326, -0.527325679502055, 1.09645594290501, 0.170000001788139,
0.375627756735071, 2.08999991416931, -1.00999999046326, -0.794365826452049,
-1.27999997138977, -1.69000005722046, 1.27999997138977, 0.473239441588925,
-0.319999992847443, -0.899999976158142, -1.45000004768372, -0.850562341026688,
-0.800000011920929, -0.899999976158142, -0.540000021457672, -1.58847958535014,
0.389999985694885, 0.105442430243387, -0.859516676481903, -1.67523082586435,
-1.00999999046326, -0.166389216309695, 2.08999991416931, 0.372062996696166,
0.504699754992743, 0.496937180298785, 1.00999999046326, -0.339328350771719,
0.957900164519684, 0.239999994635582, 0.176598601138856, -0.100000001490116,
-0.389999985694885, -1.45000004768372, 0.899999976158142, -0.455922975555279,
-2.08999991416931, 0.263962842397184, 0.116409966871902, 0.182873560506422,
0.718126392391412, 0.0937564011429301, 0.469999998807907, -0.736599988407559,
-1.69000005722046, -1.12999999523163, 0.239999994635582, 0.263181294111732,
-1.00999999046326, 0.596369138003481, 1.45000004768372, 1.30074268626914,
1.23571426414308, -1.69000005722046, -0.245027080113684, 1.45000004768372,
-0.239999994635582, 0.389999985694885, 1.45000004768372, -0.417469985349687,
-0.939030282425158, 2.08999991416931, -1.12999999523163, -1.16628471248566,
0.0656820628151826, -1.00999999046326, 0.688577569218288, 0.232065992576833,
-0.426246572765586, 0.683783560373741, 0.286841934180129, -2.08999991416931,
-1.69000005722046, -1.36594049069136, 2.08999991416931, 0.239999994635582,
1.69000005722046, -0.425000000039825, 0.660863712401399, -0.211897587868515,
0.395522831831701, 1.69000005722046, 0.430865259861408, 1.37698017403451,
1.4413239902174, 1.27999997138977, 0.358462632430353, 1.00999999046326,
-0.170000001788139, -0.302293417174338, -0.105006623761543, 0.100000001490116,
0.899999976158142, -0.398607877111214, 1.45000004768372, 0.166020065230404,
0.469999998807907, -0.321714635169103, 0.779910694674722, -0.319999992847443,
0.899999976158142, 1.27999997138977, -0.389999985694885, 0.243886035801202,
-1.00999999046326, 0.319999992847443, -0.742050604004358, 0.100000001490116,
2.08999991416931, 0.239999994635582, 2.08999991416931, 0.319999992847443,
0.187951153278189, 0.314290680529451, 2.08999991416931, -0.0244502627939298,
1.69000005722046, 0.652601830201143, 0.389999985694885, -0.616952769151027,
-0.899999976158142, 1.45000004768372, 0.554042677351191, 0.699139475282552,
0.239999994635582, -0.461875741360196, 0.159131580544636, 2.08999991416931,
-0.251369958482667, 1.12999999523163, 2.08999991416931, -0.384846367666455,
-0.800000011920929, 0.0748000007122755, -0.293028536156198, -0.100000001490116,
0.559896491956335, 0.536384440270851, 0.624262875256518, -1.24801125714742,
1.12999999523163, -0.238620935965415, 1.91507713041675, 1.69000005722046,
-1.45000004768372, -0.032846521479825, 0.627047869277761, 0.209782062016263,
0.272268156153561, -0.044301074278611, 0.179260982754003, -1.00378792665117,
2.08999991416931, 2.08999991416931, -0.459622127536438, 0.171350739448079,
0.42885713492121, -0.249147630929654, -0.620000004768372, 2.08999991416931,
1.01561841991151, 0.170000001788139, -0.46000000834465, 1.69000005722046,
-1.12999999523163, 0.878630040392184, -0.354165766654509, -1.69000005722046,
-0.184971231695423, 0.100000001490116, 0.0673993807912123, -0.317404696879499,
1.00999999046326, 0.100000001490116, -0.604000008106232, 0.170000001788139,
0.467361110620774, -2.05348540440635, 2.08999991416931, -1.00999999046326,
-0.0299999993294477, -0.345194293446646, 0.25012490516809, 0.242346604044907,
0.54098000009729, -0.620000004768372, -0.0710693647589728, -0.605970495776881,
0.319999992847443, 0.739990688814505, 0.159975469334588, 1.45000004768372,
-1.27999997138977, -2.08999991416931, 0.496728715222974, -1.69000005722046,
0.899999976158142, 1.27999997138977, 0.319999992847443, 0.468449872184824,
0.319999992847443, 1.05885828422011, -0.709999978542328, 0.203876025212443,
0.30008711214754, 2.08999991416931, 1.06630708200095, 2.08999991416931,
0.800000011920929, 1.27999997138977, 0.542264672489192, -1.00999999046326,
-0.256443713224975, -0.393138777127894, 2.08999991416931, 0.270038308140419,
0.432330432264314, 0.170000001788139, -0.587828953554364, 0.469066665321589,
0.096774117913944, 2.08999991416931, 0.392073655884718, -0.899999976158142,
0.196113474297185, -1.69000005722046, -2.08999991416931, -1.00999999046326,
-0.322569742951974, 0.0511938622590812, 1.27999997138977, 0.239999994635582,
-0.620000004768372, 0.206122447317341, 1.45048723369648, -1.45000004768372,
-1.69000005722046, 1.57975615040074, 0.639407959705533, 2.08999991416931,
0.381825500114594, -1.45000004768372, -0.239999994635582, -1.69000005722046,
0.469999998807907, -0.63675652895038, -0.378741970942428, -1.74985897478901,
0.166028003340797, 0.849405953712329, 0.709999978542328, -1.69000005722046,
-1.01828570025308, 1.12999999523163, -2.08999991416931, -1.69000005722046,
2.08999991416931, -1.69000005722046, -0.898779534184233, -1.27999997138977
)), class = c("grouped_df", "tbl_df", "tbl", "data.frame"), row.names = c(NA,
-990L), groups = structure(list(diff_days = c(-49, -48, -47,
-46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34,
-33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21,
-20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8,
-7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49), .rows = structure(list(1:10, 11:20,
21:30, 31:40, 41:50, 51:60, 61:70, 71:80, 81:90, 91:100,
101:110, 111:120, 121:130, 131:140, 141:150, 151:160, 161:170,
171:180, 181:190, 191:200, 201:210, 211:220, 221:230, 231:240,
241:250, 251:260, 261:270, 271:280, 281:290, 291:300, 301:310,
311:320, 321:330, 331:340, 341:350, 351:360, 361:370, 371:380,
381:390, 391:400, 401:410, 411:420, 421:430, 431:440, 441:450,
451:460, 461:470, 471:480, 481:490, 491:500, 501:510, 511:520,
521:530, 531:540, 541:550, 551:560, 561:570, 571:580, 581:590,
591:600, 601:610, 611:620, 621:630, 631:640, 641:650, 651:660,
661:670, 671:680, 681:690, 691:700, 701:710, 711:720, 721:730,
731:740, 741:750, 751:760, 761:770, 771:780, 781:790, 791:800,
801:810, 811:820, 821:830, 831:840, 841:850, 851:860, 861:870,
871:880, 881:890, 891:900, 901:910, 911:920, 921:930, 931:940,
941:950, 951:960, 961:970, 971:980, 981:990), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -99L), .drop = TRUE, class = c("tbl_df",
"tbl", "data.frame")))
Share
Improve this question
asked 7 hours ago
Ivey_MichaellaIvey_Michaella
231 silver badge5 bronze badges
1
- What exactly do you mean by "weighted by different quantiles"? If you were doing this outside the ggplot framework, what would you do? – DaveArmstrong Commented 6 hours ago
1 Answer
Reset to default 2The help page for geom_quantile
suggest that smooth quantile regression can be drawn using:
geom_quantile(method = "rqss")
Do note the warning in those same docs:
Note that rqss doesn't pick a smoothing constant automatically, so you'll need to tweak lambda yourself.
Here is a comparison, for your data:
ggplot(data = drought3,
aes(x = diff_days, y = spei14d))+
geom_smooth(span = 0.1, data = \(d) mutate(d, facet = 'smooth'))+
geom_quantile(method = "rqss", quantiles = c(0.2,0.5,0.7,0.9),
data = \(d) mutate(d, facet = 'smooth quantile')) +
geom_quantile(quantiles = c(0.2,0.5,0.7,0.9),
data = \(d) mutate(d, facet = 'quantile'))+
geom_vline(xintercept = 0)+
geom_hline(yintercept = 0)+
facet_grid(cols = vars(facet)) +
theme_bw(10)+
labs(x = "Days till/since fire",
y = "14 Day SPEI")
本文标签: rIs there a way to weight geomsmooth by different quantilesStack Overflow
版权声明:本文标题:r - Is there a way to weight geom_smooth by different quantiles? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736553728a1944547.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论