Normal-Distribution

估計標準偏差與自變量縮放的比率

  • January 9, 2015

我有一個實驗,我正在測量一個正態分佈的變量,

然而,先前的實驗已經提供了一些證據表明標準差是自變量的仿射函數, IE

我想估計參數和通過抽樣在多個值. 此外,由於實驗限制,我只能採集有限(大約 30-40)個樣本,並且更願意在幾個值上採樣由於不相關的實驗原因。鑑於這些限制,有哪些方法可用於估計和?

實驗說明

如果您對我問上述問題的原因感興趣,這是額外的信息。我的實驗測量聽覺和視覺空間感知。我有一個實驗裝置,我可以在其中呈現來自不同位置的聽覺或視覺目標,, 主體指示目標的感知位置,. 隨著偏心率的增加(即增加),我將其建模為多於。最後,我想估計和視覺和聽覺,所以我知道空間中各種位置的每種感覺的精確度。這些估計將用於預測同時呈現時視覺和聽覺目標的相對權重(類似於此處介紹的多感官整合理論:http ://www.ncbi.nlm.nih.gov/pubmed/12868643 )。

*我知道在將中心凹與中心凹外空間進行比較時,這個模型對於視覺來說是不准確的,但我的測量僅限於中心凹外空間,這是一個不錯的近似值。

在像您這樣的情況下,您有一個相對簡單但“非標準”的生成模型來估計參數,我的第一個想法是使用像Stan這樣的貝葉斯推理程序。您給出的描述將非常乾淨地轉換為 Stan 模型。

一些示例 R 代碼,使用 RStan(Stan 的 R 接口)。

library(rstan)

model_code <- "
data {
int<lower=0> n; // number of observations
real y[n];
real x[n];
}
parameters {
real mu; // I've assumed mu is to be fit.
// Move this to the data section if you know the value of mu.
real<lower=0> a;
real<lower=0> b;
}
transformed parameters {
real sigma[n];
for (i in 1:n) {
sigma[i] <- a + b * fabs(x[i]);
}
}
model {
y ~ normal(mu, sigma);
}
"

# Let's generate some test data with known parameters

mu <- 0
a <- 2
b <- 1

n <- 30
x <- runif(n, -3, 3)
sigma <- a + b * abs(x)
y <- rnorm(n, mu, sigma)

# And now let's fit our model to those "observations"

fit <- stan(model_code=model_code,
           data=list(n=n, x=x, y=y))

print(fit, pars=c("a", "b", "mu"), digits=1)

你會得到看起來像這樣的輸出(儘管你的隨機數可能與我的不同):

Inference for Stan model: model_code.
4 chains, each with iter=2000; warmup=1000; thin=1; 
post-warmup draws per chain=1000, total post-warmup draws=4000.

  mean se_mean  sd 2.5%  25% 50% 75% 97.5% n_eff Rhat
a   2.3       0 0.7  1.2  1.8 2.2 2.8   3.9  1091    1
b   0.9       0 0.5  0.1  0.6 0.9 1.2   1.9  1194    1
mu  0.1       0 0.6 -1.1 -0.3 0.1 0.5   1.4  1262    1

Samples were drawn using NUTS(diag_e) at Thu Jan 22 14:26:16 2015.
For each parameter, n_eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor on split chains (at 
convergence, Rhat=1).

該模型收斂良好(Rhat=1),有效樣本量(n_eff)在所有情況下都相當大,因此在技術層面上該模型表現良好。的最佳估計,和(在平均欄中)也與所提供的非常接近。

引用自:https://stats.stackexchange.com/questions/132848

comments powered by Disqus