-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwtobjfun.Rd
73 lines (57 loc) · 2.1 KB
/
wtobjfun.Rd
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wtobjfun.R
\name{wtobjfun}
\alias{wtobjfun}
\title{An objective function to minimize plus weighted regression for finding optimal window widths}
\usage{
wtobjfun(
wins,
dat_in,
tz,
lat,
long,
metab_obs,
strt = NULL,
vls = c("meanPg", "sdPg", "anomPg", "meanRt", "sdRt", "anomRt"),
parallel = F,
progress = T
)
}
\arguments{
\item{wins}{list of half-window widths to use in the order specified by \code{\link{wtfun}} (i.e., days, hours, tide height).}
\item{dat_in}{input data frame}
\item{tz}{chr string specifying timezone of location, e.g., 'America/Jamaica' for EST, no daylight savings, must match the time zone in \code{dat_in$DateTimeStamp}}
\item{lat}{numeric for latitude of location}
\item{long}{numeric for longitude of location (negative west of prime meridian)}
\item{metab_obs}{A \code{metab} object returned by \code{\link{ecometab}} based on the observed DO time series in \code{dat_in}, used as comparison for the objective function}
\item{strt}{a \code{\link{POSIXct}} object returned by \code{\link{Sys.time}}}
\item{vls}{chr vector of summary evaluation object to optimize, see details for \code{\link{objfun}}}
\item{parallel}{logical if regression is run in parallel to reduce processing time, requires a parallel backend outside of the function}
\item{progress}{logical if progress saved to a txt file names 'log.txt' in the working directory}
}
\value{
A single numeric value to minimize, as output from \code{\link{objfun}}
}
\description{
An objective function to minimize plus weighted regression for finding optimal window widths
}
\examples{
\dontrun{
library(foreach)
library(doParallel)
data(SAPDC)
tz <- 'America/Jamaica'
lat <- 31.39
long <- -81.28
metobs <- ecometab(SAPDC, DO_var = 'DO_obs', tz = tz, lat = lat, long = long)
ncores <- detectCores()
cl <- makeCluster(ncores)
registerDoParallel(cl)
wtobjfun(SAPDC, tz = tz, lat = lat, long = long, metab_obs = metobs, strt = Sys.time(),
wins = list(6, 6, 0.5), parallel = T)
stopCluster(cl)
}
}
\seealso{
\code{\link{objfun}}, \code{\link{winopt}}
}