Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6866289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:09:53+00:00 2026-05-27T03:09:53+00:00

I’m looking for a way to specify the value of a predictor variable. When

  • 0

I’m looking for a way to specify the value of a predictor variable. When I run a glm with my current data, the coefficient for one of my variables is close to one. I’d like to set it at .8.

I know this will give me a lower R^2 value, but I know a priori that the predictive power of the model will be greater.

The weights component of glm looks promising, but I haven’t figured it out yet.

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:09:54+00:00Added an answer on May 27, 2026 at 3:09 am

    I believe you are looking for the offset argument in glm. So for example, you might do something like this:

    glm(y ~ x1, offset = x2,...)
    

    where in this case the coefficient of x2 would be set at 1. In your case, you may perhaps want to multiply that column by 0.8?

    To expand, here is what ?glm says about the offset argument:

    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.

    So you can add offsets in the model formula itself using the offset() function, as well. Here is a simple example illustrating its use:

    set.seed(123)
    
    d <- data.frame(y = factor(sample(0:1,size = 100,replace = TRUE)),x1 = runif(100),x2 = runif(100))
    
    glm1 <- glm(y~x1+x2,data = d,family = binomial)
    coef(glm1)
    
    (Intercept)          x1          x2 
      0.4307718  -0.4128541  -0.6994810 
    
    glm2 <- glm(y~x1,data = d,offset = x2,family = binomial)
    coef(glm2)
    
    (Intercept)          x1 
     -0.4963699  -0.2185571 
    
    glm3 <- glm(y~x1+offset(x2),data = d,family = binomial)
    coef(glm3)
    
    (Intercept)          x1 
     -0.4963699  -0.2185571 
    

    Note that the last two have the same coefficients.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I have some data like this: 1 2 3 4 5 9 2 6
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm making a simple page using Google Maps API 3. My first. One marker
I would like to count the length of a string with PHP. The string
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.