HI, my quick hack would be to take the logit of the variable after transforming to a 0.5 to 4.5 scale, that is, work with logit((y - 0.5)/4). This will make it continuous and will spread out the extremes a bit. Of course it won't give correct predictions but otherwise it could do what you need. If it works (or if it doesn't), please let me know! A
But maybe you meant something stronger. At any rate, I think I
need to hit a little closer to the mark. Of most relevance for my
purposes, it seems likely that predicted effects will cause a
bigger shift in the outcome--namely a flip from one extreme to the
other--than a better model would show.
Here are the two distributions:
> quantile(simvals, probs=seq(0, 1, .05)) # simulated from the model
0% 5% 10% 15% 20% 25% 30% 35%
0.5000000 0.5002916 0.5022871 0.5089260 0.5259889 0.5634938 0.6390487 0.7803809
40% 45% 50% 55% 60% 65% 70% 75%
1.0294206 1.4209338 1.9705903 2.6217905 3.2569433 3.7685059 4.1151658 4.3187676
80% 85% 90% 95% 100%
4.4245009 4.4738727 4.4933017 4.4991461 4.5000000
> quantile(tfat$FrndPartRace, probs=seq(0, 1, .05)) # original data
0% 5% 10% 15% 20% 25% 30% 35%
1.000000 1.000000 1.000000 1.000000 1.000000 1.333333 1.666667 1.666667
40% 45% 50% 55% 60% 65% 70% 75%
1.666667 2.000000 2.000000 2.000000 2.000000 2.333333 2.333333 2.666667
80% 85% 90% 95% 100%
2.666667 3.000000 3.000000 3.333333 4.000000
Ross
data {
int<lower=0> N; // number of respondents
int<lower=0> J; //number of covariates
int<lower=0> NSD; // number of classes of beta for sd
int<lower=1,upper=NSD> SDClass[J]; // beta[j, k] has sigma_beta[SDClass[j]]
int<lower=0> NCLUSTER; //number of seeds
int iCluster[N]; // cluster id
matrix[N, J] x; // covariates
vector<lower=1,upper=4>[N] y; // outcome
}
transformed data {
vector<lower=0,upper=1>[N] z;
z <- y/5.0;
}
parameters {
vector[J] beta_raw; // standard covariate coefficients
vector[NCLUSTER] alpha_raw; // cluster effects
real<lower=0> nu; // 'size' parameter
real<lower=0> sigma_alpha;
real<lower=0> sigma_beta[NSD];
}
transformed parameters {
vector[J] beta;
vector[NCLUSTER] alpha;
for(ir in 1:J) {
beta[ir] <- beta_raw[ir]*sigma_beta[SDClass[ir]];
}
alpha <- alpha_raw*sigma_alpha;
}
model {
vector[N] mu;
vector[N] parm1;
vector[N] parm2;
nu ~ cauchy(0, 5); //maybe it should start above 0
sigma_alpha ~ cauchy(0, 5);
sigma_beta ~ cauchy(0, 5);
beta_raw[1] ~ uniform(-5, 5);
for (j in 2:J) {
beta_raw[j] ~ normal(0, 1);
}
alpha_raw ~ normal(0, 1);
for (n in 1:N) {
mu[n] <- inv_logit((x[n] * beta)+alpha[iCluster[n]]);
}
parm1 <- mu*nu;
parm2 <- (1-mu)*nu;
z ~ beta(parm1, parm2);
}
parm1 and parm2 don't have declared data type, which seems to
contradict the first sentence of section 21 of the manual. Is
that a problem?Ross