test_that("calc_window", { expect_equal( calc_epaker_weights(seq(0, 1, 0.1), c(0.2, 0.4), c(0.2, 0.4)), structure(c(0, 0.5625, 0.75, 0.5625, 0, 0, 0, 0, 0, 0, 0, 0, 0.328125, 0.5625, 0.703125, 0.75, 0.703125, 0.5625, 0.328125, 0, 0, 0), .Dim = c(11L, 2L)) ) expect_equal( calc_r_window(c(4.94, 4.92, 4.91, 4.92, 4.95, 4.95, 4.96, 4.98, 4.96, 4.98, 4.99, 4.99, 5.01, 5, 5.01, 5, 5.01, 5, 5.01, 5, 4.99, 5, 5.01, 5.02, 5.01, 5.02, 5.03, 5.02, 5.04, 5.03, 5.02, 5.03, 5.04, 5.05, 5.04, 5.05, 5.05, 5.05, 4.99, 5.01, 5, 4.98, 4.97, 4.99, 4.97, 4.95, 4.96, 4.96, 4.94, 4.92, 4.91, 4.9, 4.93, 4.92, 4.91, 4.92, 4.94, 4.93, 4.93, 4.92, 4.91, 4.9, 4.91, 4.91, 4.92, 4.9, 4.91, 4.89, 4.89, 4.9, 4.89, 4.88, 4.88, 4.87, 4.86, 4.85, 4.85, 4.85, 4.84, 4.83, 4.82, 4.81, 4.79, 4.76, 4.77, 4.76, 4.76, 4.77, 4.76, 4.74, 4.73, 4.73, 4.73, 4.7, 4.62, 4.68, 4.7, 4.76, 4.79, 4.77, 4.77, 4.75, 4.76, 4.71, 4.6, 4.66, 4.68, 4.7, 4.67, 4.67, 4.64, 4.6, 4.59, 4.53, 4.52, 4.43, 4.51, 4.52, 4.61, 4.57, 4.59, 4.69, 4.69, 4.64, 4.64, 4.68, 4.81, 4.81, 4.81, 4.81, 4.83, 4.81, 4.81, 4.83, 4.83, 4.84, 4.82, 4.82, 4.84, 4.83, 4.88, 4.88, 4.85, 4.78, 4.72, 4.82, 4.82, 4.75, 4.75, 4.72, 4.74, 4.8, 4.81, 4.67, 4.44, 4.61, 4.51, 4.1, 3.69, 3.65, 3.08, 3.51, 3.58, 3.79, 4.13, 4.5, 4.28, 3.88, 3.74, 3.91, 4.35, 4.24, 4.18, 3.96, 3.86, 4, 3.93, 3.97, 3.9, 4.05, 3.91, 3.83, 3.69, 3.64, 3.76, 3.7, 3.64, 3.62, 3.72, 3.83, 3.86, 3.86, 3.85, 3.89, 3.96, 3.95, 4.01, 4.09, 4.19, 4.14, 3.91, 3.66, 3.75, 3.9, 3.88, 3.75, 3.84, 3.86, 3.91, 3.86, 3.84, 3.71, 3.52, 3.62, 3.66, 3.4, 3.3, 3.19, 3.41, 3.33, 3.22, 3.32, 3.32, 3.17, 3.02, 3.15, 3.06, 3.08, 2.98, 2.92, 3.08, 2.99, 3, 3, 3.02, 3.04, 2.98, 2.87, 2.81, 2.8, 2.81, 3.01, 2.98, 2.85, 2.85, 2.92, 3.26, 3.24, 3.09, 3.1, 3.29), 4.03, 1.285), structure(c(0.373870157004648, 0.390221653620797, 0.39826113945707, 0.390221653620797, 0.365558146224773, 0.365558146224773, 0.35715529379703, 0.340077063997941, 0.35715529379703, 0.340077063997941, 0.331401686626595, 0.331401686626595, 0.313778406940302, 0.322635467607383, 0.313778406940302, 0.322635467607383, 0.313778406940302, 0.322635467607383, 0.313778406940302, 0.322635467607383, 0.331401686626595, 0.322635467607383, 0.313778406940302, 0.304830504625355, 0.313778406940302, 0.304830504625355, 0.295791760662538, 0.304830504625355, 0.286662175051856, 0.295791760662538, 0.304830504625355, 0.295791760662538, 0.286662175051856, 0.277441747793305, 0.286662175051856, 0.277441747793305, 0.277441747793305, 0.277441747793305, 0.331401686626595, 0.313778406940302, 0.322635467607383, 0.340077063997941, 0.348661599721419, 0.331401686626595, 0.348661599721419, 0.365558146224773, 0.35715529379703, 0.35715529379703, 0.373870157004648, 0.390221653620797, 0.39826113945707, 0.406209783645475, 0.382091326136656, 0.390221653620797, 0.39826113945707, 0.390221653620797, 0.373870157004648, 0.382091326136656, 0.382091326136656, 0.390221653620797, 0.39826113945707, 0.406209783645475, 0.39826113945707, 0.39826113945707, 0.390221653620797, 0.406209783645475, 0.39826113945707, 0.414067586186014, 0.414067586186014, 0.406209783645475, 0.414067586186014, 0.421834547078684, 0.421834547078684, 0.429510666323487, 0.437095943920423, 0.444590379869491, 0.444590379869491, 0.444590379869491, 0.451993974170692, 0.459306726824025, 0.46652863782949, 0.473659707187089, 0.487649320958682, 0.507952429257067, 0.501275568138806, 0.507952429257067, 0.507952429257067, 0.501275568138806, 0.507952429257067, 0.521033626549986, 0.527437962724644, 0.527437962724644, 0.527437962724644, 0.546105921361413, 0.59189011188663, 0.558097018879923, 0.546105921361413, 0.507952429257067, 0.487649320958682, 0.501275568138806, 0.501275568138806, 0.51453844872746, 0.507952429257067, 0.539974110130358, 0.602427743039259, 0.569724749806962, 0.558097018879923, 0.546105921361413, 0.563956305167376, 0.563956305167376, 0.580989114142531, 0.602427743039259, 0.607560296143772, 0.636447940165635, 0.640944601735076, 0.677326681706006, 0.645350421656649, 0.640944601735076, 0.597204348286878, 0.617552877409196, 0.607560296143772, 0.552146890944602, 0.552146890944602, 0.580989114142531, 0.580989114142531, 0.558097018879923, 0.473659707187089, 0.473659707187089, 0.473659707187089, 0.473659707187089, 0.459306726824025, 0.473659707187089, 0.473659707187089, 0.459306726824025, 0.459306726824025, 0.451993974170692, 0.46652863782949, 0.46652863782949, 0.451993974170692, 0.459306726824025, 0.421834547078684, 0.421834547078684, 0.444590379869491, 0.494507865372678, 0.533751457251435, 0.46652863782949, 0.46652863782949, 0.51453844872746, 0.51453844872746, 0.533751457251435, 0.521033626549986, 0.480699934896819, 0.473659707187089, 0.563956305167376, 0.673647594967373, 0.597204348286878, 0.645350421656649, 0.747774379627246, 0.697493527532589, 0.68441233023967, 0.340077063997941, 0.62718209208315, 0.658022831534164, 0.723837605414162, 0.745457917606625, 0.649665399930355, 0.721611985041409, 0.739780314614907, 0.711801087071719, 0.74345940135354, 0.703489076291844, 0.729969416645218, 0.739780314614907, 0.747774379627246, 0.736873381883147, 0.749591212584596, 0.745457917606625, 0.748364850338385, 0.742323880755197, 0.749818316704265, 0.74345940135354, 0.731831670426502, 0.697493527532589, 0.680914926796772, 0.716888219352299, 0.70053672273615, 0.680914926796772, 0.673647594967373, 0.70635058819967, 0.731831670426502, 0.736873381883147, 0.736873381883147, 0.735283653045466, 0.741097518508986, 0.747774379627246, 0.74709306726824, 0.749818316704265, 0.748364850338385, 0.738372269072961, 0.744504080304017, 0.74345940135354, 0.687818892034701, 0.714390074035943, 0.742323880755197, 0.739780314614907, 0.714390074035943, 0.733603082559918, 0.736873381883147, 0.74345940135354, 0.736873381883147, 0.733603082559918, 0.703489076291844, 0.631860436948326, 0.673647594967373, 0.687818892034701, 0.569724749806961, 0.507952429257067, 0.429510666323487, 0.57540235279868, 0.527437962724644, 0.451993974170691, 0.521033626549985, 0.521033626549985, 0.414067586186013, 0.286662175051855, 0.398261139457069, 0.322635467607382, 0.340077063997941, 0.249235416130448, 0.190370028312313, 0.340077063997941, 0.258728368332601, 0.268130478886887, 0.268130478886887, 0.286662175051855, 0.304830504625354, 0.249235416130448, 0.138817393147512, 0.0739564565701219, 0.0628283547063539, 0.0739564565701219, 0.277441747793305, 0.249235416130448, 0.117560447546518, 0.117560447546518, 0.190370028312313, 0.480699934896819, 0.46652863782949, 0.348661599721418, 0.357155293797029, 0.501275568138806 ), .Dim = c(251L, 1L)) ) })