Parameters standard error using ML or Bayesian analysis
This article was originally posted in my previous blog Let data that you suppose being distributed as Gaussian distribution. # Generate 100 values from Gaussian distribution val=rnorm(100, mean=20, sd=5) If you want know the mean and sd of the underlying Gaussian distribution, you can use directly mean() and sd() however you will not know the distribution of the mean and SD (ie. if the mean and SD are well known). mean(val); sd(val) To get the distribution of both mean and SD (and then their confidence interval), you can use maximum likelihood and the SE of the point estimates can be obtained from the square root of the inverse of the Hessian matrix. Let do it: # Return -ln L of values in val in Gaussian distribution with mean and sd in par fitnorm<-function(par, val) { -sum(dnorm(val, par["mean"], par["sd"], log = TRUE)) } # Initial values for search p<-c(mean=20, sd=5) # fit the model result <- optim(par=p, fn=fitnorm, val=val, metho...