I am using a gam model based on the mgcv package to estimate both mean and sd e.g.
b<-gam(list(Y~s(X1)+s(X2)+s(X3),~s(X1)+s(X2)+s(X3)), family=gaulss(),data=