Posts by Linkman • 1,149 points
36 posts
-
3
votes1
answer47
viewsQ: Problem organizing a tidyr dataframe in R
I have this dataframe and I need to organize it so that the single dates are the first column and the columns are the shares of Bovespa with their values being their respective prices:…
-
5
votes1
answer69
viewsQ: Extract dataframes from lists with dataframes under given criteria in R
I organized my list of dataframes like this: df.1<-as.data.frame(matrix(rnorm(10),10,80)) df.1.in.list<-split.default(df.1, gl(10, 8)) On the list df.1.in.list i would like to keep the…
-
6
votes2
answers354
viewsQ: Generate sequence in R
my logic is failing. But you could help me create a number array in R with this rule here? Vetor=1,222,2,223,3,224,4,.......,221,442 Thank you very much.
-
4
votes1
answer59
viewsQ: Reorganize data frame in a list using dplyr in R
This is my dataframe: dput(df) structure(list(ind = structure(c(16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437, 16437,…
-
3
votes1
answer62
viewsQ: Presenting tabulated linear regression result
This is the matrix with the results of my regression models: linear_models=structure(c(-0.9051, 2.0445, 0.0075, 0, -3.9959, 7.4458, 0, 0, -0.0666, 0.4933, 0.8627, 0.4268), .Dim = c(2L, 6L),…
-
4
votes2
answers49
viewsQ: Pulling elements from one list to another under a R criterion
The vector below indicates the regressions I circled. regression_pairs=c("A~B", "C~D", "E~F", "G~H","I~J","K~L","M~N","O~P","Q~R") regression_pairs Below is the list where I saved the residuals of…
-
2
votes1
answer1513
viewsQ: Array Column Names using R
This is my matrix in R: n_forward=50 matriz=matrix(0,nrow=length(1:n_forward),ncol=16) The number of lines depends on the command n_forward. From there I want to name the lines in t+1, t+2,....…
-
2
votes1
answer383
viewsQ: Difference between VAR and Structural VAR and Cholesky Estimation in R
I am studying the Autoregressive Vectors (VAR) method. The pet part I am understanding, but there is a question that intrigues me. Is there a differentiation between VAR and structural Var? Isn’t it…
-
1
votes1
answer72
viewsQ: Sentences in a Loop on R
I’m trying to make a very simple "for", but it doesn’t come out: This is my data: data=structure(c(NA, NA, NA, 0.364282642384808, -3.01119851776463, -8.66579826331935, -3.65240790618631,…
-
2
votes2
answers102
viewsQ: Factor Column for Date
My data frame x=structure(list(V1 = structure(c(33L, 35L, 36L, 37L, 39L, 4L, 6L, 7L, 8L, 10L, 14L, 16L, 18L, 19L, 21L, 25L, 27L, 28L, 29L, 30L, 1L, 17L, 31L, 32L, 34L, 38L, 40L, 2L, 3L, 5L, 9L, 11L,…
-
3
votes1
answer163
viewsQ: Using If/Else in R
This is my data frame: tsdata=structure(list(S.Educ = c(228.3000255, 237.2500067, 248.2500235, 235.8500022, 243.3000045, 254.9999758, 258.1000174, 261.1000144, 268.3000056, 277.1000373, 249.2000057,…
-
6
votes2
answers242
viewsQ: Get only given last month using R
I need to extract the last monthly values from dataframe column 2 ntnb45. Is there any direct way to do this in R? library(GetTDData) ntnb <- download.TD.data('NTN-B') ntnb45 <-…
-
2
votes1
answer580
viewsQ: Graph ggplot axis x
This is my date.: datamatrix=structure(list(month = c(1980, 1980.08333333333, 1980.16666666667, 1980.25, 1980.33333333333, 1980.41666666667, 1980.5, 1980.58333333333, 1980.66666666667, 1980.75,…
-
4
votes1
answer60
viewsQ: Plot Main Title with Text and formula y = a + betaX + Epsilon
This is the data: a=structure(c(2.96898844129164, 2.7849952585919, 2.4022019576164, 2.97749332978932, 3.23431466394159, 3.37620019711505, 3.3295390792587, 3.11646532271242, 2.84000702738219,…
-
5
votes1
answer114
viewsQ: Building a function by defining x and y using R
I have this matrix: matrix=structure(c(0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27,…
-
3
votes1
answer44
viewsQ: Accrued Interest Quarterly using R
I am trying to make a rule in the R to accumulate the interest rates every three months, as in the time series below: juros <- structure(c(0.423918702462353, 0.235602849515353,…
-
4
votes1
answer279
viewsQ: Build Accumulated Density Probability using R
I have this two-column date frame (Y and X) With the package quantreg I can estimate the amounts of Y given x. Done this I’m not managing to build the CUMULATIVE Y conditional density function.…
-
4
votes1
answer271
viewsQ: Quadratic Curve Estimating Minimum Square using R
I have a quadratic model that I want to run a simple multivariate regression using Minimal Ordinary Squares. This is my code: df<-data.frame(rnorm(50),rnorm(50)) x_Square<-df[,2]^2…
-
4
votes1
answer1316
viewsQ: Join 3 graphs using Plot
I want to join the three graphs below using the function plot. I do the basics starting with the command par(mfrow=c(1,3)) but I can’t get them together. The problem I believe is the fact that I’m…
-
1
votes2
answers94
viewsQ: Organize Results Kalman Filter in a Matrix
simple question: With the code below I estimate Kalman Filter with an AR component(1). The goal is to exit the vector k_fk. When I have only one vector it is simple. But I need to run the same code…
-
1
votes3
answers105
viewsQ: Changing charts of a regression
I’m trying to modify the chart of the Tables of this regression that I’ve been around: x c(-0.0179316822180174, -0.00641604898349779, 0.0118829440361971, -0.00821159118344772, -0.0171607214317729,…
-
1
votes1
answer91
viewsQ: Including Trust Interval in a Row of a Matrix
I want to create an array of 38 rows and two columns with coefficients on odd lines and confidence intervals for parameters on even lines. Then call the Stargazer. My code is: library(quantreg) y…
-
4
votes1
answer37
viewsQ: Problem endpoint function R
I’m working with this date.frame: St <- data.frame(read.csv2("interest_LastMonthDay.csv")) Date AAA_S.t. Date.1 BBB_S.t. Date.2 CCC_S.t. 1 27/12/88 1,80400 28/12/88 0,8368 28/12/88 0,0080 2…
-
1
votes2
answers758
viewsQ: Values based on the last day of each month (Excel)
Edited: Guys, this is my Excel file. I want the last value of each month of column A to be referenced by column C, that is, for the month and year of each row of column A I must find the value of…
-
6
votes1
answer219
viewsQ: Stargazer changing position of dependent variable
Considering the quantile regressions. library(quantreg) > x=rnorm(100,12,2) > y=rnorm(100,0,4) a<-rq(y~x,tau = .10) b<-rq(y~x,tau = .15) c<-rq(y~x,tau = .20) d<-rq(y~x,tau = .25)…
-
5
votes1
answer105
viewsQ: Build Data Frame with "get" Function
This is my date.: data<-read.csv2("NewEXEMPL.csv",header=TRUE,sep=";") head(data,5) DATE P.A i.A S.A w.A b.A P.B i.B S.B w.B b.B P.C i.C S.C w.C b.C 1 jun/79 16.86 59.67768 12.3125 0.4291845…
-
0
votes1
answer510
viewsQ: Read and explore dat files through R
Guys I have a dat file: "dadodat" How do I open it on the R and exploit it?
-
2
votes1
answer57
viewsQ: bayesQR package Error message
I am trying to replicate the following example of this package "bayesQR": bayesQR set.seed(66) n <- 200 X <- runif(n=n,min=0,max=10) X <- X y <- 1 + 2*X + rnorm(n=n, mean=0, sd=.6*X) #…
-
3
votes2
answers309
viewsQ: Plotting Graphs ggplot inside loop
I’m wanting to create a for using ggplot: Carteira<-cbind(A, B, C,D,E,F) A, B, C,D,E,F are given in the format "zoo". My code is: for(i in 1:6){ ggplot(Carteira[,i], aes(Carteira[,i])) +…
-
3
votes1
answer131
viewsQ: Problem with xts Object
Package ːYieldcurve' Guys, I’m using this package and I have a little problem. MatrizCurva<-MatrizUmaLinha20colunas[1,1:20] [1] 0.1164000 0.1264816 0.1265631 0.1366446 0.1467260 0.1568073…
-
0
votes0
answers163
viewsQ: Organizing EXCEL data
My goal is to interpolate Cubic Spline. For this I am organizing my data as follows: I made a simple modification. I calculated the working days between the day in column B and the dates. For the…
-
3
votes1
answer1613
viewsQ: How to convert data.frame to list?
I loaded my data using taxadados<-read.csv2("ComponentesPrincipaisTeste.csv",header=TRUE) TAXA Taxa.1 Taxa.2 Taxa.3 Taxa.4 Taxa.5 Taxa.6 Taxa.7 Taxa.8 09/04/2013 32.7188 8.8350 13.0662 9.0114…
-
1
votes1
answer875
viewsQ: Sum quarterly data in columns
I have the following doubt: I have five columns...each with quarterly information; Consolidado 31/12/2006 31/03/2007 30/06/2007 30/09/2007 31/12/2007 .... Reserva de Lucros 12300 12300 646 646 33283…
-
3
votes1
answer99
viewsQ: Installation mgarch Package on R
I want to install the package mgarch. I downloaded it for here. Looks like I need to install the devtools as explained here. I do all this and I can’t. How can I solve this problem? I do the…
-
4
votes2
answers106
viewsQ: Data window moving in time (t)
I want to make a recursive prediction. I need each month (t) to move the data window of the last month forward in a period (monthly period, that is, t+1).…
-
2
votes1
answer435
viewsQ: Data.frame for ts daily data in R
I’m not managing to turn the daily exchange rate to ts. dados <- read.table("C:/Econometria/Cambio/cambio.txt", header=T, dec=",") ts(dados), start=c(1994,01,01), freq=1) # Quando faço isso ele…