installed.packages("rpart.plot")
## Package LibPath Version Priority Depends Imports LinkingTo Suggests
## Enhances License License_is_FOSS License_restricts_use OS_type Archs
## MD5sum NeedsCompilation Built
library(rpart)
library(rpart.plot)
library(caret)
## Loading required package: ggplot2
## Loading required package: lattice
dataset<-read.csv("D:/Rencana Tugas Akhir/DLI.csv",sep=";")
ctrl <- trainControl(method = "cv", number = 2)
m<- train(X.Y. ~ X.X1.+ X.X2.+X.X3.+X.X4.+X.X5.+X.X6.+X.X7., data = dataset, method = "lm", trControl = ctrl)
## Warning in train.default(x, y, weights = w, ...): You are trying to do
## regression and your outcome only has two possible values Are you trying to do
## classification? If so, use a 2 level factor as your outcome column.
print(m)
## Linear Regression
##
## 100 samples
## 7 predictor
##
## No pre-processing
## Resampling: Cross-Validated (2 fold)
## Summary of sample sizes: 50, 50
## Resampling results:
##
## RMSE Rsquared MAE
## 0.389844 0.05015367 0.2924235
##
## Tuning parameter 'intercept' was held constant at a value of TRUE
m$finalModel
##
## Call:
## lm(formula = .outcome ~ ., data = dat)
##
## Coefficients:
## (Intercept) X.X1. X.X2. X.X3. X.X4. X.X5.
## 0.11214 -0.07636 0.04307 -0.04678 0.16016 0.16314
## X.X6. X.X7.
## -0.02540 0.11430
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.