This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
library(readxl)
library(MASS)
library(stats)
library(psych)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
##
## select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(openxlsx)
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(ISLR)
ExcelExamen <- read.xlsx("ExamenFinal.xlsx")
Regresion <- lm(Credit_Limit ~ CLIENTNUM + Gender + Dependent + Card + book + Relationship + Months + Contacts + Amt + Ct + Avg + M, data = ExcelExamen)
summary(Regresion) # show results
##
## Call:
## lm(formula = Credit_Limit ~ CLIENTNUM + Gender + Dependent +
## Card + book + Relationship + Months + Contacts + Amt + Ct +
## Avg + M, data = ExcelExamen)
##
## Residuals:
## Min 1Q Median 3Q Max
## -15520 -4196 -795 2992 21832
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.100e+04 4.431e+03 2.482 0.0132 *
## CLIENTNUM -3.671e-06 5.811e-06 -0.632 0.5277
## GenderM 4.334e+03 4.554e+02 9.516 < 2e-16 ***
## Dependent 8.510e+02 1.741e+02 4.887 1.19e-06 ***
## CardGold 1.136e+04 2.575e+03 4.412 1.14e-05 ***
## CardPlatinum 2.118e+04 4.775e+03 4.437 1.02e-05 ***
## CardSilver 1.337e+04 1.083e+03 12.350 < 2e-16 ***
## book -5.861e+00 2.752e+01 -0.213 0.8314
## Relationship 1.742e+01 1.697e+02 0.103 0.9183
## Months 2.348e+01 2.208e+02 0.106 0.9153
## Contacts 1.611e+01 2.120e+02 0.076 0.9394
## Amt 1.166e+00 7.513e-01 1.552 0.1210
## Ct -1.434e+01 2.779e+01 -0.516 0.6058
## Avg -1.584e+04 8.656e+02 -18.295 < 2e-16 ***
## M -2.921e+03 7.432e+02 -3.931 9.07e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6711 on 985 degrees of freedom
## Multiple R-squared: 0.4876, Adjusted R-squared: 0.4803
## F-statistic: 66.94 on 14 and 985 DF, p-value: < 2.2e-16