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 8822555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:08:08+00:00 2026-06-14T06:08:08+00:00

I was reading the documentation on R Formula , and trying to figure out

  • 0

I was reading the documentation on R Formula, and trying to figure out how to work with depmix (from the depmixS4 package).

Now, in the documentation of depmixS4, sample formula tends to be something like y ~ 1.
For simple case like y ~ x, it is defining a relationship between input x and output y, so I get that it is similar to y = a * x + b, where a is the slope, and b is the intercept.

If we go back to y ~ 1, the formula is throwing me off. Is it equivalent to y = 1 (a horizontal line at y = 1)?

To add a bit context, if you look at the depmixs4 documentation, there is one example below

depmix(list(rt~1,corr~1),data=speed,nstates=2,family=list(gaussian(),multinomial()))

I think in general, formula that end with ~ 1 is confusing to me. Can any explain what ~ 1 or y ~ 1 mean?

  • 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-06-14T06:08:10+00:00Added an answer on June 14, 2026 at 6:08 am

    Many of the operators used in model formulae (asterix, plus, caret) in R, have a model-specific meaning and this is one of them: the ‘one’ symbol indicates an intercept.

    In other words, it is the value the dependent variable is expected to have when the independent variables are zero or have no influence. (To use the more common mathematical meaning of model terms, you wrap them in I()). Intercepts are usually assumed so it is most common to see it in the context of explicitly stating a model without an intercept.

    Here are two ways of specifying the same model for a linear regression model of y on x. The first has an implicit intercept term, and the second an explicit one:

    y ~ x
    y ~ 1 + x
    

    Here are ways to give a linear regression of y on x through the origin (that is, without an intercept term):

    y ~ 0 + x
    y ~ -1 + x
    y ~ x - 1
    

    In the specific case you mention ( y ~ 1 ), y is being predicted by no other variable so the natural prediction is the mean of y, as Paul Hiemstra stated:

    > data(city)
    > r <- lm(x~1, data=city)
    > r
    
    Call:
    lm(formula = x ~ 1, data = city)
    
    Coefficients:
    (Intercept)  
           97.3  
    
    > mean(city$x)
    [1] 97.3
    

    And removing the intercept with a -1 leaves you with nothing:

    > r <- lm(x ~ -1, data=city)
    > r
    
    Call:
    lm(formula = x ~ -1, data = city)
    
    No coefficients
    

    formula() is a function for extracting formula out of objects and its help file isn’t the best place to read about specifying model formulae in R. I suggest you look at this explanation or Chapter 11 of An Introduction to R.

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

Sidebar

Related Questions

I'm trying to understand how ID3 tags work, so, after reading some documentation, I
Reading the documentation on the changes to UIViewControllers in iOS, I trying to figure
I'm reading the documentation now, and I have 1 thing to be fixed -
While reading Microsoft documentation, I stumbled on such an interesting code sample: interface ISomeInterface
From reading the documentation Jekyll's template data one might think that the way to
I am trying to teach myself Python by reading documentation. I am trying to
As I understand from reading documentation, UIPopoverControllers are only supported on the iPad. Therefore
Reading the documentation and going through the Apple sample codes (and most of the
I'm reading some documentation on a service I'm trying to use, and it reads
I'm new to Java, and while reading documentation so far I can't find any

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.