No such file or directory

0

Good afternoon guys, I do a 1 finance class in my college that needs the R to do the activities. My computer gives a No such file or directory error. My teachers have already tried to fix it and they have not been able to and the recommendation they gave me was to format my computer. I'll leave the code here and the error it gives in my R.

THIS IS THE CODE I USE

# Análise de Dados
#
setwd("C:/Financas") # Salvar na pasta
base = read.table("dados.txt", header=TRUE)
#
head(base)
tail(base)
#
data      = base$DATA
precoibv  = base$IBOVESPA
precopet  = base$PETROBRAS
precoitau = base$ITAU
#
retibv    = diff( log(precoibv) )
retpet    = diff( log(precopet) )
retitau   = diff( log(precoitau) )
#
par( mfrow=c(1,2) )   
hist( retpet,nclass=30 )         
plot( density( retpet ) )
#
par( mfrow=c(1,3) ) 
plot(retpet, type='l')
plot( density( retpet ) )
plot( ecdf( retpet ) ) #Empirical Cumulative Distribution Function
#
d1      = density(retpet)  # Obtém a densidade
range(retpet)  # Maior e o menor retorno
#
x       = seq(-.13,.11,.001) # Alterar conforme o range - cria uma sequencia com incremento de 0.001.
y1      = dnorm(x,mean(retpet),stdev(retpet))
#
plot(d1$x,d1$y,xlab='retorno',ylab='densidade',type='l')
lines(x,y1,lty=2)
legend("topleft", c("Empírica", "Normal"), lwd=1:2, lty=1:2)
#
qqnorm(retpet)
qqline(retpet)

#Medidas Estatísticas das distribuições de probabilidades#

mean( retpet )      # Média
var( retpet )       # Variância
stdev( retpet )     # Desvio Padrão
skewness( retpet )  # Assimetria
kurtosis( retpet )  # Curtose

max( retpet )       # Máximo
min( retpet )       # Mínimo

#Teste Estatístico - Ho: retorno ~ normal

normalTest(retpet, method = 'jb') #Jarque-Bera
normalTest(retpet, method = 'sw') #Shapiro-Wilks

#Correlações

m        = cbind(retibv, retpet, retitau) #Matriz
cor(m)

THIS IS THE ERROR THAT IN MY COMPUTER

  

setwd ("C: / Finance") # Save to folder

     
    

base = read.table ("data.txt", header = TRUE) Error in file (file, "rt"):     file (file, "rt"): could not open file 'data.txt': No     such file or directory

  
    
asked by anonymous 22.03.2018 / 17:32

0 answers