matrix(data=1:6,nrow=2,ncol=3)
##      [,1] [,2] [,3]
## [1,]    1    3    5
## [2,]    2    4    6
datos=c(6,3,7,4,5,3)
matrix(data=datos,nrow=2,ncol=3)
##      [,1] [,2] [,3]
## [1,]    6    7    5
## [2,]    3    4    3
datos=c(6,3,7,4,5,3)
A=matrix(data=datos,nrow=2,ncol=3,byrow = FALSE)
print(A*3)
##      [,1] [,2] [,3]
## [1,]   18   21   15
## [2,]    9   12    9
matA <- matrix(data = c("a", "b", "c", "d", "e", "f"), nrow = 3, ncol = 2, byrow = TRUE)
rownames(matA) <- c("Fila1", "Fila2", "Fila3")
colnames(matA) <- c("Col1", "Col2")
print(matA)
##       Col1 Col2
## Fila1 "a"  "b" 
## Fila2 "c"  "d" 
## Fila3 "e"  "f"
class(matA)
## [1] "matrix" "array"
print(is.matrix(matA))
## [1] TRUE

FORMULAS ESTADISTICAS

FORMULAS ESTADISTICAS

FORMULAS ESTADISTICAS

x<-c(4,2,6,7,8,5,8,3)
media<-mean(x) 
desvSTD<-sd(x)
varianza<-var(x)

print(media)
## [1] 5.375
print(desvSTD)
## [1] 2.263846
print(varianza)
## [1] 5.125
x<-c(0,1,2,3,4,5)
y<-c(0.5,1.4,1.98,3.1,3.8,5.4)
formula1<-formula(y~x)
modelo<-lm(formula1)
summary(modelo)
## 
## Call:
## lm(formula = formula1)
## 
## Residuals:
##        1        2        3        4        5        6 
##  0.14762  0.10990 -0.24781 -0.06552 -0.30324  0.35905 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.35238    0.20485    1.72 0.160511    
## x            0.93771    0.06766   13.86 0.000157 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.283 on 4 degrees of freedom
## Multiple R-squared:  0.9796, Adjusted R-squared:  0.9745 
## F-statistic: 192.1 on 1 and 4 DF,  p-value: 0.0001571
plot(x,y)
abline(0.35238,0.93771,col="blue")