regress | R Documentation |
The purpose of this function is to generate the multiplier and an offset values (if required) used by the impute function. Therefore, it performs a linear (least-squares) regression of the primary dataset (the values to be produced by imputation) against the secondary dataset. The function removes missing values and merges the data sets together before doing the regression to ensure that the variables are aligned by datetime.
regress(
primaryCRHM,
primary.columns = 1,
secondaryCRHM,
secondary.columns = 1,
forceOrigin = FALSE,
plot = FALSE,
quiet = TRUE,
logfile = ""
)
primaryCRHM |
Required. The primary CRHMr data frame. |
primary.columns |
Optional. Optional. A vector containing the columns to be imputed in the primary data frame, not including the datetime. If not specified, defaults to the first column. |
secondaryCRHM |
Required. The secondary CRHMr data frame. |
secondary.columns |
Optional. A vector containing the columns to be imputed in the secondary data frame, not including the datetime. If not specified, defaults to the first column. |
forceOrigin |
Optional. If |
plot |
Optional. Set |
quiet |
Optional. Suppresses display of messages, except for errors. If you are calling this function in an R script, you will usually leave |
logfile |
Optional. Name of the file to be used for logging the action. Normally not used. |
If successful, and plot=TRUE
, returns a plot of all of the regressions. If successful, and plot=FALSE
, returns a data frame containing the regression parameters. If unsuccessful, returns FALSE
.
If successful, exports a data frame with the columns xvals
(secondary data frame), yvals
(primary data frame), first date
(in common data frame), last date
(in common data frame), and slope
for each variable to the regression file. If forceOrigin=FALSE
then the parameters intercept
, and r2
will also be returned. This function will not permit regression on RH values, so convert these to Ea values first.
Kevin Shook
impute
# this would be used to get the regression coefficients used to impute data from Saskatoon
# to fill gaps in the Regina data
## Not run:
reg <- regress(regina, c(1,2,3), saskatoon, c(1,2,3))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.