Mildly pedantic point, but for Problem 1 it states:
"For this problem only you may additionally assume that sigma^2 is constant from year to year and across states."
Don't you also need to assume this for Problem 2 as well? That seems kind of implicit from the phrasing of Problem 3, but thought I'd check...
Nick
Ok, I know I got an answer, but I've been at this for the past hour and a
half and I still can't figure it out. I've know that optim should only take
one par vector with 23 zeros in it, but no matter how I incorporate par2
into my original function I always get this error in optim:
Error in optim(par = c(rep(0, 23)), fn = norms2, y = y.vec, X = x.mat, :
initial value in 'vmmin' is not finite
Is anyone having a similar problem or does anyone have some advice, because
I'd be very grateful to hear it.
Thanks,
Ashley Anderson
On 3/3/10 5:22 PM, "Michael Barnett" <mlbarnett at gmail.com> wrote:
> Hi ashley -
>
> The two gamma parameters we're estimating should be included in the
> "par =" part of optim(). In your "norms2" function, you can write code
> that tells the function that the last two entires in the vector rep(0,
> 23) are the two gamma values to use in your log-likelihood.
> Personally, I told my function to read in ncol(X) + 1 parameters for
> beta, and then the next ncol(Z) parameters for gamma. Does that make
> sense?
>
> -Michael
>
>
> On Mar 3, 2010, at 5:15 PM, Ashley Anderson wrote:
>
>> Hi All,
>>
>> Since we have to include a gamma in our function for the log-
>> likelihood, it
>> only makes sense that we have to include it somewhere in our optim
>> function
>> but I don't know where to place it. Right now I just have my
>> function taking
>> one parameter and then my optim function looks like this:
>>
>> mle.optim <- optim(par = c(rep(0,23)),fn = norms2, y = y.vec, X =
>> x.mat, Z =
>> z.mat, method = "BFGS", control = list(fnscale=-1), hessian=T)
>>
>> Clearly, I can't get full points if I don't follow the rules so does
>> anyone
>> know how to put extra parameters in optim?
>>
>>
>> -Ashley Anderson
>>
>>
>>
>>
>> _______________________________________________
>> gov2001-l mailing list
>> gov2001-l at lists.fas.harvard.edu
>> http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
>
> _______________________________________________
> gov2001-l mailing list
> gov2001-l at lists.fas.harvard.edu
> http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
>
Hi All,
Since we have to include a gamma in our function for the log-likelihood, it
only makes sense that we have to include it somewhere in our optim function
but I don't know where to place it. Right now I just have my function taking
one parameter and then my optim function looks like this:
mle.optim <- optim(par = c(rep(0,23)),fn = norms2, y = y.vec, X = x.mat, Z =
z.mat, method = "BFGS", control = list(fnscale=-1), hessian=T)
Clearly, I can't get full points if I don't follow the rules so does anyone
know how to put extra parameters in optim?
-Ashley Anderson
Does anybody know why I might get different results for passing in these two vectors into "par" as part of my "optim" command? The likelihoods are different ((a) is higher), but it unnerves me that optim found a different value, just because I set the last three terms in the vector to 1, instead of 0.
(a) c(rep(0,23))
(b) c(rep(0,20),rep(1,3))
Anil Doshi
Doctoral Student | Technology and Operations Management
Harvard Business School
302 Wyss Hall
Boston, MA 02163
tel 646-244-5396
email adoshi at hbs.edu<mailto:adoshi at hbs.edu>
This is about Question #2:
When I calculate a log likelihood using optim I get "value" which is the log
likelihood and the corresponding estimates of the parameters that maximize
the log likelihood function I believe. If I plug these optimal parameter
values back into the log likelihood function I created I get the same value
for LnL as with optim.
My confusion is that this is not the case when I do the same process with
the restricted model. When I optimize the model after dropping the
restricted variables (r1-r6) from the dataset I get a different log
likelihood est. using optim than if I calculate the LnL using my log
likelihood function with all of the data and the optimal parameter values
but now with the parameter values of r1-r6 set to zero.
I am not sure if these should be the same or they are doing different things
with the restricted estimate.
~matt
--
Matthew Kraft
Doctoral Candidate
Quantitative Policy Analysis
Harvard Graduate School of Education
Hey folks,
As the deadline draws near for choosing a replication paper, we'd like to
have those who are either (1) *undergraduates* or (2) *extension students
who are writing the replication paper* come talk to Gary either today or
tomorrow about their paper selection.
If you are in one of the above categories, please bring your partner if you
can.
best, Maya
Should year be included as a continuous covariate, or fixed, for 1.b and
3.b?
It seems more appropriate as fixed effects, but not sure how others have
handled...
Mark
>
> Hi everyone,
> I have a question about the Z matrix we input in the optim function when we model the variance:
> since we parameterize as an exponential function should we not put the columns of 1?
> Thanks.
> Chiara
>
>
Maya, Iain,
In section, we learned how to test different specifications as far as which covariates should be included. Is there a test for evaluating which variance specification is better, such that we might be able to assess the bearded man's suggestion to model non-constant variance?
EXL
Hey everyone,
looking at the dataset in R, when I dim(data), I see that there are 561 rows. If I nrow(data), I confirm there are 561 rows. If I just type "data" and it lists out all the observations, it looks like there are 594 rows? ! I think that clearing up my misunderstanding of this could solve my "nonconformable matrix" error. Any thoughts?
thanks!
EXL