normlklhd: Log-likelihood for a Gaussian random walk model

Description Usage Arguments Details Value Examples

View source: R/Fry_bubble.R

Description

This function computes the log-likelihood for a Gaussian random walk model

Usage

1

Arguments

x

is a n x 1 numeric data vector

Details

This function computes the log-likelihood for the Gaussian random walk model. It is used as a benchmark in Fry (2014)

Value

y a 1 x 1 scalar which is the log-likelihood

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 ## Not run: 
 #Create data set with log-returns
 library(PerformanceAnalytics)
 path.bit=system.file("extdata", "coindesk-bpi-USD-close.csv", package = "bubble")

 #load data on bitcoin downloaded from coindesk:  http://www.coindesk.com/price/
 dat <- read.table(path.bit, dec = ".", sep =",", header = TRUE)
 dat2 <- subset(dat, as.numeric(Date) > 898 & as.numeric(Date) < 1233)
 row.names(dat2) <- levels(dat2$Date)[dat2$Date]
 dat3 <- dat2[, 'Close', drop=FALSE]

 #compute log-returns
 bitret <- CalculateReturns(dat3, method="log")
 bitret = bitret[-1,]
 plot(bitret)
 plot(cumsum(bitret))

 #Compute the log-likelihood of the Gaussian random walk model as a benchmark
 normlklhd(bitret)
 
## End(Not run)

deanfantazzini/bubble documentation built on Oct. 22, 2020, 2:43 p.m.