Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

my.dgamma.log()generates the log of the probability density of the Gamma distribution. Use?lgammato understand what it does. Note that this is exactly equal to the functiondgamma(...,

my.dgamma.log()generates the log of the probability density of the Gamma distribution. Use?lgammato understand what it does. Note that this is exactly equal to the functiondgamma(..., log=TRUE)so use this to verify your answers.

The function to be debugged:

my.dgamma.log <- function(xx, shape, rate) { shape*log(rate) - lgamma(shape) + (shape-1)*xx - rate*xx } 

The testing code:

my.dgamma.log(seq(0.2, 5, by=0.2), shape=0.2, rate=5) dgamma(seq(0.2, 5, by=0.2), shape=0.2, rate=5, log=TRUE) my.dgamma.log (seq(0.4, 10, by=0.4), shape=0.2, rate=5) my.dgamma.log (seq(1, 10, by=0.2), shape=2, rate=6) 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Precalculus Enhanced With Graphing Utilities (Subscription)

Authors: Michael, Michael Sullivan III, Michael III Sullivan, III Sullivan

6th Edition

0321849108, 9780321849106

More Books

Students also viewed these Mathematics questions