blinreg function in R

Hello,

I am trying to use blinreg function in R but I haven't got papers and videos about it. The R-documentation is not even clear; it doesn't have worked examples.
I have got a continuous response variable with two explanatory variables (one continuous and one categorical). Using a uniform prior on the regression parameters (b0, b1, b2), I want to use blinreg to simulate an MC sample of 1000 draws from the joint posterior distribution of (beta, sigmasquare) and then to estimate the summary statistics.

I really appreciate your help.
Regards

Hi @teketo! Welcome!

The LearnBayes package (where blinreg() is found) is the companion package to the book Bayesian Computation with R by Jim Albert. The book website links to resources that might help you, including:

In case you’re asking this question in connection with work for a class of some sort, please do be aware of our Homework Policy. If you’re looking for more specific help with a problem in your code, the best place to start is by reading our FAQ: Tips for writing R-related questions.

1 Like

Thank you for the details.

I haven't got clearly examples on how to specify the priors in blinreg; the examples I have got used non-informative priors.
I just want how informative priors be used in blinreg with examples, which I couldn't find any.
Moreover, can I get clear idea about the design matrix - x?

Thanks

The documentation for blinreg() says that it:

Gives a simulated sample from the joint posterior distribution of the regression vector and the error standard deviation for a linear regression model with a noninformative or g prior.

I’m not sure if a g prior is what you mean by “informative prior”? If so, then the information you want is in this part of the docs for blinreg():

Usage
blinreg(y,X,m,prior=NULL)
Arguments
y vector of responses
X design matrix
m number of simulations desired
prior list with components c0 and beta0 of Zellner's g prior

Reading this sort of documentation takes some getting used to, and this is a particularly terse example. That may be because this is a book companion package, and it’s assumed you will be reading the book where more explanation may be offered (I don’t know, I don’t have a copy of that book at hand).

But putting together the two sections above, we can see that the default for the prior parameter is NULL. This is why in basic examples, you don’t even see the prior parameter used — if a parameter has a default, you don’t have to specify it when calling the function unless you want something different from the default.

By inference (here’s where the docs could be clearer!), prior = NULL corresponds to an uninformative prior. To call blinreg() with a g prior, we need to follow the instructions above and provide a list with certain named components as the prior parameter, like:
prior = list(c0 = , beta0 = )
with your desired values or calculations in the blanks.

I’m afraid I don’t quite know what you’re looking for here. Can you describe what you’re confused about in more detail, or give a small example?