Cost Function In Linear Regression R