Learn R Programming

PWD (version 1.0)

loglik.norm.LR.Rcpp: Compute Marginal Predictive Loglikelihood of Data Given alpha

Description

This function computes the marginal predictive loglikelihood of the observed data given a particular value of alpha, and the time point to begin computing marginal predictive loglikelihoods.

Usage

loglik.norm.LR.Rcpp(y, X = FALSE, alpha, init)

Arguments

y
T-length time series vector. y[1] represents the beginning of the time eries.
X
[T x p] dimensional matrix of covariates. This should not include the intercept column. If X is FALSE, intercept model is run.
alpha
PWD parameter we are calculating the marginal predictive loglikelihood for.
init
integer representing the time point to begin computing marginal predictive loglikelihood.

Value

Return a scalar value representing the marginal predictive loglikelihood of the data given alpha.

Examples

Run this code
N=80
err = rnorm(N)
X = 1:N
slopes = c(rep(1.5,40),rep(2,N-40))
y = rep(5,N) + slopes*X + err                  
init=4
alpha.grid = seq(.65,1,length.out=40)
i=40
loglik.norm.LR.Rcpp(y,X=X,alpha=alpha.grid[i],init=init)

Run the code above in your browser using DataLab