Skip to content
Snippets Groups Projects
Commit 068a8521 authored by Pranav Pankaj Chandode's avatar Pranav Pankaj Chandode
Browse files

Removing doc, meta from gitignore

parent 9446abd8
No related branches found
No related tags found
No related merge requests found
Pipeline #141846 passed
*.Rproj
.Rproj.user
.Rbuildignore
inst/doc
/doc/
/Meta/
......@@ -21,3 +21,4 @@ Suggests:
Config/testthat/edition: 3
Encoding: UTF-8
VignetteBuilder: knitr
Config/build/clean-inst-doc: FALSE
File added
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----setup--------------------------------------------------------------------
library(lab4)
## -----------------------------------------------------------------------------
data(iris)
## -----------------------------------------------------------------------------
linreg_mod <- linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
## -----------------------------------------------------------------------------
linreg_mod$print()
## -----------------------------------------------------------------------------
plots <- linreg_mod$plot()
print(plots[[1]])
print(plots[[2]])
## -----------------------------------------------------------------------------
# Get residuals
residuals <- linreg_mod$resid()
print(residuals)
## -----------------------------------------------------------------------------
# Get predicted values
predictions <- linreg_mod$pred()
print(predictions)
## -----------------------------------------------------------------------------
linreg_mod$summary()
---
title: "lab4"
author: "Udaya Shanker Mohanan Nair, Pranav Pankaj Chandode"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{lab4}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r setup}
library(lab4)
```
## Introduction
This vignette illustrates how to use lab4 package to perform linear progression models and to perform various special functions like print(), plot(), resid(), pred(),coef() and summary().
## DataSet
For testing purpose, here we are using iris dataset, containing measurements of features of flower iris. To load data use the following:
```{r}
data(iris)
```
## Invoking linreg function
This Function will take two parameters namely formula and data. Type of formula is an expression specifying the relationship between dependent and independent variables, whereas data is the dataset(iris in this case).
```{r}
linreg_mod <- linreg$new(Petal.Length~Sepal.Width+Sepal.Length, data=iris)
```
## Print Function
Printing the coefficients and coefficients name of the model generated using linreg function.This can be invoked by the following
```{r}
linreg_mod$print()
```
## Plot Function
Plotting for residuals against Fitted Values and for Scale-Locations against sqaure root of standardized residuals.
```{r}
plots <- linreg_mod$plot()
print(plots[[1]])
print(plots[[2]])
```
## Resid Function
Resid Function is to display the residuals of the model as a vector.
```{r}
# Get residuals
residuals <- linreg_mod$resid()
print(residuals)
```
## pred Function
pred Function is to display the predicted values of the model.
```{r}
# Get predicted values
predictions <- linreg_mod$pred()
print(predictions)
```
## Summary Function
Summary function is to display coefficients along with standard error, t-values, p-values with significance.
```{r}
linreg_mod$summary()
```
## Conclusion
This Linreg function helps to find Linear regression of models to find out Regression coefficients, fitted values, residuals, degree of freedom, residual variance, variance of regression coefficients and different ways to print, plot the model coefficients.
---
## Instructions to Include the Vignette in Your Package
1. **Save the Vignette**: Save the above content in a file named `using_linreg.Rmd` within the `vignettes/` directory of your package.
2. **Build the Vignette**: Ensure that you have the necessary packages installed for building vignettes, such as `knitr` and `rmarkdown`. Then, build your package using:
```r
devtools::build_vignettes()
\ No newline at end of file
This diff is collapsed.
......@@ -65,4 +65,15 @@ Summary function is to display coefficients along with standard error, t-values,
linreg_mod$summary()
```
## Conclusion
This Linreg function helps to find Linear regression of models to find out Regression coefficients, fitted values, residuals, degree of freedom, residual variance, variance of regression coefficients and different ways to print, plot the model coefficients.
\ No newline at end of file
This Linreg function helps to find Linear regression of models to find out Regression coefficients, fitted values, residuals, degree of freedom, residual variance, variance of regression coefficients and different ways to print, plot the model coefficients.
---
## Instructions to Include the Vignette in Your Package
1. **Save the Vignette**: Save the above content in a file named `using_linreg.Rmd` within the `vignettes/` directory of your package.
2. **Build the Vignette**: Ensure that you have the necessary packages installed for building vignettes, such as `knitr` and `rmarkdown`. Then, build your package using:
```r
devtools::build_vignettes()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment