Estimates the parameters of a building's heating model.

1 |

`formula` |
an object of class "formula": a description of which variable holds the energy readouts and which variable holds the daily temperatures. |

`data` |
a data frame in which the energy and daily temperatures are to be found. |

`baseLoad` |
a optional constant base load, e.g. for domestic hot water preparation. |

`bhm`

assumes that the heating energy for a building has been measured
over several time periods (not necessarily of equal length). The `data`

data frame should have one row per measurement period. The energy vector (whose
name is given on the left-hand side of the formula) will have the total energy
measured during each period. The daily temperature vector (whose name is given on
the right-hand side of the formula) will have either a vector of average daily
temperatures (when each measurement period is just one day) or a list of vectors
(when each measurement period can be an arbitrary number of days).

`bhm`

returns an object of class "`bhm`

". The generic
accessor functions `coefficients`

, `vcov`

and `residuals`

extract the usual
information from the fitted model, while `logposterior`

will return a function
that evaluates the log-posterior as a function of the parameters.

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 | ```
set.seed(1111)
# Simple, but unrealistic parameters
K <- 1
tb <- 1
DHW <- 1
sigma <- 1e-2
temps <- tb + c(-2, -1, 0, 1)
# With daily measurements
E <- K * pmax(tb - temps, 0) + DHW + rnorm(length(temps), 0, sigma)
fourDayData <- data.frame(E = E, T = temps)
fourDayData
## Not run:
fit <- bhm(E ~ T, fourDayData)
coef(fit)
resid(fit)
## End(Not run)
# With two-day measurements
fourTimesTwoDayData <- with(fourDayData,
data.frame(E = 2 * E,
T = I(lapply(T, function(x) c(x, x)))))
fit2 <- bhm(E ~ T, fourTimesTwoDayData)
coef(fit2)
resid(fit2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.