Hi spime,
What is "x"?  Did you have any other "X" defined in your R-session? Be aware
that R is case-sensitive.
Best,

Jorge


On Tue, Jul 7, 2009 at 1:30 PM, spime <sabya23@gmail.com> 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.
>

	[[alternative HTML version deleted]]


