Calculates weighted R2 of a univariate weighted linear model with
dateNm
as x and myVar
as y using the workhorse lm.fit
and lm.wfit
functions.
CalcR2(myVar, dataFl, dateNm, weightNm = NULL, imputeValue = NULL)
Name of variable to model.
A data.table
, containing myVar
, dateNm
,
and weightNm
.
Name of column containing the date variable (to be modeled as numeric); this date column must not have NA's.
Either NULL
or numeric. If NULL
, model will
be fit on only non-NA components of myVar
. If numeric, missing cases
of myVar
will be imputed to imputeValue
.
A numeric value of R2.
Copyright 2017 Capital One Services, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Functions depend on this function:
OrderByR2
.
This function depends on:
PrepData
.