Print out the 'str' of the two objects and look at it.  Are the matrices the
appropriate sizes to do the operation?  The error message indicates they are
not.  This is an opportunity to learn how to debug a function.  Look at the
'debug' package.

On Tue, Mar 9, 2010 at 5:59 AM, weltbewohnerin1 <
franziska.schulze@wiwi.hu-berlin.de> wrote:

>
> Hallo!
>
> I have the following function:
>
> cLL_beta <- function(beta){
> sumterm=0
> a=1
> b=0
> S=I_n-lambda*w
> R=I_n-rho*w
> det_R=det(S)
> det_S=det(R)
>
> for (i in 1:t){
> b=i*n
> y_ausgew=y_tilde[a:b]#y_ausgew ist numeric
> y_aus=matrix(y_ausgew)#Typen anpassen
> X_ausgew=X[a:b,]#X_ausgew ist eine Matrix
> x_tilde=X_ausgew-1/t*x_t  #x_tilde ist auch eine Matrix
> ####X_aus=matrix(X_ausgew)
> V1=R%*%(S%*%y_aus-x_tilde%*%beta)
> V11=t(V1)
> V2=V11%*%J_n
> V_tilde=V2%*%V1
> sumterm=sumterm+V_tilde
> a=b+1
> }
>
> -((n*t)/2)*log(2*pi*sigm_sq)+t*(log(det_S)+log(det_R))-1/(2*sigm_sq)*sumterm
> }
>
> where beta is a matrix (2x1), X is a matrix (n*tx1) and y is numeric with
> length nt.
>
> My error message is: X_ausgew%*%beta - non-conformable arguments
>
> Can anybody help me?
>
> THANKS
> --
> View this message in context:
> http://n4.nabble.com/error-in-a-function-tp1585792p1585792.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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

	[[alternative HTML version deleted]]

