Description Usage Arguments Value Author(s) References See Also Examples
This function produces the full, high-dimensional gradient and Hessian from the base-distribution derivatives for linear transformations of the arguments of a single-parameter base distribution.
1 | regfac.expand.1par(beta, X, y, fbase1, fgh=2, ...)
|
beta |
Vector of coefficients in the regression model. |
X |
Matrix of covariates in the regression model. Note that |
y |
Vector of response variable in the regression model. Note that |
fbase1 |
Base distribution function |
fgh |
Integer with possible values 0,1,2. If |
... |
Other parameters to be passed to |
A list with elements f,g,h
corresponding to the function, gradient vector, and Hessian matrix of the function fbase(X%*%beta,y)
, i.e. the base function fbase(u,y)
projected onto the high-dimensional space of beta
through the linear transformation of its first argument (u <- X%*%beta
).
Alireza S. Mahani, Mansour T.A. Sharabiani
Mahani, Alireza S. and Sharabiani, Mansour T.A. (2013) Metropolis-Hastings Sampling Using Multivariate Gaussian Tangents https://arxiv.org/pdf/1308.0657v1.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
library(sns)
# simulating logistic regression data
N <- 1000 # number of observations
K <- 10 # number of variables
X <- matrix(runif(N*K, min=-0.5, max=+0.5), ncol=K)
beta <- runif(K, min=-0.5, max=+0.5)
Xbeta <- X%*%beta
y <- 1*(runif(N)<1/(1+exp(-Xbeta)))
beta.est <- rep(0,K)
# run sns in non-stochastic mode, i.e. Newton-Raphson optimization
for (i in 1:10) {
beta.est <- sns(beta.est, regfac.expand.1par, rnd=F, X=X, y=y
, fbase1=fbase1.binomial.logit)
}
# use glm to estimate beta and compare
beta.est.glm <- glm(y~X-1, family="binomial")$coefficients
cbind(beta.est, beta.est.glm)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.