Question

How to find in R constant term c of log likelihood for given vectors x(1 x...

How to find in R constant term c of log likelihood for given vectors x(1 x n) and y(1 x n)? Normal distribution.

wGgQd+n3dsftwAAAABJRU5ErkJggg==

As c does not depend on β or σ, these parameters can be ignored.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

R-Code:

# function for calculating log likelihood
l <- function(beta, sigma^2, X, y)
{
c <- 1 # constant value of c
# computing the likelihood
result <- ((-nlogσ-(1/2sigma^2)(y-Xbeta)^T(y-Xbeta) +c)
# return the result
return(result)
}

# number of rows of matrix X
N <- 2
# number of columns of matrix X and also for vector y
M <- 10

# initializing the matrix X with normal distribution with mean 0 and standard deviation 1
X <- matrix( rnorm(N*M,mean=0,sd=1), N, M)
# initializing the vector y with normal distribution with mean 0 and standard deviation 1
y <- rnorm(M, mean=0, sd=1)
# initializing vector beta
beta <- c(0.1,0.2)
# calling function l to compute likelihood
likely = l(beta, sigma^2, X, y)

I don't have R-studio software. Please execute the above code in R-studio. If have any queries, please let me know that queries. thank you.

Add a comment
Know the answer?
Add Answer to:
How to find in R constant term c of log likelihood for given vectors x(1 x...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT