I have the following model : Y = B1X + B2X + e. I want to test if B1 = B2, and also if B1 = B2 = 0. Any suggestions to which test that would be appropiate? Thanks in advance.
122867
What exactly is contrast matrix (a term, pertaining to an analysis with categorical predictors) and how exactly is contrast matrix specified? I.e. what are columns, what are rows, what are the constraints on that matrix and what does number in column j and row i mean? I tried to look into the docs and web but it seems that everyone uses it yet there's no defition anywhere. I could backward-engineer the available pre-defined contrasts, but I think the definition should be available without that.  &gt; contr.treatment(4)   2 3 4 1 0 0 0 2 1 0 0 3 0 1 0 4 0 0 1 &gt; contr.sum(4)   [,1] [,2] [,3] 1    1    0    0 2    0    1    0 3    0    0    1 4   -1   -1   -1 &gt; contr.helmert(4)   [,1] [,2] [,3] 1   -1   -1   -1 2    1   -1   -1 3    0    2   -1 4    0    0    3 &gt; contr.SAS(4)   1 2 3 1 1 0 0 2 0 1 0 3 0 0 1 4 0 0 0
84357
How to prove that $a^2+ab+b^2\ge 0$?  Obviously the squares are positive, but how can I be sure that $ab$ doesn't become too negative with a certain combination of $a$ and $b$?
58577
I have this simple test: double h; ... // code that assigns h its initial value, used below ... if ((h&gt;0) &amp;&amp; (h&lt;1)){  //branch 1 -some computations } else{  //branch 2- no computations }  I listed my values as I got some really strange results and for example if: h=1 then the first branch is reached and I do not understand why since if h=1 I want branch2 to be computed. Am I getting confused by something so obvious?  Edit: This is how I compute and then use h: double* QSweep::findIntersection(edge_t edge1,edge_t edge2) {   point_t p1=myPoints_[edge1[0]]; point_t p2=myPoints_[edge1[1]]; point_t p3=myPoints_[edge2[0]]; point_t p4=myPoints_[edge2[1]];  double xD1,yD1,xD2,yD2,xD3,yD3,xP,yP,h,denom; double* pt=new double[3];          // calculate differences   xD1=p2[0]-p1[0];   xD2=p4[0]-p3[0];   yD1=p2[1]-p1[1];   yD2=p4[1]-p3[1];   xD3=p1[0]-p3[0];   yD3=p1[1]-p3[1];      xP=-yD1; yP=xD1; denom=xD2*(-yD1)+yD2*xD1; if (denom==0) {     return NULL; } else{ h=(xD3*(-yD1)+yD3*xD1)/denom; } std::cout&lt;&lt;&quot;h is&quot;&lt;&lt;h&lt;&lt;endl; if (h &lt; 1) std::cout&lt;&lt;&quot;no&quot;&lt;&lt;endl; else std::cout&lt;&lt;&quot;yes&quot;&lt;&lt;endl; if (h==1) {     return NULL; } else{ if ((h&gt;0)&amp;&amp;(h&lt;1)){     pt[0]=p3[0]+xD2*h;       pt[1]=p3[1]+yD2*h;     pt[2]=0.00; } else{     return NULL; } }   return pt;    }  Edit: Okay, so it is clear how I should reformulate the condition. From: double h; if (h==1){    //computations here }  To: double h; if (abs(h-1)&lt;tolerance){   //computations here }  When I use double numbers. But how do I reformulate this? double h; if (h&lt;1){    //computations here }
77653
For me, it is pretty clear that $a + \overline{a}*b = a + b$, because the first $a$ in the or will make sure that if the second term must be 'evaluated', $a$ will always be false, and therefore won't matter in the and - probably because I'm a programmer and it is very common to see this unnecessary cluttering in long if-else structures.  I can easily prove it with the truth table as well, just make both expressions', and turns out they are identical.  But I was looking for a 'algebraic' way to prove it. That is, something using the basic operations properties like the fact that they are transitive, commutative, associative, etc. For example, if I was to prove this other simple identity $a + a*b = a$ I would simply do something like:  $a + a*b = a*(1 + b) = a*1 = a$.  Is there a way to also prove the former using this algebraic operations, without resorting to the truth table?
32708
How to find two non singular matrices $B$ and $C$ such that $BC+ CB= 0$. Clearly $B$ and $C$ must be square matrices of same order and the order is even.so it is possible we can find some example of order 2. But I cannot find any. I would be happy if someone helps me in finding some matrices.Thanks in advance.
33133
Consider the general linear regression model: $$y_i = \beta_0 + \beta_1x_{i1} + \beta_2x_{i2} + \cdots + \beta_px_{ip} + \epsilon_i = \mathbf{x}_i^t \beta + \epsilon_i$$  where $\textbf{x}_i = (1,x_{i1},x_{i2},\cdots,x_{ip})^T$, $\beta=(\beta_0,\beta_1,\cdots,\beta_p)^T$ and $\epsilon_i$ are iid N(0,$\sigma^2$).  I would like to see a complete proof of the following identity from first principles: $$\sum_{i=1}^n(y_i - \bar{y})^2 = \sum_{i=1}^n(\hat{y}_i - \bar{y})^2 + \sum_{i=1}^n(y_i - \hat{y}_i)^2$$ where $\hat{y}_i= \mathbf{x}_i^t \hat{\beta} $ ($\hat{\beta}$ is the least square estimator, $\bar{y}$ ia the sample mean of $y_i$).  I know that the two terms on the right can be obtained by subtracting and adding $\hat{y}_i$ on the left side. But this introduces a "cross term": $$\sum_{i=1}^n2(\hat{y}_i - \bar{y})(y_i - \hat{y}_i)$$  Many texts claim that this is zero, but I have not seen a general proof of this statement. How can this be shown?
8286
Given three variables, y and x, which are positive continuous, and z, which is categorical, I have two candidate models given by:  fit.me &lt;- lmer( y ~ 1 + x + ( 1 + x | factor(z) ) )   and  fit.fe &lt;- lm( y ~ 1 + x )   I hope to compare these models to determine which model is more appropriate. It seems to me that in some sense fit.fe is nested within fit.me. Typically, when this general scenario holds, a chi-squared test can be performed. In R, we can perform this test with the following command,  anova(fit.fe,fit.me)   When both models contain random-effects (generated by lmer from the lme4 package), the anova() command works fine. Owing to boundary parameters, it is normally advisable to test the resulting Chi-Square statistic via simulation, nonetheless, we can still use the statistic in the simulation procedure.  When both models contain only fixed-effects, this approach---and, the associated anova() command---work fine.  However, when one model contains random effects and the reduced model contains only fixed-effects, as in the above scenario, the anova() command doesn't work.  More specifically, I get the following error:   &gt; anova(fit.fe, fit.me)  Error: $ operator not defined for this S4 class   Is there anything wrong with using the Chi-Square approach from above (with simulation)? Or is this simply a problem of anova() not knowing how to deal with linear models generated by different functions?  In other words, would it be appropriate to manually generate the Chi-Square statistic derived from the models? If so, what are the appropriate degrees of freedom for comparing these models? By my reckoning:  $$ F = \frac{\left((SSE_{reduced}-SSE_{full})/(p-k)\right)}{\left((SSE_{full})/(n-p-1)\right)} \sim F_{p-k,n-p-1} $$  We are estimating two parameters in the fixed effects model (slope and intercept) and two more parameters (variance parameters for the random slope and random intercept) in the mixed-effects model. Typically, the intercept parameter isn't counted in the degrees of freedom computation, so that implies that $k=1$ and $p=k+2=3$; having said that I'm not sure if the variance parameters for the random-effects parameters should be included in the degrees of freedom computation; the variance estimates for fixed-effect parameters are not considered, but I believe that to be because the parameter estimates for fixed effects are assumed to be unknown constants whilst they are considered to be unknowable random variables for mixed effects. I would appreciate some assistance on this issue.  Finally, does anybody have a more appropriate (R-based) solution to comparing these models?
13912
I want to calculate standard error of y-intercept or constant term in the multiple regression equation $Y = b_0 + b_1X_1 + b_2X_2$  I found the formula for standard error estimation of co-efficient $b_1$ and $b_2$ as given in the link    But I am not getting any formula for estimating the standard error of b0. Could anyone help me out? Regards Koushik
53675
i have this situation. A set of 5000 objects, 4950 blue and 50 green. From this set two people (person A and person B) fish separately 100 objects each and i would like to know if one of the two people has tricked me (not fishing blinded).   person A fished one set of 100 objects, 90 blue and 10 green. person B fished one set of 100 objects, 99 blue and 1 green (that would be expected by chance)   Which test should i use? Could someone point me to a R example/solution about it? Thanks in advance
13429
Let's say there's one DV (Y) and three IVs (X1, X2, X3), and among IVs, X1 is a dummy variable. In the regression model without interaction terms, the results can be represented like this:  Y ~ X1 + X2 + X3  X1 : non-significant X2 : significant X3 : significant   In this case, is it meaningful to check some interaction terms (e.g. X1 $\cdot$ X2 or X1 $\cdot$ X3)? At first I thought I don't have to because the main effect of X1 indicates non-significance. But I'm afraid I'm missing something important.
37318
I am trying to solve this complicated Generalised Likelihood Ratio Test problem for 2 samples as part of my independent study course. However, the book that I am using does not talk about 2 samples at all; all the examples provided are 1 sample questions.  The question:      Assume that $X_1, ...,X_m$ is a random sample from $\theta_1e^{-\theta_1x}I_{(0,\infty)}(x)$ and $Y_1, ...,Y_n$ is a random sample from $\theta_2e^{-\theta_2y}I_{(0,\infty)}(y)$. If we assume the samples are independent. What is the GLR for testing   $H_0:\theta_1=\theta_2$  vs. $H_0:\theta_1\ne\theta_2$?   So far I just got to $$\Lambda=\frac{L(\theta,\theta)}{L(\theta_1,\theta_2)}=\frac{\theta^{m+n}\exp[-\theta\sum x_i+\sum y_i]}{\theta_1^m\exp[-\theta_1\sum x_i]\theta_2^n \exp[-\theta_2\sum y_i]}$$  However, I don't know what I should do for the next step. They say it should be an F test but I just can't see it.   I appreciate your time and help!
70317
I have the following model: $$ |X| = B_0 +B_1 \cdot y + B_2 \cdot z , $$ where $z$ and $y$ are normally distributed random variables, and $B_1$ and $B_2$ denote the coefficients.   My dependent variable contains either the positive or negative values of $X$. The positive and negative values of $X$ together are normally distributed, with a mean and median of around zero. For statistical reasons I would like to separately test the positive and negative values. This splits the left and right side of the otherwise normally distributed variable $X$. This clearly violates the normality assumption used for linear regression models. If I want to compare groups I would use a nonparametric type of test, but in this case I want to run the equivalent of a linear regression.  Is this possible?
99050
Let $A$ and $B$ be real $n\times n$. Is it true that if $ABA=A$ is true $B=BAB$ ?  My reasoning: $$ABA=(ABA)BA=A  \; \Leftrightarrow A(B-BAB)A=0.$$  But as it follows from the latter, that $B-BAB=0$, if in the general case the matrix $A$ is not invertible?
35268
In t-tests (paired or independent) we test if the difference in means if 0 (or another value).  I'm wondering if it's possible to instead test if the difference is less than x?
66997
Suppose I have a multiple linear regression of the form: $$y_i = \beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} +\epsilon$$ Then suppose I am interested in testing this set of hypotheses: $$H_0: \beta_1 = 0 \text{ OR } \beta_2 = 0$$ $$H_A: \beta_1 \neq 0 \text{ AND } \beta_2 \neq 0$$ I am interested in deriving a test statistic for this hypothesis.  I understand that I need to derive this under the null hypothesis.  However, it is not as straightforward as just plugging in $\beta_1 = 0 \text{ and } \beta_2 = 0$, since our null is that either/or is zero, not both. Any input would be much appreciated, thank you!
14012
Is it possible to have a (multiple) regression equation with two or more dependent variables?  Sure, you could run two separate regression equations, one for each DV, but that doesn't seem like it would capture any relationship between the two DVs?
61648
Given matrices $A$ and $B$, where that $AB = A + B$, prove $AB = BA$. I keep coming up with AB = AB. It seems like basic algebra, but for the life of me, I'm getting nowhere :/. Someone help please?