energy_build | R Documentation |
Creates a matrix interpolating energy consumption from measurements at specific moments in time.
energy_build(energy, time, interpolation = "Brownian")
energy |
(matrix) Matrix with each row representing an individual and each column a moment in time in which energy was measured. Energy is assumed to be measured at time 0 initially. |
time |
(vector) Vector of times at which the measurements (columns of energy)
were made. Note that first element of time most always be Optional |
interpolation |
(string) Way to interpolate the values between measurements. Currently
supporting |
Dalia Camacho-GarcĂa-FormentĂ daliaf172@gmail.com
Rodrigo Zepeda-Tello rzepeda17@gmail.com
adult_weight
for weight change in adults and
child_weight
for children weight change.
#EXAMPLE 1: INDIVIDUAL MODELLING
#--------------------------------------------------------
#Get energy consumption
myconsumption <- energy_build(c(0, 200, -500), c(0, 365*2, 365*4), "Linear")
plot(1:(365*4), myconsumption, type = "l")
#Change interpolation to exponential
myexponential <- energy_build(c(0, 200, -500), c(0, 365*2, 365*4), "Exponential")
lines(1:(365*4), myexponential, type = "l", col = "red")
mystepwise <- energy_build(c(0, 200, -500), c(0, 365*2, 365*4), "Stepwise_R")
lines(1:(365*4), mystepwise, type = "l", col = "blue")
mystepwise2 <- energy_build(c(0, 200, -500), c(0, 365*2, 365*4), "Stepwise_L")
lines(1:(365*4), mystepwise2, type = "l", col = "green")
mylogarithmic <- energy_build(c(0, 200, -500), c(0, 365*2, 365*4), "Logarithmic")
lines(1:(365*4), mylogarithmic, type = "l", col = "purple")
mybrownian <- energy_build(c(0, 200, -500), c(0, 365*2, 365*4), "Brownian")
lines(1:(365*4), mybrownian, type = "l", col = "forestgreen")
#EXAMPLE 2: GROUP MODELLING
#--------------------------------------------------------
#Get energy consumption
multiple <- energy_build(cbind(runif(10,1000,2000),
runif(10,1000,2000),
runif(10,1000,2000)), c(0, 142, 365),
"Brownian")
matplot(1:365, t(multiple), type = "l")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.