34 views

Skip to first unread message

May 24, 2017, 2:15:44 PM5/24/17

to Stan users mailing list

Hey stan Team,

what would be the smartest way do do global regression in stan? The model block seems to something else than intended. It defently doesn't boost the precision of my fit.

Thanx for any comment.

Jan

data {

int<lower=1> N_data; // number of data points

int<lower=0, upper = 1000> y_t1[N_data]; // array of observations

int<lower=0, upper = 1000> y_t2[N_data]; // Array of observations

real<lower=0, upper = 10> time[N_data]; //predictor

int N_channel;

}

transformed data{ // ... declarations ... statements ...

}

parameters { // The parameters we want to inference by via Stan

simplex[2] mu;

positive_ordered[2] theta;

}

transformed parameters { // ... declarations ... statements ...

real<lower = 0, upper = 1> probabilty[N_data]; // fitted values

for(i in 1:N_data){

probabilty[i] = 1 - mu[1] * exp(-theta[1] * time[i])- mu[2]* exp(-theta[2]*time[i]);

}

}

model {

......

y_t1 ~ binomial(N_channel, probabilty);

y_t2 ~ binomial(N_channel, probabilty);

}

May 24, 2017, 2:33:00 PM5/24/17

to stan-...@googlegroups.com

What's a "global regression"?

Your model can't be right because there's nothing insuring

your "probability" value falls in (0, 1).

There are lots of regression examples in the manual chapter

on regression and more in the case studies (web site under

docs) and example-models (ditto).

- Bob

P.S. This list is shutting down and moving to:

http://discourse.mc-stan.org

> --

> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.

> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.

> To post to this group, send email to stan-...@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.

Your model can't be right because there's nothing insuring

your "probability" value falls in (0, 1).

There are lots of regression examples in the manual chapter

on regression and more in the case studies (web site under

docs) and example-models (ditto).

- Bob

P.S. This list is shutting down and moving to:

http://discourse.mc-stan.org

> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.

> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.

> To post to this group, send email to stan-...@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.

May 24, 2017, 4:13:47 PM5/24/17

to stan-...@googlegroups.com

Hi Bob,

hmm maybe I don't use the right terms. By global I mean that I use not just one time series of data but several which I want to use for inferencing the posterior of the model. > model {

>

> ......

> y_t1 ~ binomial(N_channel, probability);

> y_t2 ~ binomial(N_channel, probability);

>

> }

seems not to do this job. So I guess I am using the sampling statement wrong. By writing two times the likelihood. The probability variable just worked fine for a single trace of data and stayed in the half open interval (0,1] as the stan output told me. And I expect that to be as long as "mu" is element of a simplex, "time_i" "theta_i" all bigger the zero. Hm I guess I am getting you wrong... hmm maybe I don't use the right terms. By global I mean that I use not just one time series of data but several which I want to use for inferencing the posterior of the model. > model {

>

> ......

> y_t1 ~ binomial(N_channel, probability);

> y_t2 ~ binomial(N_channel, probability);

>

> }

Anyways have a good afternoon

> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

> To post to this group, send email to stan-...@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.

--

You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/gEkegRSrUWA/unsubscribe.

To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

May 25, 2017, 5:02:00 PM5/25/17

to stan-...@googlegroups.com

> On May 24, 2017, at 4:13 PM, Jan Münch <jan.lenna...@gmail.com> wrote:

>

> Hi Bob,

> hmm maybe I don't use the right terms. By global I mean that I use not just one time series of data but several which I want to use for inferencing the posterior of the model. > model {

> >

> > ......

> > y_t1 ~ binomial(N_channel, probability);

> > y_t2 ~ binomial(N_channel, probability);

> >

> > }

>

> seems not to do this job.

number of trials and same success probability.

> So I guess I am using the sampling statement wrong. By writing two times the likelihood. The probability variable just worked fine for a single trace of data

> and stayed in the half open interval (0,1] as the stan output told me. And I expect that to be as long as "mu" is element of a simplex, "time_i" "theta_i" all bigger the zero. Hm I guess I am getting you wrong...

> probabilty[i] = 1 - mu[1] * exp(-theta[1] * time[i])- mu[2]* exp(-theta[2]*time[i]);

to have zero successes (and even then I'm not sure we handle the probability=0

case as it's degenerate).

- Bob

> > To post to this group, send email to stan-...@googlegroups.com.

> > For more options, visit https://groups.google.com/d/optout.

>

> --

> You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.

> To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/gEkegRSrUWA/unsubscribe.

> To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

>

> --

> You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.

> To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/gEkegRSrUWA/unsubscribe.

> To post to this group, send email to stan-...@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.

>

>

> --

> For more options, visit https://groups.google.com/d/optout.

>

>

> --

> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.

> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu