-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwinopt.Rd
76 lines (60 loc) · 2.44 KB
/
winopt.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
74
75
76
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/winopt.R
\name{winopt}
\alias{winopt}
\title{Find the optimal half-window width combination}
\usage{
winopt(
dat_in,
tz,
lat,
long,
wins,
vls = c("meanPg", "sdPg", "anomPg", "meanRt", "sdRt", "anomRt"),
parallel = F,
progress = T,
control = list(factr = 1e+07, parscale = c(50, 100, 50)),
lower = c(0.1, 0.1, 0.1),
upper = c(12, 12, 1)
)
}
\arguments{
\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{wins}{list of half-window widths to use in the order specified by \code{\link{wtfun}} (i.e., days, hours, tide height).}
\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,}
\item{control}{A list of control parameters passed to \code{\link[stats]{optim}} (see details in \code{\link[stats]{optim}} help file). The value passed to \code{factr} controls the convergence behavior of the \code{"L-BFGS-B"} method. Values larger than the default will generally speed up the optimization with a potential loss of precision. \code{parscale} describes the scaling values of the parameters.}
\item{lower}{vector of minimum half-window widths to evaluate}
\item{upper}{vector of maximum half-window widths to evaluate}
}
\value{
Printed text to the console showing progress. Output from \cod{\link[stats]{optim}} will also be returned if convergence is achieved.
}
\description{
Find the optimal half-window width combination to use for weighted regression.
}
\details{
This is a super sketchy function based on many assumptions, see details in \code{\link{objfun}}
}
\examples{
\dontrun{
library(foreach)
library(doParallel)
data(SAPDC)
tz <- 'America/Jamaica'
lat <- 31.39
long <- -81.28
ncores <- detectCores()
cl <- makeCluster(ncores)
registerDoParallel(cl)
winopt(SAPDC, tz = tz, lat = lat, long = long, wins = list(6, 6, 0.5), parallel = T)
stopCluster(cl)
}
}
\seealso{
\code{\link{objfun}}, \code{\link{wtobjfun}}
}