Creacion de Matrices

Matriz y

matriz_y<-matrix(data = c(20,30,36,24,40),
                nrow = 5,
                ncol = 1,byrow = TRUE)
colnames(matriz_y)<-c("y")
print(matriz_y)
##       y
## [1,] 20
## [2,] 30
## [3,] 36
## [4,] 24
## [5,] 40

Matrix x

matriz_x<-cbind(rep(1,5),matrix(data =c(4,10,3,8,6,11,4,9,8,12),nrow = 5,ncol = 2, byrow = TRUE) )
colnames(matriz_x)<-c("Cte","x1","x2")
print(matriz_x)
##      Cte x1 x2
## [1,]   1  4 10
## [2,]   1  3  8
## [3,]   1  6 11
## [4,]   1  4  9
## [5,]   1  8 12

producto de Matrices calculo de x’x(sigma matriz)

matriz_xx<-t(matriz_x)%*%matriz_x
print(matriz_xx)
Cte  x1  x2

Cte 5 25 50 x1 25 141 262 x2 50 262 510

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

Including Plots

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.