-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/car #322
base: master
Are you sure you want to change the base?
feature/car #322
Conversation
I forgot to drop that requirement. It was being used for |
vector[order == 2 ? Q_n[1] : 0] w; | ||
int v[order == 2 ? Q_n[1] : 0]; | ||
int u[order == 2 ? N+1 : 0]; | ||
// prior stuff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this all be handled by a #include /data/hyperparameters.stan
like many of the other Stan programs?
else if (model_type == 3) | ||
psi = tau*(sqrt(1-rho[1])*theta_raw + sqrt(rho[1]/scaling_factor)*phi); | ||
// for regression coefficients | ||
// "tparameters.stan" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be subsumed with a #include
?
} | ||
/* else prior_dist is 0 and nothing is added */ | ||
|
||
// Log-prior for intercept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be subsumed with a #include /model/priors_glm.stan
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to separate out the intercept part of a GLM prior
$$ | ||
where $\alpha$ is the intercept, $\mathbf{X}$ is an $N$-by-$K$ matrix of predictors ($N$ being the number of observations and $K$ being the number of predictors), $\boldsymbol{\beta}$ is a $K$-dimensional vector of regression coefficients, and $\boldsymbol{\psi}$ is a $N$-dimensional vector representing the spatial effect. The construction of $\boldsymbol{\psi}$ depends on the model, which is discussed in the relevant sections below. | ||
|
||
Depending on the choice of likelihood there may or may not be an additional auxiliary parameter $\gamma$ in the model (e.g. in a Gaussian likelihood this would be the variation of the data). With all these components, for some probability density/mass function $f$, we can state the general form of the likelihood as, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's aux
in the stan model but I think this maps to different things depending on the likelihood (e.g. it's sigma in the gaussian case).
|
||
## GMRF Hierarchical Component | ||
|
||
CAR models require that you define the spatial component as a Gaussian Markov Random Field (GMRF). The random vector $\boldsymbol{\phi}$ is a GMRF with respect to the graph $\mathcal{G} = (\mathcal{V} = \{1,\ldots,n\},\mathcal{E})$ with mean vector $\boldsymbol{\mu}$ and precision matrix $\mathbf{W}$ if its probability density function takes the precision form of the multivariate normal distribution, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we include an image for a small graph like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like you want to include a plot of the lattice? I have that in there if you build the vignette.
|
||
## An Example Using Simulated Data on a Lattice | ||
|
||
As an example we use spatial units defined on a lattice. Below we plot a GMRF of 900 spatial units available in the rstanarm package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rstanarm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in bold I mean
Got a bunch of things from |
Ah, I must have had eval = FALSE set.
…On Sun, Oct 28, 2018 at 4:50 PM Imad Ali ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In vignettes/spatial.Rmd
<#322 (comment)>:
> +
+The linear predictor takes the following form,
+$$
+\boldsymbol{\eta} = \alpha + \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\psi}
+$$
+where $\alpha$ is the intercept, $\mathbf{X}$ is an $N$-by-$K$ matrix of predictors ($N$ being the number of observations and $K$ being the number of predictors), $\boldsymbol{\beta}$ is a $K$-dimensional vector of regression coefficients, and $\boldsymbol{\psi}$ is a $N$-dimensional vector representing the spatial effect. The construction of $\boldsymbol{\psi}$ depends on the model, which is discussed in the relevant sections below.
+
+Depending on the choice of likelihood there may or may not be an additional auxiliary parameter $\gamma$ in the model (e.g. in a Gaussian likelihood this would be the variation of the data). With all these components, for some probability density/mass function $f$, we can state the general form of the likelihood as,
+
+$$
+\mathcal{L}(\alpha, \boldsymbol{\beta}, \gamma | \mathbf{y}) = \prod_{i=1}^N f(y_i | \alpha, \boldsymbol{\beta}, \gamma )
+$$
+
+## GMRF Hierarchical Component
+
+CAR models require that you define the spatial component as a Gaussian Markov Random Field (GMRF). The random vector $\boldsymbol{\phi}$ is a GMRF with respect to the graph $\mathcal{G} = (\mathcal{V} = \{1,\ldots,n\},\mathcal{E})$ with mean vector $\boldsymbol{\mu}$ and precision matrix $\mathbf{W}$ if its probability density function takes the precision form of the multivariate normal distribution,
Like you want to include a plot of the lattice? I have that in there if
you build the vignette.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADOrqlcmrkxFaNR0hiT4iMMwDyxzV4q8ks5uphiCgaJpZM4X-FS1>
.
|
@bgoodri thanks for bringing this up-to-date. I'll try to take a look over the weekend to see if I've left anything hanging. |
Just checking in on this. Any status update? |
I think we can merge new .stan files again now that Windows can be tricked
into using LTO.
…On Mon, Nov 30, 2020 at 2:40 PM Jonah Gabry ***@***.***> wrote:
Just checking in on this. Any status update?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#322 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ2XKXAH3YTPQNMQW6LJM3SSPYMPANCNFSM4F7YKS2Q>
.
|
Does that mean we can also finally merge the survival stuff? |
Maybe
…On Mon, Nov 30, 2020 at 6:53 PM Jonah Gabry ***@***.***> wrote:
Does that mean we can also finally merge the survival stuff?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#322 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZ2XKSJ23VU2JFNHMWVHLLSSQWAJANCNFSM4F7YKS2Q>
.
|
This is almost ready to go. But before it gets merged there are a couple of issues that I need help with.
loo
doesn't work forbinomial(link="log")
but it works for the other link functions in the binomial family.test_pp_validate.R
)