# [R] Maximization of quadratic forms

Wed May 19 04:52:06 CEST 2010

Hi Taki,

This should be doable with "gnls" by properly specifying the weights' argument, although I cannot figure out how to do it without spending much time (someone like Doug Bates would know for sure).

But let me ask you:  did you try the straightforward nonlinear optimization (e.g. optim)?  Did you run into any convergence problems?  Did it take way too much time?

If \mu(\beta) is not a nasty function, you should be able to provide analytic gradient for your objective function.  This would make nonlinear optimization quite efficient.

Ravi.

____________________________________________________________________

Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619

----- Original Message -----
From: Russell Shinohara <rshinoha at jhsph.edu>
Date: Tuesday, May 18, 2010 2:38 pm
Subject: [R] Maximization of quadratic forms
To: r-help at r-project.org

> Dear R Help,
>
>  I am trying to fit a nonlinear model for a mean function
> $\mu(Data_i,\beta)$ for a fixed covariance matrix where $\beta$ and
> $\mu$ are low-dimensional. More specifically, for fixed
> variance-covariance matrices $\Sigma_{z=0}$ and $\Sigma_{z=1}$
> (according to a binary covariate $Z$), I am trying to minimize:
>
>  $\sum_{i=1^n} (Y_i-\mu_(Data_i,\beta))' \Sigma_{z=z_i}^{-1} (Y_i-\mu_(Data_i,\beta))$
>
>  in terms of the parameter $\beta$. Is there a way to do this in R in
> a more stable and efficient fashion than just using a general
> optimization function such as optim? I have tried to use gnls, but I
> was unsuccessful in specifying different values of the covariance
> matrix according to the covariate $Z$.
>
>  Thank you very much for your help,
>  Taki Shinohara
>
>
>
>  ----
>
>  Russell Shinohara, MSc
>  PhD Candidate and NIH Fellow
>  Department of Biostatistics
>  Bloomberg School of Public Health
>  The Johns Hopkins University
>  615 N. Wolfe St., Suite E3033
>  Baltimore, MD 21205
>  tel: (203) 499-8480
>
>
>  ______________________________________________
>  R-help at r-project.org mailing list
>
`