Hi everyone,
I am trying to use the optim function in ps4 and I am always getting the following error:
Error in optim(par = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :
(list) object cannot be coerced to type 'double'
Could anyway tell me what I am doing wrong???
Thanks
Chiara
Hey all,
Some of you have asked about loading the data for pset4. Once you've
saved the data in your working directory and executed the "load"
command, you should type in ls() in your R console. This will let you
see everything that R currently has stored in its workspace. If you
successfully loaded the data, then you'll see an object called "data",
which are the data for the problem set.
If you use Windows, you can actually double click on the
"presidential.RData" icon and that will automatically open up R with
the data already in the workspace.
hope that helps -
Maya
Thanks Maya,
I made my way through the problem 3. The tiny question that I still have is about the last part.
In modelling the sigma square as exp(gamma*Z_it), there was only a tiny reparameterization in the formula for likelihood.
However, when you ask us to examine the sign (positive or negative) on the coefficients for Z ("r1" and "year"),
do you refer to effect coefficients for those covariates coming from estimation of mu?
The reason I ask is, I never modeled variance/sigma square in the past,
so I guess if that model of sigma square was more sophisticated we could estimate
the coefficients for Z as they relate to estimation of sigma square. Perhaps we could even do it here,
but since our goal is to estimate the maximum likelihood, such coefficients would not really be important for the final result.
I may have misunderstood the question, so could you please confirm that the coefficients for Z that you refer to in the last part of problem 3
are effect coeffients for "r1" and "year" covariates coming from estimation of mu?
Your help is appreciated.
Nino
________________________________________
From: gov2001-l-bounces at lists.fas.harvard.edu [gov2001-l-bounces at lists.fas.harvard.edu] On Behalf Of gov2001-l-request at lists.fas.harvard.edu [gov2001-l-request at lists.fas.harvard.edu]
Sent: Sunday, February 28, 2010 4:14 PM
To: gov2001-l at lists.fas.harvard.edu
Subject: gov2001-l Digest, Vol 55, Issue 47
Send gov2001-l mailing list submissions to
gov2001-l at lists.fas.harvard.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
or, via email, send a message with subject or body 'help' to
gov2001-l-request at lists.fas.harvard.edu
You can reach the person managing the list at
gov2001-l-owner at lists.fas.harvard.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of gov2001-l digest..."
Today's Topics:
1. Re: gamma and Z_it (Maya Sen)
2. Re: loading the data (Abigail Coplin)
3. Re: loading the data (Maya Sen)
4. Sigma? (Meryl Federman)
5. Hessian Problems (Abigail Coplin)
----------------------------------------------------------------------
Message: 1
Date: Sun, 28 Feb 2010 12:44:37 -0500
From: Maya Sen <msen at fas.harvard.edu>
Subject: Re: [gov2001] gamma and Z_it
To: "Class List for Gov 2001/E-2001" <gov2001-l at lists.fas.harvard.edu>
Message-ID:
<16e0be401002280944u4a24a0e9o7f2eb7dad5db3c84 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Hey all,
So Anil is right in that the bearded man wants you to test whether
sigma^2 should be modeled as functions of "r1" and "year". As for your
parameterization of mu, the problem says to use the parameterization
you used in problem one. So you should actually feel free to include
the entirety of the covariates (which is what you did in problem one).
hope that helps --
Maya
Thanks Maya,
I made my way through the problem 3. The tiny question that I still have is about the last part.
In modelling the sigma square as exp(gamma*Z_it), there was only a tiny reparameterization in the formula for likelihood.
However, when you ask us to examine the sign (positive or negative) on the coefficients for Z ("r1" and "year"),
do you refer to effect coefficients for those covariates coming from estimation of mu?
The reason I ask is, I never modeled variance/sigma square in the past,
so I guess if that model of sigma square was more sophisticated we could estimate
the coefficients for Z as they relate to estimation of sigma square. Perhaps we could even do it here,
but since our goal is to estimate the maximum likelihood, such coefficients would not really be important for the final result.
I may have misunderstood the question, so could you please confirm that the coefficients for Z that you refer to in the last part of problem 3
are effect coeffients for "r1" and "year" covariates coming from estimation of mu?
Your help is appreciated.
Nino
On Sun, Feb 28, 2010 at 11:38 AM, Doshi, Anil <adoshi at hbs.edu> wrote:
> Nino,
> I believe the "explanatory variables suggested" by the bearded man are in the intro paragraph of problem 3. Specifically, the year (year) and the South dummy (r1) are the explanatory variables for sigma_2.
>
> Whether you use dummies r1...r6 to explain the beta parameter will probably depend on your results from Problem Two. Did you think the bearded man was right? If you did, then it probably makes sense to continue with the model from Problem 2. If you disagreed (i.e. you did not reject the null hypothesis that the regional dummy variables were different than zero), then you will probably want to stick with the model from Problem 1 to estimate beta.
>
> I hope this helps.
> Anil
>
>
> 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
>
> On Feb 28, 2010, at 4:00 AM, Malekovic, Nino wrote:
>
> Hi all,
>
> In the problem 3, "Z_it is a vector of the explanatory variables suggested by the bearded man". Are those the variables he suggested to leave out of the model, r1, r2, r3, r4, r5 and r6? The only sensible interpretation that I have is that we do not use these six explanatory variables for estimating ?_it. However, we use them for estimating ?_it^2 =e^(Z_it*?). Furthermore, the remaining explanatory variables (matrix X without r1, r2, r3, r4, r5, and r6) are to be used for estimating betas, as in the problem 2.
>
> I would not like to misinterpret the instruction, and will appreciate if someone confirmed that, or at least clarified it a bit.
>
> Best regards,
> Nino Malekovic
> MPA Candidate, Class 2011
> Harvard Kennedy School
> ________________________________________
> From: gov2001-l-bounces at lists.fas.harvard.edu [gov2001-l-bounces at lists.fas.harvard.edu] On Behalf Of gov2001-l-request at lists.fas.harvard.edu [gov2001-l-request at lists.fas.harvard.edu]
> Sent: Saturday, February 27, 2010 12:00 PM
> To: gov2001-l at lists.fas.harvard.edu
> Subject: gov2001-l Digest, Vol 55, Issue 45
>
> Send gov2001-l mailing list submissions to
> ? ? ? gov2001-l at lists.fas.harvard.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> ? ? ? http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
> or, via email, send a message with subject or body 'help' to
> ? ? ? gov2001-l-request at lists.fas.harvard.edu
>
> You can reach the person managing the list at
> ? ? ? gov2001-l-owner at lists.fas.harvard.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gov2001-l digest..."
>
>
> Today's Topics:
>
> ?1. pset4 posted, due thurs (Maya Sen)
> ?2. error message (Chiara Superti)
> ?3. Re: error message (Iain Osgood)
> ?4. panel data in R (Chiara Superti)
> ?5. Re: panel data in R (Maya Sen)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 27 Feb 2010 09:29:06 -0500
> From: Maya Sen <msen at fas.harvard.edu>
> Subject: [gov2001] pset4 posted, due thurs
> To: "Class List for Gov 2001/E-2001" <gov2001-l at lists.fas.harvard.edu>
> Message-ID:
> ? ? ? <16e0be401002270629o6fac0026y4cd3e47eba642041 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi all,
>
> Just a reminder -- pset 4 has been posted, and it's due Thursday
> before 6pm. If you are writing the replication paper, also "due"
> Thursday is an email from your group of co-authors with your intended
> paper and a few lines about why it's a good choice.
>
> Maya
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 27 Feb 2010 10:00:35 -0500
> From: Chiara Superti <csuperti at fas.harvard.edu>
> Subject: [gov2001] error message
> To: Class List for Gov 2001/E-2001 <gov2001-l at lists.fas.harvard.edu>
> Message-ID: <D42F22A7-C271-4F24-ACB5-A2F4525F5539 at fas.harvard.edu>
> Content-Type: text/plain; charset=us-ascii
>
> Hi everyone,
> I am trying to use the optim function in ps4 and I am always getting the following error:
> Error in optim(par = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ?:
> (list) object cannot be coerced to type 'double'
>
> Could anyway tell me what I am doing wrong???
> Thanks
> Chiara
>
> ------------------------------
>
> Message: 3
> Date: Sat, 27 Feb 2010 10:13:23 -0500
> From: Iain Osgood <osgood2 at fas.harvard.edu>
> Subject: Re: [gov2001] error message
> To: "Class List for Gov 2001/E-2001" <gov2001-l at lists.fas.harvard.edu>
> Message-ID:
> ? ? ? <e7322f8f1002270713v40c2f442j262ca82799972319 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Chiara,
> Its hard to tell without the complete code, but frequently this error
> message involves attempts to convert a dataframe (which is of mode 'list'
> and class 'dataframe') into a matrix incorrectly. ?Perhaps in your function
> code do you have a line like as.numeric(data) when it should be
> as.matrix(data)?
> Iain
>
> On Sat, Feb 27, 2010 at 10:00 AM, Chiara Superti
> <csuperti at fas.harvard.edu>wrote:
>
>> Hi everyone,
>> I am trying to use the optim function in ps4 and I am always getting the
>> following error:
>> Error in optim(par = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ?:
>> (list) object cannot be coerced to type 'double'
>>
>> Could anyway tell me what I am doing wrong???
>> Thanks
>> Chiara
>> _______________________________________________
>> gov2001-l mailing list
>> gov2001-l at lists.fas.harvard.edu
>> http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
>>
>>
>
Should our function in 1B take a value for sigma as well, since we
are trying to optimize our log likelihood function of beta *and*
sigma? If no, how does one get the value of sigma that you need to
calculate the log likelihood?
Just concerned because it mentions our log likelihood taking a beta,
but not a sigma. (Also, if it is yet another parameter to throw into
the function, how does one optim over two variables?)
~Meryl
Hey guys,
When I try to take the inverse of the Hessian using the command optim.vcv<-
solve(-1*my.optim$hessian), I keep getting the error msg "Error in
solve.default(-1 * my.optim$hessian) : Lapack routine dgesv: system is
exactly singular"...any ideas how to fix this?
~Abby
Hi all,
In the problem 3, "Z_it is a vector of the explanatory variables suggested by the bearded man". Are those the variables he suggested to leave out of the model, r1, r2, r3, r4, r5 and r6? The only sensible interpretation that I have is that we do not use these six explanatory variables for estimating ?_it. However, we use them for estimating ?_it^2 =e^(Z_it*?). Furthermore, the remaining explanatory variables (matrix X without r1, r2, r3, r4, r5, and r6) are to be used for estimating betas, as in the problem 2.
I would not like to misinterpret the instruction, and will appreciate if someone confirmed that, or at least clarified it a bit.
Best regards,
Nino Malekovic
MPA Candidate, Class 2011
Harvard Kennedy School
________________________________________
From: gov2001-l-bounces at lists.fas.harvard.edu [gov2001-l-bounces at lists.fas.harvard.edu] On Behalf Of gov2001-l-request at lists.fas.harvard.edu [gov2001-l-request at lists.fas.harvard.edu]
Sent: Saturday, February 27, 2010 12:00 PM
To: gov2001-l at lists.fas.harvard.edu
Subject: gov2001-l Digest, Vol 55, Issue 45
Send gov2001-l mailing list submissions to
gov2001-l at lists.fas.harvard.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
or, via email, send a message with subject or body 'help' to
gov2001-l-request at lists.fas.harvard.edu
You can reach the person managing the list at
gov2001-l-owner at lists.fas.harvard.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of gov2001-l digest..."
Today's Topics:
1. pset4 posted, due thurs (Maya Sen)
2. error message (Chiara Superti)
3. Re: error message (Iain Osgood)
4. panel data in R (Chiara Superti)
5. Re: panel data in R (Maya Sen)
----------------------------------------------------------------------
Message: 1
Date: Sat, 27 Feb 2010 09:29:06 -0500
From: Maya Sen <msen at fas.harvard.edu>
Subject: [gov2001] pset4 posted, due thurs
To: "Class List for Gov 2001/E-2001" <gov2001-l at lists.fas.harvard.edu>
Message-ID:
<16e0be401002270629o6fac0026y4cd3e47eba642041 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
Just a reminder -- pset 4 has been posted, and it's due Thursday
before 6pm. If you are writing the replication paper, also "due"
Thursday is an email from your group of co-authors with your intended
paper and a few lines about why it's a good choice.
Maya
------------------------------
Message: 2
Date: Sat, 27 Feb 2010 10:00:35 -0500
From: Chiara Superti <csuperti at fas.harvard.edu>
Subject: [gov2001] error message
To: Class List for Gov 2001/E-2001 <gov2001-l at lists.fas.harvard.edu>
Message-ID: <D42F22A7-C271-4F24-ACB5-A2F4525F5539 at fas.harvard.edu>
Content-Type: text/plain; charset=us-ascii
Hi everyone,
I am trying to use the optim function in ps4 and I am always getting the following error:
Error in optim(par = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :
(list) object cannot be coerced to type 'double'
Could anyway tell me what I am doing wrong???
Thanks
Chiara
------------------------------
Message: 3
Date: Sat, 27 Feb 2010 10:13:23 -0500
From: Iain Osgood <osgood2 at fas.harvard.edu>
Subject: Re: [gov2001] error message
To: "Class List for Gov 2001/E-2001" <gov2001-l at lists.fas.harvard.edu>
Message-ID:
<e7322f8f1002270713v40c2f442j262ca82799972319 at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Chiara,
Its hard to tell without the complete code, but frequently this error
message involves attempts to convert a dataframe (which is of mode 'list'
and class 'dataframe') into a matrix incorrectly. Perhaps in your function
code do you have a line like as.numeric(data) when it should be
as.matrix(data)?
Iain
On Sat, Feb 27, 2010 at 10:00 AM, Chiara Superti
<csuperti at fas.harvard.edu>wrote:
> Hi everyone,
> I am trying to use the optim function in ps4 and I am always getting the
> following error:
> Error in optim(par = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :
> (list) object cannot be coerced to type 'double'
>
> Could anyway tell me what I am doing wrong???
> Thanks
> Chiara
> _______________________________________________
> gov2001-l mailing list
> gov2001-l at lists.fas.harvard.edu
> http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
>
>
Hi everyone,
Because a number of you have midterm exams concentrated during the week
immediately before Spring Break, we will be slightly altering the usual
schedule for Problem Set 5. Problem Set 5 will be posted on Monday
March 1st in the early evening, rather than waiting until Thursday, to give
everyone three additional days to work on the problem set. The problem set
will still be due Thursday March 11th at 6pm.
Iain
Hi all,
Just a reminder -- pset 4 has been posted, and it's due Thursday
before 6pm. If you are writing the replication paper, also "due"
Thursday is an email from your group of co-authors with your intended
paper and a few lines about why it's a good choice.
Maya
Hi gang, when you choose an article to replicate, try to choose one that is
recent. 2-3 years is probably best. my publication, publication article
says 4-5 years, but more recent is probably better; older probably is not.
here's the reason: if there is another article that follows up on this one
with better data, updated evidence, or better methods, then no matter how
well you do your reviewers will mainly ask why you're not reacting to the
new article. But suppose there is no newer paper that follows up on this
one? In that case, reviewers may ask whether your "old" article is worth
following up on if in "all these years" no one else has.
That said, this is not a hard and fast rule. if you have a good reason -- a
good way to avoid the referees saying this about you -- then its possible
that it might well make good sense to pursue.
See you tomorrow...
Gary
---
http://gking.harvard.edu
I've been using Rcmdr to edit and run R code and gedit (with a LaTeX
plugin) to edit and produce LaTeX pdfs. gedit seems fine, but I find
Rcmdr to be a bit clunky. I wish I could run scripts more easily;
something like what the TFs use would be nice.
I'm wondering if anybody else is using a flavor of Linux and has
suggestions for programs to use. If anybody has used ESS for emacs, I'd
be interested to know if you find that useful too.
Thanks,
Jason