http://www.mathworks.com/matlabcentral/newsreader/view_thread/315701
MATLAB Central Newsreader  Finding a Kvector of partial derivatives across M observations
Feed for thread: Finding a Kvector of partial derivatives across M observations
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Wed, 04 Jan 2012 19:43:08 +0000
Finding a Kvector of partial derivatives across M observations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/315701#862855
Brian
I have a function that is defined for M observations. This function is determined by the current values of K parameters. How can I return an M x K matrix of derivatives without having to put the gradient function within an M dimension loop?

Wed, 04 Jan 2012 20:14:33 +0000
Re: Finding a Kvector of partial derivatives across M observations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/315701#862858
dpb
On 1/4/2012 1:43 PM, Brian wrote:<br>
> I have a function that is defined for M observations. This function is<br>
> determined by the current values of K parameters. How can I return an M<br>
> x K matrix of derivatives without having to put the gradient function<br>
> within an M dimension loop?<br>
<br>
doc meshgrid<br>
<br>


Thu, 05 Jan 2012 03:56:08 +0000
Re: Finding a Kvector of partial derivatives across M observations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/315701#862883
Roger Stafford
"Brian " <bwgould@wisc.edu> wrote in message <je2a4c$mjk$1@newscl01ah.mathworks.com>...<br>
> I have a function that is defined for M observations. This function is determined by the current values of K parameters. How can I return an M x K matrix of derivatives without having to put the gradient function within an M dimension loop?<br>
         <br>
In deriving partial derivative estimates using the the finite differences of the 'gradient' function, you need a grid of values with as many dimensions are there are independent variables. That is, 'gradient' needs to see your function varying with respect to each individual independent variable while the remaining variables are all held constant. How do your K parameters enter into this? Are they the independent variables?<br>
<br>
None of this seems compatible with a simple twodimensional M by K matrix. Your description sounds as though you were thinking of pairwise variances or correlations between K variables using M statistical observations. Finding partial derivatives with 'gradient' is a very different matter. I think you need to explain your problem in far greater detail.<br>
<br>
Roger Stafford

Thu, 05 Jan 2012 07:27:09 +0000
Re: Finding a Kvector of partial derivatives across M observations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/315701#862892
Bruno Luong
"Roger Stafford" wrote in message <je370o$ldd$1@newscl01ah.mathworks.com>...<br>
> "Brian " <bwgould@wisc.edu> wrote in message <br>
> <br>
> None of this seems compatible with a simple twodimensional M by K matrix.<br>
<br>
May be the Jacobian matrix?<br>
<br>
Bruno

Thu, 05 Jan 2012 15:08:08 +0000
Re: Finding a Kvector of partial derivatives across M observations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/315701#862939
Brian
"Roger Stafford" wrote in message <je370o$ldd$1@newscl01ah.mathworks.com>...<br>
> "Brian " <bwgould@wisc.edu> wrote in message <je2a4c$mjk$1@newscl01ah.mathworks.com>...<br>
> > I have a function that is defined for M observations. This function is determined by the current values of K parameters. How can I return an M x K matrix of derivatives without having to put the gradient function within an M dimension loop?<br>
>          <br>
> In deriving partial derivative estimates using the the finite differences of the 'gradient' function, you need a grid of values with as many dimensions are there are independent variables. That is, 'gradient' needs to see your function varying with respect to each individual independent variable while the remaining variables are all held constant. How do your K parameters enter into this? Are they the independent variables?<br>
> <br>
> None of this seems compatible with a simple twodimensional M by K matrix. Your description sounds as though you were thinking of pairwise variances or correlations between K variables using M statistical observations. Finding partial derivatives with 'gradient' is a very different matter. I think you need to explain your problem in far greater detail.<br>
> <br>
> Roger Stafford<br>
<br>
To further explain, I teach a graduate course in econometrics. I am trying to write some code for my students that estimates the parameters (i.e., K) of a nonlinear regression model using the GaussNewton Algorithm where I have a couple of thousand observations (i.e. M) used for estimation. I need to calculate the Kvector of derivatives for these K parameters for each of these M observations. How do I do this? My reading of the gradient function is that it will do this for only 1 observation at a time.