Learn R Programming

cocoreg (version 0.1.1)

var_explained: Sum-of-squares values showing what portion of variance in dvec is explained

Description

Computation as in: http://en.wikipedia.org/wiki/Fraction_of_variance_unexplained

ss_est becomes zero if dvec_est equals dvec_0=rep(mean(dvec),length(dvec)). If dvec_est is better estimate than dvec_0, R2 is positive. If dvec_est is worse than dvec_0, R2 is negative.

Usage

var_explained(dvec, dvec_est)

Arguments

dvec
[1,m] numeric, data vector
dvec_est
[1,m] numeric, data vector, an estimate of dvec

Value

A list with elements:
ss_tot:
Sum of squares in dvec
ss_est:
Sum of squares in dvec_est
ss_err:
Sum of squares of dvec - dvec_est
R2:
Percentage of variance explained i.e. 1 - ss_err/ss_tot