Can I use the 'sn' (skewed normal) function in BRUGS?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Can I use the 'sn' (skewed normal) function in BRUGS?

Gwendolyn Campbell
Hi,
My colleagues and I have data from an experiment (3 levels of IV; approximately 14-20 participants per condition).  We think the data come from one or more (hopefully more!) skewed populations.  I have downloaded the 'sn' package into the R library folder - now I'm trying to modify your code from ANOVAonewayNonhomogvarBrugs.R to use dsn instead of dnorm.  Is this possible?  Is it reasonable?  We're new to the "Bayesian way" and I would greatly appreciate any help or advice.  Thanks so much!  :)
--Gwen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can I use the 'sn' (skewed normal) function in BRUGS?

John K. Kruschke
Administrator

First, I strongly prefer using JAGS instead of BUGS. JAGS is more stable and offers a little more flexibility. The model specifications language is nearly identical. Search the blog for various posts about converting from BUGS to JAGS.

Now, on to your question: You can define likelihood functions that are not built into JAGS by using the "Bernoulli ones trick" or the "Poisson zeros trick". Search the web for examples, When trying it out yourself, start with simple examples to test out the idea. Then build up to your real application.

Other readers should feel free to reply with more detailed suggestions!

Let us know how it goes.

On Mon, Jul 1, 2013 at 9:21 AM, Gwendolyn Campbell [via Doing Bayesian Data Analysis] <[hidden email]> wrote:
Hi,
My colleagues and I have data from an experiment (3 levels of IV; approximately 14-20 participants per condition).  We think the data come from one or more (hopefully more!) skewed populations.  I have downloaded the 'sn' package into the R library folder - now I'm trying to modify your code from ANOVAonewayNonhomogvarBrugs.R to use dsn instead of dnorm.  Is this possible?  Is it reasonable?  We're new to the "Bayesian way" and I would greatly appreciate any help or advice.  Thanks so much!  :)
--Gwen


If you reply to this email, your message will be added to the discussion below:
http://doing-bayesian-data-analysis.12272.x6.nabble.com/Can-I-use-the-sn-skewed-normal-function-in-BRUGS-tp5000677.html
To start a new topic under Doing Bayesian Data Analysis, email [hidden email]
To unsubscribe from Doing Bayesian Data Analysis, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can I use the 'sn' (skewed normal) function in BRUGS?

Gwendolyn Campbell
Thanks - I'll see what I can do re. JAGS, and the "Bernoulli ones trick" or the "Poisson zeros trick".
--Gwen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Can I use the 'sn' (skewed normal) function in BRUGS?

Gwendolyn Campbell
Well, it took a while, but I switched to JAGS and I have the code for the Poison zeros trick running with the log probability density function for a skewed normal (sn) distribution with parameters location, scale and shape.  

The problem is that I've been testing it on data created with the "rsn" function and it is not returning the parameters that I used to create the data.  I've manipulated the size of the data set (up to 500 data points) and a bunch of the other stuff (distribution of priors, prior initial values, modeling parameters like # of chains, etc.) but nothing "works" as far as returning my actual distribution parameters.  

I've checked my formula multiple times and it appears to be correct.  

Any thoughts about what might be going on and/or what I should check or change?  

Thanks,
Gwen
Loading...