r - calculate likelihood for each observation -
i'm trying apply bayesian computation on normal data unknown mean , variance(sigma^2) using gelman et.al approach. :first draw sigma^2 draw mean. have done , have list of mean , list of sigma^2. next step calculate normal likelihood each observation given mean , variance sampled. tried write in r receive warning message r can't find mean (mu) , variance (sigma^2) .
i'm new @ r appreciated.
likelihood <- function(y,mu,sigma2){ singlelikelihoods = dnorm(y, mean = mu, sd = sigma2, log = t) sumall = sum(singlelikelihoods) return(sumall) }
update: data derived this ode after add noise , part of final data
[1,] 376146486 [2,] 376149990 [3,] 376153576 [4,] 376157235 [5,] 376160957 [6,] 376164727 [7,] 376168539 [8,] 376172379 [9,] 376176240 [10,] 376180117 [11,] 376183996 [12,] 376187877 [13,] 376191751 [14,] 376195612 [15,] 376199457 [16,] 376203286 [17,] 376207091 [18,] 376210873 [19,] 376214630 [20,] 376218357 [21,] 376222058 [22,] 376225728 [23,] 376229370 [24,] 376232980 [25,] 376236562 [26,] 376240114 [27,] 376243635 [28,] 376247127 [29,] 376250590 [30,] 376254025 [31,] 376257432 [32,] 376260812 [33,] 376264164 [34,] 376267491 [35,] 376270791 [36,] 376274066 [37,] 376277317 [38,] 376280541 [39,] 376283745 [40,] 376286923
Comments
Post a Comment