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:

Ano DCP(Y) PIB(X)

[1,] “1960” “1597,4” “2501,8”

[2,] “1961” “1630,3” “2560,0”

[3,] “1962” “1711,1” “2715,2”

[4,] “1963” “1781,6” “2834,0”

[5,] “1964” “1888,4” “2998,6”

[6,] “1965” “2007,7” “3191,1”

[7,] “1966” “2121,8” “3399,1”

[8,] “1967” “2185,0” “3484,6”

[9,] “1968” “2310,5” “3652,7”

[10,] “1969” “2396,4” “3765,4”

[11,] “1970” “2451,9” “3771,9”

[12,] “1971” “2545,5” “3898,6”

[13,] “1972” “2701,3” “4105,0”

[14,] “1973” “2833,8” “4341,5”

[15,] “1974” “2812,3” “4319,6”

[16,] “1975” “2876,9” “4311,2”

[17,] “1976” “3035,5” “4540,9”

[18,] “1977” “3164,1” “4750,5”

[19,] “1978” “3303,1” “5015,0”

[20,] “1979” “3383,4” “5173,4”

[21,] “1980” “3374,1” “5161,7”

[22,] “1981” “3422,2” “5291,7”

[23,] “1982” “3470,3” “5189,3”

[24,] “1983” “3668,6” “5423,8”

[25,] “1984” “3863,3” “5813,6”

[26,] “1985” “4064,0” “6053,7”

[27,] “1986” “4228,9” “6263,6”

[28,] “1987” “4369,8” “6475,1”

[29,] “1988” “4546,9” “6742,7”

[30,] “1989” “4675,0” “6981,4”

[31,] “1990” “4770,3” “7112,5”

[32,] “1991” “4778,4” “7100,5”

[33,] “1992” “4934,8” “7336,6”

[34,] “1993” “5099,8” “7532,7”

[35,] “1994” “5290,7” “7835,5”

[36,] “1995” “5433,5” “8031,7”

[37,] “1996” “5619,4” “8328,9”

[38,] “1997” “5831,8” “8703,5”

[39,] “1998” “6125,8” “9066,9”

[40,] “1999” “6438,6” “9470,3”

[41,] “2000” “6739,4” “9817,0”

[42,] “2001” “6910,4” “9890,7”

[43,] “2002” “7099,3” “10048,8”

[44,] “2003” “7295,3” “10301,0”

[45,] “2004” “7577,1” “10703,5”

[46,] “2005” “7841,2” “11048,6”

RendaConsumo <- as.matrix

uns <- rep(1,46)


tercol <- c(2501.8,2560,2715.2,2834,2998.6,3191.1,3399.1,3484.6,3652.7,3765.4,3771.9,3898.6,4105,4341.5,4319.6,4311.2,4540.9,4750.5,5015,5173.4,5161.7,5291.7,5189.3,5423.8,5813.6,6053.7,6263.6,6475.1,6742.7,6981.4,7112.5,7100.5,7336.6,7532.7,7835.5,8031.7,8328.9,8703.5,9066.9,9470.3,9817,9890.7,10048.8,10301,10703.5,11048.6)



