In simple (univariate) OLS $y = \beta_0 + \beta_1 x$, the estimate of the slope coefficient is asymptotically equal to the ratio of covariances, i.e.  $$ \hat{\beta_1} \rightarrow \frac{Cov[X,Y]}{Cov[X,X]} $$  so if we know what the covariance matrix for the joint distribution of $[X,Y]$ is we can derive OLS coefficients without needing any data.   Can we do the same for the multivariate case? For example, if we know the covariance matrix of the data-generating process for $[Y,X_1,X_2]$, what would be the asymptotic expression for OLS coefficients in $y = \beta_0 + \beta_1 x_1 + \beta_2 x_2$?  Add 1 If the data was centered (or the means where zero) then the data matrix $\textbf{X}^T\textbf{X}$ (without column of 1s) would asymptotically be equal to the co-variance matrix of $[X_1,X_2]$. But the estimate includes the column of 1s and work with non-centered data, so it's not clear to me what this becomes in this case.  Add 2 If do apply the OLS formula for zero-mean RVs without adding the column of 1s to the data matrix, then for 2 explanatory variables we get $$ \textbf{X}^T \textbf{X} =       \begin{bmatrix}     x_{1,1} &amp; x_{1,2} \\     x_{2,1} &amp; x_{2,2} \\     \vdots &amp; \vdots \\     x_{n,1} &amp; x_{n,2}\\     \end{bmatrix}^T     \begin{bmatrix}     x_{1,1} &amp; x_{1,2} \\     x_{2,1} &amp; x_{2,2} \\     \vdots &amp; \vdots \\     x_{n,1} &amp; x_{n,2}\\     \end{bmatrix} =     \begin{bmatrix}    \sum_{i=1}^{n} x_{i,1}^2 &amp; \sum_{i=1}^{n} x_{i,1}x_{i,2} \\    \sum_{i=1}^{n} x_{i,1}x_{i,2} &amp; \sum_{i=1}^{n} x_{i,2}^2 \\        \end{bmatrix} $$ and its inverse is  $$ (\textbf{X}^T \textbf{X})^{-1} = \frac{1}{\sum_{i=1}^{n} x_{i,1}^2 \sum_{i=1}^{n} x_{i,2}^2 - (\sum_{i=1}^{n} x_{i,1}x_{i,2})^2}    \begin{bmatrix}    \sum_{i=1}^{n} x_{i,2}^2 &amp; -\sum_{i=1}^{n} x_{i,1}x_{i,2} \\    -\sum_{i=1}^{n} x_{i,1}x_{i,2} &amp; \sum_{i=1}^{n} x_{i,1}^2 \\    \end{bmatrix} $$ The other term is given by $$ \textbf{X}^T \textbf{y} =       \begin{bmatrix}     x_{1,1} &amp; x_{1,2} \\     x_{2,1} &amp; x_{2,2} \\     \vdots &amp; \vdots \\     x_{n,1} &amp; x_{n,2}\\     \end{bmatrix}^T \begin{bmatrix}     y_{1} \\     y_{2} \\     \vdots \\     y_{n} \\     \end{bmatrix} =     \begin{bmatrix}    \sum_{i=1}^{n} x_{i,1}y_{i} \\    \sum_{i=1}^{n} x_{i,2}y_{i}  \\        \end{bmatrix} $$ Putting it together gives $$ \begin{bmatrix}     \hat{\beta}_{1} \\     \hat{\beta}_{2} \\     \end{bmatrix} = (\textbf{X}^T \textbf{X})^{-1} \textbf{X}^T \textbf{y} =  \frac{1}{\sum_{i=1}^{n} x_{i,1}^2 \sum_{i=1}^{n} x_{i,2}^2 - (\sum_{i=1}^{n} x_{i,1}x_{i,2})^2}   \begin{bmatrix}    \sum_{i=1}^{n} x_{i,2}^2 \sum_{i=1}^{n} x_{i,1}y_{i} -\sum_{i=1}^{n} x_{i,1}x_{i,2} \sum_{i=1}^{n} x_{i,2}y_{i} \\    \sum_{i=1}^{n} x_{i,1}^2 \sum_{i=1}^{n} x_{i,2}y_{i} -\sum_{i=1}^{n} x_{i,1}x_{i,2} \sum_{i=1}^{n} x_{i,1}y_{i} \\    \end{bmatrix} $$ which seems to agree with the result in the OP of the question pointed to by whuber. Asymptotically, this looks like $$ \begin{bmatrix}     \hat{\beta}_{1} \\     \hat{\beta}_{2} \\     \end{bmatrix} \rightarrow (Cov(\textbf{X},\textbf{X}))^{-1} Cov(\textbf{X},Y) $$ where $\textbf{X}$ now indicates a multivariate RV, not the data matirx of observations. Since covariances do not depend on means, I believe that this result also holds for non-zero mean RVs.
For simple linear regression, the regression coefficient is calculable directly from the variance-covariance matrix $C$, by  $$ C_{d, e}\over C_{e,e} $$ where $d$ is the dependent variable's index, and $e$ is the explanatory variable's index.  If one only has the covariance matrix, is it possible to calculate the coefficients for a model with multiple explanatory variables?   ETA: For two explanatory variables, it appears that $$\beta_1 = \frac{Cov(y,x_1)var(x_2) - Cov(y,x_2)Cov(x_1,x_2)}{var(x_1)var(x_2) - Cov(x_1,x_2)^2} $$ and analogously for $\beta_2$. I'm not immediately seeing how to extend this to three or more variables.
Basically on my site I have a bunch of song lyrics and in a static page I want to show them listed by album  and album position of the song and I have two custom fields with that data, sd_album_title and `sd_album_track_n. Plus some of the songs don't have an album yet, so both values are void, and I wish to list those ones at the foot of the others, sorted by alphabetical order.  The latest thing I tried at least to sort everything by the two field is this one:  $key = 'sd_album_title'; $themeta = get_post_meta($post-&gt;ID, $key, TRUE);  add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) {     if ($themeta != '') {         $query-&gt;set( 'post_type', 'lyric' );         $query-&gt;set( 'meta_key', 'sd_album_title' );         $query-&gt;set( 'orderby', 'meta_value' );         $query-&gt;set( 'order', 'ASC' );         $query-&gt;set( 'meta_query', array(               array(                     'key' =&gt; 'sd_album_title'               ),               array(                     'key' =&gt; 'sd_album_track_n',                     'value' =&gt; 'target_value',                     'compare' =&gt; '&gt;=',                     'type' =&gt; 'numeric'               )         ));     }     return $query; }  $getlist= 'my_get_posts'; $posts = get_posts( $getlist );   And my intention was to put an else at the end of it with an array ordered by title for the other songs, but it returns nothing as it is. Could something like this work with some corrections or am I on a totally wrong path? How can I convert an std::string to a char* or a const char*? Integrated circuits seem to have standard voltages of 5 V, 3.3 V, 2.5 V, 1.8 V, etc.  Who decides these voltages? Why do smaller devices require lower voltages? In how many ways can we pick three different numbers out of the group $1,2,3,\dots,100$ such that the largest number is larger than the product of the two smaller ones? (The order in which we pick the numbers does not matter.) Kepler problem in time: how do two gravitationally attracted particles move? Two particles with initial positions and velocities $r_1,v_1$ and $r_2,v_2$ are interacting by the inverse square law (with G=1), so that  $$ {d^2r_1\over dt^2} = - { m_2(r_1-r_2)\over |r_1-r_2|^3} $$ $$ {d^2r_2\over dt^2} = - { m_1(r_2-r_1)\over |r_1-r_2|^3} $$  (the inverse square law along the line of separation). What is the complete solution of these differential equations? What is the position of the two objects as a function of time?  After reading a lot on Wikipedia, I've come to the definition of center of mass and relative coordinates:   $$R(t) ~=~ \frac{m_1 r_1 + m_2 r_2}{m_1+m_2}$$  $$\ddot{r}(t) r(t)^2 ~=~ (m_1+m_2)G$$  Where $R$ is the center of mass, and $r$ is the displacement between the particles... Is this correct? How do I proceed to solve the differential equation? In QGIS I would like to clip a raster precipitation layer using an admin boundary layer that is vector data. However the Geoprocessing tools seem to be usable only for vector data. How can I clip this precipitation layer? With jQuery, how do I find out which key was pressed when I bind to the keypress event?  $('#searchbox input').bind('keypress', function(e) {});   I want to trigger a submit when ENTER is pressed.  [Update]  Even though I found the (or better: one) answer myself, there seems to be some room for variation ;)  Is there a difference between keyCode and which - especially if I'm just looking for ENTER, which will never be a unicode key?  Do some browsers provide one property and others provide the other one? How do I check if an integer is even or odd? How can I check if a given number is even or odd in C? Cursor is set to move by increments. how to reset to normal? My cursor is moving by every selection by large increments!  Normally when I use Blender, I am able to select and move objects to any coordinate. Now, all of the sudden, when I select an object or mesh the selection moves by an inch or so in each direction.  How do I reset it to normal? Is it feasible to transform each variable differently while doing multiple regression Pointer to class data member "::*" I came across this strange code snippet which compiles fine:  class Car {     public:     int speed; };  int main() {     int Car::*pSpeed = &amp;Car::speed;     return 0; }   Why does C++ have this pointer to a non-static data member of a class? What is the use of this strange pointer in real code? I try to add an item to my sharepoint list from a custom web part. Is there any mistake in my code?  [WebMethod]         public static string AjouterDemande()         {             SPList ListeDemandeConge = SPContext.Current.Site.RootWeb.Lists["DEMANDE CONGÉ"];             SPListItem ListItem = ListeDemandeConge.Items.Add();             ListItem["CODE"] = code;             ListItem["DEMANDEUR"] = Utilisateur.LoginName;             ListItem["DATE DEMANDE"] = DateTime.Today.Date;             ListItem["DATE FIN"] = EndDateD;             ListItem["DATE DEPART"] = StartDateD;             ListItem["DUREE"] = int.Parse(DayCount);             ListItem["PREMIER RESPONSABLE"] = Employe.FirstSuperior.LoginName;             ListItem["DEUXIEME RESPONSABLE"] = Employe.SecondSuperior.LoginName;             ListItem["PRESENCE PRES"] = Boolean.Parse(FirstRespPresent);             ListItem["SOLDE CONGE"] = Conge.SoldeAnneeConge;             ListItem["MOIS"] = int.Parse(StartDateTab[1]);             ListItem["ANNEE"] = int.Parse(StartDateTab[0]);             ListItem["JOURS APPROUVEES"] = 0;             ListItem.Update();             ListeDemandeConge.Update();             return "true";          }   When I use F10 to process debugging step by step and get to my listitem.update(), it went out without giving any error. External monitors show blank screen until restart MacBook Pro (15-inch, 2016) with 2 USB-C to HDMI adapters. The setup works great if I start up in that configuration.   If I connect the adapters while the machine is running or simply sleeping, one of the monitors will never get a signal and stay in low power mode. The OS sees the monitor, it shows in the display arrangement settings and I can move the mouse into it, but until I restart, I can't see anything on it.  Once I have restarted I can let the machine sleep or whatever, and the display still works unless I disconnect the adapter. As soon as I do that a restart is required to use it again.   Using MacOS Sierra (10.12.4)  Using this adapter: Should 'Hi', 'thanks', taglines, and salutations be removed from posts? I am currently developing a website which is going to take some time to finish. I need to move some 'stuff' to production frequently, while maintaining a under construction status. My front page will clearly mention that my website is under construction.  I know crawlers will access my URL before I am ready to go live. Should I tell them my site is under construction (no need to index)? If yes how?  P.S.: Eventually, I am ok to let them see my under construction front page. How do I remove the LAMP stack so I can start over? I'd like to start over with my webserver and I'd like to reinstall all the LAMP packages, how do I do that? ravel: opposite meanings? Xerces error: org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl ascending/descending in LINQ - can one change the order via parameter? Prove $\frac{1}{2}\sum_p \frac{1}{p^2}+\frac{1}{3}\sum_p \frac{1}{p^3}+\cdots$ converges