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

  • SEARCH
  • Home
  • 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 6147873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:10:48+00:00 2026-05-23T19:10:48+00:00

I have some data in R with various variables for my cases: B T

  • 0

I have some data in R with various variables for my cases:

          B T H G S Z
Golf      1 1 1 0 1 0
Football  0 0 0 1 1 0
Hockey    1 0 0 1 0 0
Golf2     1 1 1 1 1 0
Snooker   1 0 1 0 1 1

I also have a vector of my expected output per case:

1, 2, 3, 1, 4

What I would like to do is identify variables that are not useful. In this example B and Z offer little ability to classify the data so I would like to be told that fact.

I looked at using multiple linear regression, however I don’t want to separately type in and manipulate every variable/dimension as in my proper data it runs into the thousands, with tens of thousands of cases.

Any help on the best approach would be greatly appreciated.

Btw I’m not a statistician, I’m a software developer, so excuse me if the terminology isn’t correct.

  • 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-23T19:10:49+00:00Added an answer on May 23, 2026 at 7:10 pm

    you have asked quite a broad question, but I will try and be as precise as I can. But a note of caution: every statistical analysis method has a series of assumptions that are implicit. This means that if you rely on the results of a statistical model without understanding the limitations of the analysis, you could quite easily make the wrong conclusion.

    It is also not quite clear to me what you mean by classification. If somebody asked me to do a classification analysis, I would probably consider things like cluster analysis, factor analysis or latent class analysis. there are some variants of linear regression modelling that could also be applicable.

    That said, here is how you should go about doing a linear regression using your data.

    First, replicate your sample data:

    dat <- structure(list(B = c(1L, 0L, 1L, 1L, 1L), T = c(1L, 0L, 0L, 1L, 
                0L), H = c(1L, 0L, 0L, 1L, 1L), G = c(0L, 1L, 1L, 1L, 0L), S = c(1L, 
                1L, 0L, 1L, 1L), Z = c(0L, 0L, 0L, 0L, 1L)), .Names = c("B", 
            "T", "H", "G", "S", "Z"), class = "data.frame", row.names = c("Golf", 
            "Football", "Hockey", "Golf2", "Snooker"))
    dat
             B T H G S Z
    Golf     1 1 1 0 1 0
    Football 0 0 0 1 1 0
    Hockey   1 0 0 1 0 0
    Golf2    1 1 1 1 1 0
    Snooker  1 0 1 0 1 1
    

    Next, add the expected values:

    dat$expected <- c(1,2,3,1,4)
    dat
             B T H G S Z expected
    Golf     1 1 1 0 1 0        1
    Football 0 0 0 1 1 0        2
    Hockey   1 0 0 1 0 0        3
    Golf2    1 1 1 1 1 0        1
    Snooker  1 0 1 0 1 1        4
    

    finally, we can start the analysis. Fortunately, lm has a shortcut mechanism to tell it to use all of the columns in your data frame. To do this use the following formula: expected~. :

    fit <- lm(expected~., dat)
    summary(fit)
    Call:
    lm(formula = expected ~ ., data = dat)
    
    Residuals:
    ALL 5 residuals are 0: no residual degrees of freedom!
    
    Coefficients: (2 not defined because of singularities)
                 Estimate Std. Error t value Pr(>|t|)
    (Intercept)  2.00e+00         NA      NA       NA
    B            1.00e+00         NA      NA       NA
    T           -3.00e+00         NA      NA       NA
    H            1.00e+00         NA      NA       NA
    G           -4.71e-16         NA      NA       NA
    S                  NA         NA      NA       NA
    Z                  NA         NA      NA       NA
    
    Residual standard error: NaN on 0 degrees of freedom
    Multiple R-squared:     1,  Adjusted R-squared:   NaN 
    F-statistic:   NaN on 4 and 0 DF,  p-value: NA 
    

    And the last word of caution. Since your sample data contained fewer rows than columns, the linear regression model has insufficient data to function. So in this case it simply discarded the last two columns. Your brief description of your data seems to indicate that you have far more rows and columns, so it ought not to be a problem for you.

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

Sidebar

Related Questions

I have some data that has various attributes and I want to hierarchically group
I have to login in to various elements to retrieve some data, problem is
Quite some time i`ve learnt MVC. I have seen various techniques to post data
I'd like to output some data to a file. For example assume I have
I have a 'producer' object, that steps through some data and emits various signals
I have some data with messed-up accented characters. For example in the data we
I have some data grouped in a table by a certain criteria, and for
I have some data of the form Key ID Link 1 MASTER 123 2
I have some data. I want to go through that data and change cells
I have some data that I want to store somewhere in my Rails app

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.