x <- cbind(uns,tercol)
x
##       uns  tercol
##  [1,]   1  2501.8
##  [2,]   1  2560.0
##  [3,]   1  2715.2
##  [4,]   1  2834.0
##  [5,]   1  2998.6
##  [6,]   1  3191.1
##  [7,]   1  3399.1
##  [8,]   1  3484.6
##  [9,]   1  3652.7
## [10,]   1  3765.4
## [11,]   1  3771.9
## [12,]   1  3898.6
## [13,]   1  4105.0
## [14,]   1  4341.5
## [15,]   1  4319.6
## [16,]   1  4311.2
## [17,]   1  4540.9
## [18,]   1  4750.5
## [19,]   1  5015.0
## [20,]   1  5173.4
## [21,]   1  5161.7
## [22,]   1  5291.7
## [23,]   1  5189.3
## [24,]   1  5423.8
## [25,]   1  5813.6
## [26,]   1  6053.7
## [27,]   1  6263.6
## [28,]   1  6475.1
## [29,]   1  6742.7
## [30,]   1  6981.4
## [31,]   1  7112.5
## [32,]   1  7100.5
## [33,]   1  7336.6
## [34,]   1  7532.7
## [35,]   1  7835.5
## [36,]   1  8031.7
## [37,]   1  8328.9
## [38,]   1  8703.5
## [39,]   1  9066.9
## [40,]   1  9470.3
## [41,]   1  9817.0
## [42,]   1  9890.7
## [43,]   1 10048.8
## [44,]   1 10301.0
## [45,]   1 10703.5
## [46,]   1 11048.6
segcol <- c(1597.4,1630.3,1711.1,1781.6,1888.4,2007.7,2121.8,2185,2310.5,2396.4,2451.9,2545.5,2701.3,2833.8,2812.3,2876.9,3035.5,3164.1,3303.1,3383.4,3374.1,3422.2,3470.3,3668.6,3863.3,4064,4228.9,4369.8,4546.9,4675,4770.3,4778.4,4934.8,5099.8,5290.7,5433.5,5619.4,5831.8,6125.8,6438.6,6739.4,6910.4,7099.3,7295.3,7577.1,7841.2)

y <- segcol
y
##  [1] 1597.4 1630.3 1711.1 1781.6 1888.4 2007.7 2121.8 2185.0 2310.5 2396.4
## [11] 2451.9 2545.5 2701.3 2833.8 2812.3 2876.9 3035.5 3164.1 3303.1 3383.4
## [21] 3374.1 3422.2 3470.3 3668.6 3863.3 4064.0 4228.9 4369.8 4546.9 4675.0
## [31] 4770.3 4778.4 4934.8 5099.8 5290.7 5433.5 5619.4 5831.8 6125.8 6438.6
## [41] 6739.4 6910.4 7099.3 7295.3 7577.1 7841.2
xt <- t(x)
xt
##          [,1] [,2]   [,3] [,4]   [,5]   [,6]   [,7]   [,8]   [,9]  [,10]  [,11]
## uns       1.0    1    1.0    1    1.0    1.0    1.0    1.0    1.0    1.0    1.0
## tercol 2501.8 2560 2715.2 2834 2998.6 3191.1 3399.1 3484.6 3652.7 3765.4 3771.9
##         [,12] [,13]  [,14]  [,15]  [,16]  [,17]  [,18] [,19]  [,20]  [,21]
## uns       1.0     1    1.0    1.0    1.0    1.0    1.0     1    1.0    1.0
## tercol 3898.6  4105 4341.5 4319.6 4311.2 4540.9 4750.5  5015 5173.4 5161.7
##         [,22]  [,23]  [,24]  [,25]  [,26]  [,27]  [,28]  [,29]  [,30]  [,31]
## uns       1.0    1.0    1.0    1.0    1.0    1.0    1.0    1.0    1.0    1.0
## tercol 5291.7 5189.3 5423.8 5813.6 6053.7 6263.6 6475.1 6742.7 6981.4 7112.5
##         [,32]  [,33]  [,34]  [,35]  [,36]  [,37]  [,38]  [,39]  [,40] [,41]
## uns       1.0    1.0    1.0    1.0    1.0    1.0    1.0    1.0    1.0     1
## tercol 7100.5 7336.6 7532.7 7835.5 8031.7 8328.9 8703.5 9066.9 9470.3  9817
##         [,42]   [,43] [,44]   [,45]   [,46]
## uns       1.0     1.0     1     1.0     1.0
## tercol 9890.7 10048.8 10301 10703.5 11048.6
p <- xt %*% x

q <- xt %*% y


result <- (p^-1) %*% (q)
result
##               [,1]
## uns    8816.623471
## tercol    1.351258

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.