2019年3月6日星期三

Row vector is a function

A row vector is a function takes a column vector  as input and produce a scalar

LOESS/LOWESS Algorithm

https://www.weisang.com/en/documentation/loessandlowessalgorithm_en/

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






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)