winopt | R Documentation |
Find the optimal half-window width combination to use for weighted regression.
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)
)
dat_in |
input data frame |
tz |
chr string specifying timezone of location, e.g., 'America/Jamaica' for EST, no daylight savings, must match the time zone in |
lat |
numeric for latitude of location |
long |
numeric for longitude of location (negative west of prime meridian) |
wins |
list of half-window widths to use in the order specified by |
vls |
chr vector of summary evaluation object to optimize, see details for |
parallel |
logical if regression is run in parallel to reduce processing time, requires a parallel backend outside of the function |
progress |
logical if progress saved to a txt file names 'log.txt' in the working directory, |
control |
A list of control parameters passed to |
lower |
vector of minimum half-window widths to evaluate |
upper |
vector of maximum half-window widths to evaluate |
This is a super sketchy function based on many assumptions, see details in objfun
Printed text to the console showing progress. Output from optim
will also be returned if convergence is achieved.
objfun
, wtobjfun
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.