least_squares: Linear regression

Description Usage Arguments Value See Also Examples

Description

This function returns parameters of least square equation given column matrices of independent variables and dependent matrices.

Usage

1
least_squares(xmat, ymat)

Arguments

xmat

Independent matrix (dimesions, either n by 2 or n by 3), where n is number of sample points. Matrix returned by make_matrix function.

ymat

Dependent matrix (dimesions, n by 1), where n is number of sample points.

Value

A matrix with components:

ycp

y-value at the change-point

Slope1

leftmost slope if B is 3 by 1 matrix. Otherwise, non-zero slope.

Slope2

rightmost slope if if B is 3 by 1 matrix.

See Also

make_matrix

Examples

1
2
3
4
5
6
util = subset(unretrofit_utility, unretrofit_utility$bdbid == 'f3acce86'
			& unretrofit_utility$energy_type == 'Elec')
temp = sort_matrix(util$OAT,util$usage)
x_split = splitter('4P', temp$x, 51)
xmat = make_matrix(x_split)
B = least_squares(xmat, temp$y)

tinnaing347/bRema documentation built on Aug. 23, 2019, 9:15 p.m.