Re: [R] Partial Derivatives in R

2009-05-12 Thread Paul Heinrich Dietrich
Thanks for showing me how to use genD correctly and that it matches deriv here. Like you say, there must be a problem with the manual way of doing it, and I will look at it closely. Thanks again. spencerg wrote: > > Hi, Paul: > > > Your example is so complicated that I don't want to

Re: [R] Partial Derivatives in R

2009-05-12 Thread Gabor Grothendieck
You could also use rSymPy to symbolically differentiate it. For example, based on the semi-automatic differentiation example on the rSymPy home page: http://code.google.com/p/rsympy/#Semi-Automatic_Differentiation just replace the indented lines there with the indented lines here (I've also added

Re: [R] Partial Derivatives in R

2009-05-11 Thread spencerg
Hi, Paul: Your example is so complicated that I don't want to take the time to check it. You apply "deriv" to an exponential divided by a sum of exponentials, and I'm not convinced that your manual "Correct way" is actually correct. It looks like you've followed the examples in the "

Re: [R] Partial Derivatives in R

2009-05-11 Thread Paul Heinrich Dietrich
Hi Spencer, Thanks for suggesting the genD function. In attempting it, I have rearranged my function from phat1 ~ ... to ... - 1, it apparently doesn't like the first one :) But when I run it, it tells me the partials are all zero. I'm trying out a simple MNL equation before I expand it to what

Re: [R] Partial Derivatives in R

2009-05-10 Thread Paul Heinrich Dietrich
Thank you for suggesting other functions, I will look into them. When I read the deriv() function, it did mention partial, but I (being a newbie) wasn't able to get partials for a simple MNL equation. I'm sure I did something wrong then, but here's what I tried the following and got different an

Re: [R] Partial Derivatives in R

2009-05-10 Thread spencerg
Have you considered genD{numDeriv}? If this does not answer your question, I suggest you try the "RSiteSearch" package. The following will open a list of options in a web browser, sorted by package most often found with your search term: library(RSiteSearch) pd <- RSiteSearch.fun

Re: [R] Partial Derivatives in R

2009-05-10 Thread David Winsemius
On May 10, 2009, at 10:05 AM, Paul Heinrich Dietrich wrote: Quick question: Which function do you use to calculate partial derivatives from a model equation? I've looked at deriv(), but think it gives derivatives, not partial derivatives. Your reading of the help page and the examples d

Re: [R] Partial Derivatives in R

2009-05-10 Thread Ravi Varadhan
rsity Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Paul Heinrich Dietrich Date: Sunday, May 10, 2009 4:45 pm Subject: [R] Partial Derivatives in R To: r-help@r-project.org > Quick question: > > Which function do you use to calculate partial deri

[R] Partial Derivatives in R

2009-05-10 Thread Paul Heinrich Dietrich
Quick question: Which function do you use to calculate partial derivatives from a model equation? I've looked at deriv(), but think it gives derivatives, not partial derivatives. Of course my equation isn't this simple, but as an example, I'm looking for something that let's you control whether