Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Finding a K-vector of partial derivatives across M observations

Subject: Finding a K-vector of partial derivatives across M observations

From: Brian

Date: 4 Jan, 2012 19:43:08

Message: 1 of 5

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?

Subject: Finding a K-vector of partial derivatives across M observations

From: dpb

Date: 4 Jan, 2012 20:14:33

Message: 2 of 5

On 1/4/2012 1:43 PM, Brian wrote:
> 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?

doc meshgrid

--

Subject: Finding a K-vector of partial derivatives across M observations

From: Roger Stafford

Date: 5 Jan, 2012 03:56:08

Message: 3 of 5

"Brian " <bwgould@wisc.edu> wrote in message <je2a4c$mjk$1@newscl01ah.mathworks.com>...
> 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?
- - - - - - - - - -
  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?

  None of this seems compatible with a simple two-dimensional 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.

Roger Stafford

Subject: Finding a K-vector of partial derivatives across M observations

From: Bruno Luong

Date: 5 Jan, 2012 07:27:09

Message: 4 of 5

"Roger Stafford" wrote in message <je370o$ldd$1@newscl01ah.mathworks.com>...
> "Brian " <bwgould@wisc.edu> wrote in message
>
> None of this seems compatible with a simple two-dimensional M by K matrix.

May be the Jacobian matrix?

Bruno

Subject: Finding a K-vector of partial derivatives across M observations

From: Brian

Date: 5 Jan, 2012 15:08:08

Message: 5 of 5

"Roger Stafford" wrote in message <je370o$ldd$1@newscl01ah.mathworks.com>...
> "Brian " <bwgould@wisc.edu> wrote in message <je2a4c$mjk$1@newscl01ah.mathworks.com>...
> > 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?
> - - - - - - - - - -
> 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?
>
> None of this seems compatible with a simple two-dimensional 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.
>
> Roger Stafford

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 non-linear regression model using the Gauss-Newton Algorithm where I have a couple of thousand observations (i.e. M) used for estimation. I need to calculate the K-vector 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.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us