Description Usage Arguments Details Value Author(s) Examples
A Bayesian estimator for the population Partial Least Squares Model based on the concept of relevant components and MCMC
1 | BayesPLS(Y, X, ncomp, scale = TRUE, totiter = 1000, doinit = TRUE, init.method = c("PLS"), init.ncomp = NULL, init.sort = FALSE, dotrace = TRUE, plotint = 10, thin = 10, adaptint = 100, approx = FALSE, appit = 10, appcomp = 100, approp = 0.999, update = list(update.dvek = TRUE, update.nu = TRUE, update.theta = TRUE, update.gamma = TRUE, update.seq.gamma = TRUE), eps = list(gammaeps = 1/19, nueps = 1/31, thetaeps = 1/31, lambda = -log(0.001), fi = 0.5), deps = 0, compreduce = TRUE, alpha.reduce = 0.4, freeze = 0.1, previousobj = NULL)
|
Y |
A response vector |
X |
A predictor matrix |
ncomp |
The number of latent components |
scale |
Should the data be scaled (standardized)? Defaults to TRUE. |
totiter |
Total number of MCMC iterations |
doinit |
Should the parameters be initiated using regular PLSR or PCR? Defaults to TRUE, but may be set to FALSE if a previous run object is supplied as extra argument. In that case the final iteration of the previous run is used as initial values for the parameters. |
init.method |
Method for initiating the parameters, either "PLS" or "PCR". Both use the specified ncomp as the number of components. |
init.ncomp |
The number of components used by PLS or PCR in the initiation step for the Bayes PLS model parameters. Deafults to NULL which means that init.ncomp = ncomp. |
init.sort |
Should the components found in the intiation step through PLS or PCR be sorted in a decreasing order according to the initial values of their weights? Deafults to FALSE which is most appropriate for init.method = "PLS", If init.method ="PCR" init.sort = TRUE is recommended. |
dotrace |
Should the traceplots be generated? Defaults to TRUE. |
plotint |
The frequency of trace plot updating. Defaults to every 10th generated value (after thinnning). |
thin |
The thinning value. Defaults to 10 in which case only every 10th value is saved. |
adaptint |
The step-lengths for the rotation of the eigenvectors (D) is tuned with this frequency. Defauilts to 100. At this frequency the acceptance rate is also reported i nthe trace plots. |
approx |
Logical. If TRUE then only a subspace corresponding to the largest eigenvalues (nu's) are updated after |
appit |
The number of initial rotations of the complete predictor space before a reduced space is used if
|
appcomp |
The maximum dimension of the reduced space if |
approp |
The proportion of the total variance of X (cumulative sum of eigenvalues) to be explained
by the reduced space (if |
update |
A logical list. Sets whether various parameters should be estimated (updated in MCMC) or not. Defaults to TRUE for all parameters. |
eps |
Some internal tuning parameters for priors and proposal distributions. |
deps |
Sets the step-length parameter for the rotation of the eigenvector matrix D. Defaults to 0 in which case the steps are determined as a function of n, p and ncomp. Other integer values of deps can be used to decrease (deps > 0) or increase (deps > 0) the initial step lengths. The adjustment will then be equal to 2^deps. If deps is a non-integer (if modulo deps is not zero) the value is interpreted as an actual step length value to replace the internal default value. |
compreduce |
Logical. If TRUE the weights for the components (gamma-values) are tested using bayesian p-values. If the Bayesian p.value exceeds alpha.reduce for a given component, the component is excluded from further iterations. |
alpha.reduce |
Test level for testing the significance (from zero) for the gammas. Defaults to 0.4 which means that if the proportion of sampled values above (or below) zero is in the range [0.4, 0.6], the component is regarded as irrelevant. |
freeze |
A number between 0 and 1 which sets the proportion of totiter to be run before any component may be removed from the model. Defaults to 0.1. The same number of iterations will be run after a removal before any other component may be removed from the model. |
previousobj |
A previously fitted BayesPLS object from which starting values will be retrieved if initiate = FALSE and the model specification and data is identical. |
To be filled in.
coefficients |
The estimated regression coefficients for the original (unscaled) predictors. |
intercept |
The estimated intercept of the model. |
sigma.sq |
The estimated noise variance (same as the parameter theta in the model). |
D |
The MCMC object of the eigenvectors, D. Contains a sub-element 'solu' with the sampled values. |
gamma |
The MCMC object of the weights of the latent components. Contains a sub-element 'solu' with the sampled values. |
nu |
The MCMC object of the eigenvalues, nu. Contains a sub-element 'solu' with the sampled values. |
theta |
The MCMC object of the noise variance. Contains a sub-element 'solu' with the sampled values. |
betas |
The MCMC object of the regression coefficients (for scaled predictors). |
SSEs |
The MCMC object of the error sums of squares. |
scale |
Logical. Were the variables standardized? |
Y |
The input response data. |
X |
The input predictor data. |
last |
The final iteration value for all parameters. |
Solve S?b?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(simrel)
set.seed(1430)
sim <- simrel(n=30, p=50, q=50, relpos=c(1,3), gamma=0.5, R2=0.8, muY=3, muX=rnorm(50,5,1), ntest=1000)
X <- sim$X
Y <- sim$Y
test <- BayesPLS(Y,X,3,scale=TRUE, totiter=500, start=20, dotrace=TRUE, adaptint=50, plotint=10)
est <- estimate(test, start=20)
pred <- predict(est, sim$TESTX)
windows()
plot(sim$TESTY, pred, xlab="Observed", ylab="Predicted", main="Prediction plot for test data")
curve(1*x, add=TRUE, col=2)
print(DIC(est,start=20))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.