Every time I think I know what's going on, suddenly there's another layer of complications.
2019年3月6日星期三
2019年3月5日星期二
Lagrange Multipliers
We can connect Lagrange to Ridge and Lasso Regression.
http://www.math.harvard.edu/archive/21a_spring_09/PDF/11-08-Lagrange-Multipliers.pdf
http://www.math.harvard.edu/archive/21a_spring_09/PDF/11-08-Lagrange-Multipliers.pdf
2019年3月3日星期日
2019年2月23日星期六
Re-Dock the Explorer/Results Window in SAS
Solution:
For Explorer window: Use menu View >> Contents Only.
For Results window: Use menu View >> Results.
2019年2月21日星期四
multiple ampersand for SAS macro
When macro variables contain the name of another macro variable or pieces of names of other macro variables the resulting code will often contain two (or more!!) ampersands.
2019年1月31日星期四
A Gibbles sampler for Hierarchical Bayes
hieracrh1<-function(nsims,x,tau,kstart){
bold<-1
clambda<-rep(0,(nsims+kstart))
cb<-rep(0,(nsims+kstart))
for(i in 1: (nsims+kstart))
{clambda[i]<-rgamma(1,shape=(x+1),scale=(bold/(bold+1)))
newy<-rgamma(1,shape=2,scale=(tau/(clambda[i]*tau+1)))
cb[i] <-1/newy
bold<-1/newy
}
gibbslambda<-clambda[(kstart+1):(nsims+kstart)]
gibbsb<-cb[(kstart+1):(nsims+kstart)]
out<-list(clambda=clambda, cb=cb,gibbslambda=gibbslambda,gibbsb= gibbsb)
return(out)
}
mean(hieracrh1(4000,6,0.04,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.045,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.05,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.055,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.06,1000)$gibbslambda)
bold<-1
clambda<-rep(0,(nsims+kstart))
cb<-rep(0,(nsims+kstart))
for(i in 1: (nsims+kstart))
{clambda[i]<-rgamma(1,shape=(x+1),scale=(bold/(bold+1)))
newy<-rgamma(1,shape=2,scale=(tau/(clambda[i]*tau+1)))
cb[i] <-1/newy
bold<-1/newy
}
gibbslambda<-clambda[(kstart+1):(nsims+kstart)]
gibbsb<-cb[(kstart+1):(nsims+kstart)]
out<-list(clambda=clambda, cb=cb,gibbslambda=gibbslambda,gibbsb= gibbsb)
return(out)
}
mean(hieracrh1(4000,6,0.04,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.045,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.05,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.055,1000)$gibbslambda)
mean(hieracrh1(4000,6,0.06,1000)$gibbslambda)
2019年1月1日星期二
Install R package from the source
install.packages("path\file", repos = NULL, type="source")
Where
path_to_file
would represent the full path and file name:- On Windows it will look something like this:
"C:\\RJSONIO_0.2-3.tar.gz"
. - On UNIX it will look like this:
"/home/blah/RJSONIO_0.2-3.tar.gz"
订阅:
博文 (Atom)