Sorry, that should read xi=yi for all i (i=1 to k)...I just did the algebra
for the 2x2 case as an illustration, but the result falls out of Z being
positive definite and symmetric if i'm not mistaken...
At 12:47 PM 11/11/2004 -0500, you wrote:
>Quoting Vipin Narang <vnarang(a)fas.harvard.edu>:
>
> > Hey Suz, for 3d, I just did the general case and left everything in
> > variable terms (since Z is positive definite and symmetric, I had terms
> > like 'a' and 'd' on the diagonal and 'b' and 'c' (or both 'b' since it's
> > symmetric) on the off-diagonal). If you go through the algebra to find the
> > minimum using the gradient vector, I got the determinant of Z canceling out
> > on both sides and thus x1=y1 and x2=y2 at the minimum...so min g(x) turns
> > out just to be y for the general case...
> >
> > someone correct me if i'm wrong...
> >
> > At 12:02 PM 11/11/2004 -0500, Suzanna Elizabeth Chapman wrote:
> > >Hi everyone,
> > >
> > >I'm not understanding what part d of question 3 is asking. Can anyone
> > >clarify?
> > >
> > >Thanks!
> > >Suzanna Chapman
> > >
> > >Quoting Kevin Quinn <kquinn(a)fas.harvard.edu>:
> > >
> > > > Hi Becky,
> > > >
> > > > You're not too far away from the right usage. You don't actually need
> > > > to specify all the arguments to the function. In R, like C++ and some
> > > > other programming languages, it is possible to for the original author
> > > > of the function to specify default values for many function arguments.
> > > > Also the ... are just a place holder that the user never needs to
> > > > specify. The ... argument just allows additional parameters to be
> > > > passed to whatever functions are called by optim-- for instance the
> > > > function that is being minimized.
> > > >
> > > > Here is the same example that we dealt with analytically on pp.
> > > > 253-254 of the lecture notes:
> > > >
> > > >
> > > > ## function to be minimized
> > > > myfun <- function(x){
> > > > A <- matrix(c(3,1,1,5), 2, 2, byrow=TRUE)
> > > > return(t(x) %*% A %*% x)
> > > > }
> > > >
> > > > ## initial values of x
> > > > x.init <- c(1, -4)
> > > >
> > > > ## call optim to find min and Hessian
> > > > optim.out <- optim(x.init, myfun, method="BFGS", hessian=TRUE)
> > > >
> > > > ## value that minimizes the function
> > > > print(optim.out$par)
> > > >
> > > > ## function value at minimum
> > > > print(optim.out$value)
> > > >
> > > > ## print the numerical Hessian
> > > > print(optim.out$hessian)
> > > >
> > > > Note we get the same answer (to within machine precision) as we did
> > > > analytically.
> > > >
> > > > Numerical optimization is a very tricky business and one should very
> > > > careful when using optim to solve real world problems. The problems we
> > > > will be dealing with in gov1000 are very well behaved (and have
> > > > analytical solutions) so we won't be worrying about how to use optim
> > > > properly. For the purposes of checking your work when the function in
> > > > question is smooth (say the first 2 derivatives exist) and has a
> > > > single min (or max) then using method="BFGS" and the other default
> > > > settings will generally be ok. Also note that the Hessian that optim
> > > > returns is a numerical approximation to the real Hessian-- in some
> > > > cases the two will disagree somewhat.
> > > >
> > > > Re: undefined variables in matrices, you can have missing values in a
> > > > matrix if that is what you mean. For instance:
> > > >
> > > > > X <- diag(2)
> > > > > X[2,1] <- NA
> > > > > X
> > > > [,1] [,2]
> > > > [1,] 1 0
> > > > [2,] NA 1
> > > >
> > > > Hope this helps.
> > > >
> > > > Best,
> > > > Kevin
> > > >
> > > > >
> > > > > Hi,
> > > > > I can get the "deriv" functions to work.... but am having trouble
> > > with the
> > > > > "optim" function. (The help guide is not that helpful in translating
> > the
> > > > > arguments...)
> > > > >
> > > > > Say I want to optimize 2x^2-3, for random example. So I entered:
> > > > > > optim(x, 2*x^2 - 3, gr = NULL, method = c("Nelder-Mead", "BFGS",
> > "CG",
> > > > > "L-BFGS-B", "SANN"), lower = -Inf, upper = Inf, control = list(),
> > hessian
> > > > > = FALSE, ...)
> > > > > Error: ... used in an incorrect context
> > > > >
> > > > > I've been tweaking this basic form and can't get it to run through.
> > Any
> > > > > ideas?
> > > > >
> > > > > Also is it possible to enter undefined variables into matrix form
> in R?
> > > > > This is another brain teaser I've been trying to work out....
> > > > >
> > > > > Thanks!
> > > > > Becky
> > > > > _______________________________________________
> > > > > gov1000-list mailing list
> > > > > gov1000-list(a)lists.fas.harvard.edu
> > > > > http://lists.fas.harvard.edu/mailman/listinfo/gov1000-list
> > > > >
> > > > _______________________________________________
> > > > gov1000-list mailing list
> > > > gov1000-list(a)lists.fas.harvard.edu
> > > > http://lists.fas.harvard.edu/mailman/listinfo/gov1000-list
> > > >
> > >
> > >
> > >
> > >
> > >_______________________________________________
> > >gov1000-list mailing list
> > >gov1000-list(a)lists.fas.harvard.edu
> > >http://lists.fas.harvard.edu/mailman/listinfo/gov1000-list
> >
Hi, everyone. For your planning purposes, here's the HW schedule for the
weeks before, during, and after Thanksgiving.
MON, 15 Nov -- PS5 due, PS6 handed out
FRI, 19 Nov -- PS7 handed out
MON, 22 Nov -- PS6 due
THU, 25 Nov -- Thanksgiving Day
MON, 29 Nov -- PS7 due, PS8 handed out
This way, you'll have more time to budget the completion of PS7 over the
break.
Best,
Ryan
Hi, folks. Here are three questions to chew on that I posed at the end of
section yesterday. I'm happy to discuss the answers anytime.
1. Does having all positive values in a 2x2 matrix ensure that the matrix
is positive definite?
2. Does having all negative values in a 2x2 matrix ensure that the matrix
is negative definite?
3. When we solve Ax=b, why do we LEFT multiply by A-inverse, instead of
right multiplying, for example, in A(A-inv)x=... ?
Enjoy!
Ryan
------------------------------------------
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
Homepage: http://www.people.fas.harvard.edu/~rtmoore/
Gov1000: http://www.courses.fas.harvard.edu/~gov1000/
I think I'ma bit confused as to what question 6 is asking. We have three
vecors with 2 elements, x,y, and z. So in theory for them to be linearly
independent the matrix X = [x y z] would have to have a determinant equal
to zero. But this matrix X would be 2*3, and I was under the impression
that non square matrices' determinants are not defined.
Help?
Lucy
Hi all-
There will be a Thurs. section as usual. It is a holiday, but I have the
key/access codes etc. to let us into the conference room. I will be
holding office hours as well.
Alison
Hi, folks. PS3 is marked and ready to be returned. I'll bring them to
section tonight. If you're a Thursday section attendee, and would like
your solutions back before Thursday, feel free to stop by CBRSS today or
most anytime Wednesday or Thursday. PS3 rewrites will be due in lecture
on Monday, 22 November (the Monday before Thanksgiving break). On the
whole, great job on this problem set! Please feel free to ask if there
are any questions about the problems or my marks. Generally applicable
comments about this set are both attached and below.
Cheers,
Ryan
P1. It's not the case that any deviation from the normal line indicates
"fatter tails". At the left of the qq-normal plot, points below the line
represent fatter tails (i.e., more extreme values), but points above the
line represent truncated tails (i.e., fewer extreme values). At the right
of the qq-normal plot, points above the line represent fatter tails;
points below the line represent truncated tails.
P2. Think hard about what Cleveland (33) means by "spurious" effects and
"unreproducible" variance, rather than just regurgitating Cleveland's
statements. The goal for advantage/disadvantage questions like this is to
both interpret the advantages and disadvantages yourself (what's easier
for YOU to see), as well as to understand the technical differences.
P3. Make your labels meaningful! Don't label four different plots with
identical labels.
P4. Aspect ratio strongly influences how legible the trends in one's plots
are. Don't just accept defaults, but be deliberate about your graphical
displays.
P5. Cleveland's (and your) S-L plots use y.hat, the fitted values, on the
x-axis, and the sqrt(abs(resid)) on the y-axis. This x-axis choice is a
good way to detect non-constant variance in any linear combination of the
independent variables. One should also consider whether the variance is
constant as *each* independent variable changes. In the bivariate case,
there is only one independent variable, so plotting the original x on the
x-axis should suffice. We'll talk more about how constant (and mean zero)
variance relates to the assumptions of OLS in the weeks to come.
------------------------------------------
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
Homepage: http://www.people.fas.harvard.edu/~rtmoore/
Gov1000: http://www.courses.fas.harvard.edu/~gov1000/
Hi, folks. Ben Goodrich, a G-2 graduate student researcher at CBRSS,
wanted me to forward this notice about his presentation Friday. The paper
is attached, but he notes that the talk will be somewhat less technical.
Best,
Ryan
---------- Forwarded message ----------
Date: Tue, 9 Nov 2004 12:32:39 -0500
From: Ben Goodrich <goodrich(a)fas.harvard.edu>
To: 'Ryan Thomas Moore' <rtmoore(a)fas.harvard.edu>
Subject: Presentation Friday
Hi Ryan,
I am redoing the presentation I did at CBRSS for the graduate student
workshop this Friday (noon, Littauer M-17). Could you forward this to the
Gov1000 crowd? The presentation is going to be a little less technical than
the paper is.
Thanks,
Ben
Hi Jonathan-
I'm planning to hold section on Thurs., though I'm still waiting for a
final approval from the CBRSS admin staff on building access.
Alison
On Tue, 9 Nov 2004, Jonathan Harris wrote:
> Is Thursday section on or off due to the university holiday?
>
> Thanks
>
> andy
>
Hey, everyone. Although I sent the email last night, it's come to my
attention that some people didn't receive the notice about today's calc
session until after the session. If there are still vector calculus
questions after today's lecture and Tuesday's section, I'll be happy to
run through the calculus material in office hours after section.
See everyone at 4pm,
Ryan
------------------------------------------
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
Homepage: http://www.people.fas.harvard.edu/~rtmoore/
Gov1000: http://www.courses.fas.harvard.edu/~gov1000/
Hi, everyone. Monday morning from 10.30am to 11.30am I'll be conducting a
calculus (p)review in Room 22 at CBRSS. We'll talk about the definition
of the derivative, derivatives of functions of one variable, and the
gradient and the Hessian. This session is entirely optional, and intended
for those with less exposure to calculus, but of course, all are welcome.
Ryan
------------------------------------------
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
Homepage: http://www.people.fas.harvard.edu/~rtmoore/
Gov1000: http://www.courses.fas.harvard.edu/~gov1000/