Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I believe you are looking for the <code>offset</code> argument in <code>glm</code>. So for example, you might do something like this:</p> <pre><code>glm(y ~ x1, offset = x2,...) </code></pre> <p>where in this case the coefficient of <code>x2</code> would be set at 1. In your case, you may perhaps want to multiply that column by 0.8?</p> <p>To expand, here is what <code>?glm</code> says about the <code>offset</code> argument:</p> <blockquote> <p>this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector of length equal to the number of cases. One or more offset terms can be included in the formula instead or as well, and if more than one is specified their sum is used. See model.offset.</p> </blockquote> <p>So you can add offsets in the model formula itself using the <code>offset()</code> function, as well. Here is a simple example illustrating its use:</p> <pre><code>set.seed(123) d &lt;- data.frame(y = factor(sample(0:1,size = 100,replace = TRUE)),x1 = runif(100),x2 = runif(100)) glm1 &lt;- glm(y~x1+x2,data = d,family = binomial) coef(glm1) (Intercept) x1 x2 0.4307718 -0.4128541 -0.6994810 glm2 &lt;- glm(y~x1,data = d,offset = x2,family = binomial) coef(glm2) (Intercept) x1 -0.4963699 -0.2185571 glm3 &lt;- glm(y~x1+offset(x2),data = d,family = binomial) coef(glm3) (Intercept) x1 -0.4963699 -0.2185571 </code></pre> <p>Note that the last two have the same coefficients.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload