Description Usage Arguments Details Value Author(s) Examples
This function generates a posterior density sample from a parametric linear regression model using a normal distribution of the errors.
1 2 |
formula |
a two-sided linear formula object describing the
model fit, with the response on the
left of a |
prior |
a list giving the prior information. The list includes the following
parameter: |
mcmc |
a list giving the MCMC parameters. The list must include
the following integers: |
state |
a list giving the current value of the parameters. This list is used if the current analysis is the continuation of a previous analysis. |
status |
a logical variable indicating whether this run is new ( |
data |
data frame. |
na.action |
a function that indicates what should happen when the data
contain |
This generic function fits a linear regression model:
yi = Xi beta + Vi, i=1,…,n
Vi | sigma2 ~ N(0,sigma2)
To complete the model specification, independent hyperpriors are assumed,
beta | beta0, Sbeta0 ~ N(beta0,Sbeta0)
sigma^-2 | tau1, tau2 ~ Gamma(tau1/2,tau2/2)
An object of class Plm
representing the parametric linear regression
model fit. Generic functions such as print
, plot
,
summary
, and anova
have methods to show the results of the fit.
The results include beta
, and sigma2
.
The list state
in the output object contains the current value of the parameters
necessary to restart the analysis. If you want to specify different starting values
to run multiple chains set status=TRUE
and create the list state based on
this starting values. In this case the list state
must include the following objects:
beta |
giving the value of the regression coefficients. |
sigma2 |
giving the error variance. |
Alejandro Jara <atjara@uc.cl>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | ## Not run:
############################################
# The Australian Institute of Sport's data
############################################
data(sports)
attach(sports)
# Initial state
state <- NULL
# MCMC parameters
nburn <- 5000
nsave <- 10000
nskip <- 20
ndisplay <- 100
mcmc <- list(nburn=nburn,nsave=nsave,nskip=nskip,
ndisplay=ndisplay)
# Prior information
prior <- list(beta0=rep(0,3),
Sbeta0=diag(1000,3),
tau1=0.01,
tau2=0.01)
# Fit the model
fit <- Plm(formula=bmi~lbm+gender,prior=prior,mcmc=mcmc,
state=state,status=TRUE)
# Summary with HPD and Credibility intervals
summary(fit)
summary(fit,hpd=FALSE)
# Plot model parameters (to see the plots gradually set ask=TRUE)
plot(fit)
plot(fit,nfigr=2,nfigc=2)
# Table of Pseudo Contour Probabilities
anova(fit)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.