basic_sd: Linear Steepest Descend

Description Usage Arguments Value Examples

View source: R/basic_sd.R

Description

This function computes the vector of parameters in a linear regression model via the Steepest Descend Method.

Usage

1
basic_sd(beta, X, y, tol = 0.001, maxit = 1000)

Arguments

beta

vector of initial parameters

X

Covariates Matrix: each column contains observations for each covariate.

y

Response variable observations

tol

Tolerance level for the optimization process, the default is 0.001.

maxit

Maximum iterations number

Value

A list containing the fitted values for the beta vector and the number of iterations performed

Examples

1
2
3
4
5
6
7
8
set.seed(8675309)
n = 1000
x1 = rnorm(n)
x2 = rnorm(n)
y = 1 + .5*x1 + .2*x2 + rnorm(n)
X=cbind(x1,x2)
b_pre <- c(0,0,0)
basic_sd(b_pre,X,y)

FedericoCortese/R4DScm documentation built on July 12, 2021, 5:30 a.m.