Incomplete code leaves us able to do naught but guess;
Perhaps you are unaware that x != X
--
DW
On Jul 7, 2009, at 1:30 PM, spime wrote:
Hello,
Consider this function for generalized ridge regression:
gre <- function (X,y,D){
n <- dim(X)[1]
p <- dim(X)[2]
intercept <- rep(1, n)
X <- cbind(intercept, X)
X2D <- crossprod(X,X)+ D
Xy <- crossprod(X,y)
bth <- qr.solve(X2D, Xy)
}
# suppose X is an (nxp) design matrix and y is an (nx1) response
vector
p <- dim(x)[2]
D<- diag(rep(1.5,p))
bt <- gre(X,y,D)
I am getting following error:
Error in crossprod(X, X) + D : non-conformable arrays
But when i define D within the function 'gre()' then everything is
fine.
What wrong i have done?
thanks.
--
View this message in context:
http://www.nabble.com/Error-due-to-non-conformable-arrays-tp24377781p24377781.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.