knitr::opts_chunk$set(echo = TRUE)
library(readxl)
Datos1<- read_excel("file_show.xlsx",
sheet = "Hoja1", col_types = c("numeric",
"numeric", "numeric"))
names(Datos1)
## [1] "Fuerza" "Tiempo" "Densidad"
attach(Datos1)
Modelo de regresión
cor(Datos1)
## Fuerza Tiempo Densidad
## Fuerza 1.0000000 0.0000000 0.8078464
## Tiempo 0.0000000 1.0000000 0.2732421
## Densidad 0.8078464 0.2732421 1.0000000
pairs(Datos1)
regresion <- lm(Fuerza ~ Densidad, data = Datos1)
summary(regresion)
##
## Call:
## lm(formula = Fuerza ~ Densidad, data = Datos1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.93602 -0.39669 0.02465 0.31398 0.83365
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.55401 0.19886 2.786 0.00867 **
## Densidad 0.23033 0.02882 7.992 2.59e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4952 on 34 degrees of freedom
## Multiple R-squared: 0.6526, Adjusted R-squared: 0.6424
## F-statistic: 63.87 on 1 and 34 DF, p-value: 2.59e-09
Grafica de la recta de regresión por el método de minimos cuadrados
plot(Datos1$Densidad, Datos1$Fuerza, xlab='Densidad', ylab='Fuerza')
abline(regresion)
## R Markdown
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.