Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: undefined independent variable x
Replies: 2   Last Post: May 20, 2013 11:09 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: undefined independent variable x
Posted: May 20, 2013 11:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Kam Hoi " <lkhbhjs@hotmail.com> wrote in message
> When i type the followings
> function [b, CI, R, Yhat_CI, e]=OSL_robust (X, Y, significance)
> b=inv(X'*X)*(X'*Y)
> cov=inv(X'*X)*(X'*diag(e^2)*X)*inv(X'*X)
> se=(diag(cov))^0.5
> t=b./se
> p=2*(1-cdf('norm',abs(t),0,1))
> R2c=1-(((e'*e)/T)/var(Y,1))
> R2u=1-((e'*e)/Y'*Y)
> AR2c=1-((1/T-K-1)*e'*e)*(var(Y))
> AR2u=1-((1/T-K)*e'*e)/((Y'*Y)/T)
> CIU=(b+1.96*se)
> CIL=(b+1.96*se)
> Yhat=Xb
> Yhat_CI=[X*CIU,X*CIL]
> e=Y-Yhat
> It comes out that ??? Input argument "X" is undefined.

You ran this code by pressing the green triangle in the Editor or by just


didn't you? That calls this function with 0 input arguments, so X is indeed
undefined when MATLAB tries to execute the second line. Call it with three
input arguments, like the functions on this documentation page are being
called with input arguments:


BTW, do NOT use inversion to solve the normal equations. Use the backslash
operator instead.


Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.