2
These are the given commands, basically:
library(psych)
library(readxl)
library(minqa)
library(car)
COMDINHEIRO_UFESpro_capm <- read_excel("COMDINHEIRO_UFESpro_capm.xlsx")
View(COMDINHEIRO_UFESpro_capm)
setwd("C:/Users/Rodolfo Fabriz.ESCRAVo/Desktop/Rodolfo/Mestrado/Econometria")
COMDINHEIRO_UFESpro_capm <- read_excel("COMDINHEIRO_UFESpro_capm.xlsx")
View(COMDINHEIRO_UFESpro_capm)
calculating descriptive statistics and saving in a database (questions 1 and 2)
summarysComdinheiro <- as.data.frame(describe(COMDINHEIRO_UFESpro_capm))
View(summarysComdinheiro)
to generate file to be opened in excel
write.csv(summarysComdinheiro, file="descritiva_comdinheiro.csv")
attach the COMMONEY basis to the next issues
attach(COMDINHEIRO_UFESpro_capm)
?attach
generating the scatter charts (questions 3 and 4)
?par
par(mfrow=c(1,2))
plot(IBOV,PETR4,main="PETR X IBOV",xlab = "IBOV",ylab = "PETR",pch=19)
?pch
plot(IBOV,PETR4,main="PETR X IBOV",xlab = "IBOV",ylab = "PETR")
plot(IBOV,PETR4,main="PETR X IBOV",xlab = "IBOV",ylab = "PETR",pch=19)
plot(IBOV,CDI,main="CDI X IBOV",xlab = "IBOV",ylab = "CDI",pch=19)
calculating correlations generating database, with numerical data only, for use with color function
?numeric
?as.data.frame
?data.frame
?data.class
COMDINHEIRO_numeric <- data.frame(PETR4,VALE3,BBAS3,NATU3,IBOV,CDI)
cor(COMDINHEIRO_numeric, use = "complete.obs")
rounded to two decimal places
round(cor(COMDINHEIRO_numeric, use = "complete.obs"),2)
generating excess returns to the CDI (question 5)
COMDINHEIRO_UFESpro_capm$petr_exc <- (PETR4-CDI)
COMDINHEIRO_UFESpro_capm$vale_exc <- (VALE3-CDI)
COMDINHEIRO_UFESpro_capm$bbas_exc <- (BBAS3-CDI)
COMDINHEIRO_UFESpro_capm$natu_exc <- (NATU3-CDI)
COMDINHEIRO_UFESpro_capm$ibov_exc <- (IBOV-CDI)
Agr want the excess returns values!
This issue seems to be a homework assignment. Note the references to questions 1 to 5. Besides, I did not understand what the OP means by waste in his case. In general, when we talk about residues in statistics, we are talking about the difference between the value observed in a data set and the value predicted by a model adjusted to these data. From what I understand, the OP did not adjust any model to the data analyzed.
– Marcus Nunes
Why post instructions such as
?comando
? One come on, it still goes on, but so many...– Rui Barradas
Sorry, I was going to see the columns.
– Rodolfo Marchesi
I ended up using Summary
– Rodolfo Marchesi
? serves to ask questions, I’m beginner.
– Rodolfo Marchesi
Comdinheiro_ufespro_capm$petr_capm_res_L <- c(NA,Comdinheiro_ufespro_capm$petr_capm_res[-nrow(Comdinheiro_ufespro_capm)])
– Rodolfo Marchesi
The above command gave me no return, could you tell me why?
– Rodolfo Marchesi