Solving non-conformable arguments

Tried running these codes, but ran into "Error in t(x.og) %*% y.og : non-conformable arguments"

#Original output gap estimate
x.og <- cbind(rep(1,T+4), 1:(T+4), c(rep(0,56),1:(T+4-56)), c(rep(0,142),1:(T+4-142)))
y.og <- log.output[5:(T+8)]
output.gap <- (y.og - x.og %% solve(t(x.og) %% x.og, t(x.og) %*% y.og)) * 100

Thanking you for the help.

Hi,

Welcome to the RStudio community!

I think the issue you're having is with the matrix multiplication, (which is done by %*%). If the matrices are not in format m x n and n x p it wont work. Since you did not create a reprex, I can't run your code to be sure, but this might be the issue. Also, make sure that the order of the multiplication is correct, because A x B is not the same as B x A for matrix multiplication (different rows and columns)

For next time, consider building a reprex to get faster answers. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

,

Hope this helps,
PJ

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.