knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  echo = TRUE
)
library(Bonous)
library(ggplot2)

How to use

devtools::install_github("nourqweder/Bonous", build_vignettes = TRUE)

Introduction

In machine learning, Automatically detect patterns in data.

Usage Methods

ridgereg_obj <- ridgereg$new(Sepal.Length ~ Sepal.Width + Petal.Length, iris[,1:4],lambda = 1)

Data

All fields and methods are stored in reference class of R. Therefore, the data set which is to be examined must be created and stored in the reference class. New data set is assigned to a variable by using function 'classname$new(function, data)'. In the function, dependent variable must be given at first, and after putting ' ~ ', independent variable(s) should be given.

Print

print() function shows the data given for the linear regression, and coefficients of the constructed linear regression model. Since this method is stored in 'linreg' reference class, before using this method, name of the data set, which is stored in the same class as this method is, must be specified, datasetname$print() will use the data set stored in the reference class, and show the result of constructed

Folloing is an example:

  ridgereg_obj$print()

pred and coef

pred(), and coef() function will present residuals, best fitted values, and coefficients of the linear model respectively. Each function will print a vector of the corresponding numeric values. These functions, as well, requires to specify the name of the data set, that is stored in the same class as the function is, as datasetname$functionname() because they are also the methods defined in the reference class.

Followings are examples:

pred()

newdata <- iris[35:40,1:4]
ridgereg_obj$predict(newdata=newdata)

coef()

To calculate the coefficients as a named vector.

$$\hat{\beta} = (X^TX + lambda )^{-1}X^Ty$$

  ridgereg_obj$coef()

Visualization Airports Time Delay

References

Advanced R

Regularized least squares



nourqweder/Bonous documentation built on Nov. 4, 2019, 10:09 p.m.