+ Reply to Thread
Results 1 to 9 of 9

Thread: Help creating my first logistic Regression model

  1. #1
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help creating my first logistic Regression model




    Hi everyone,

    I`m new here, and new in the stats world, and i have several questions and need for help on how to proceed.

    First, what i`m doing is try to predict an outcome, wich is named Phase in the picture here http://imgur.com/E9MGJQv

    What i`m doing is the follow:

    1- for every column i`m changing the variables to a scale (EX: 1, 2, 3 etc) with no particular ranking. Question, should this matter i mean, which variable i use as a 1, and which i use as a 6, for example.

    2- Im using R to create a model, but how do i know my model is good?

    3- Is there any advice on how to proceed? how do i perfect my data so i can have a better model?


    Thank you!

  2. #2
    Devorador de queso
    Points: 95,922, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,937
    Thanks
    307
    Thanked 2,630 Times in 2,246 Posts

    Re: Help creating my first logistic Regression model

    If you're using R then "changing variables to a scale" when there is no particular ranking is useless and potentially harmful. Just keep it as is. If you instead turn the variable into a factor (in R) then it will do the necessary stuff for you.
    I don't have emotions and sometimes that makes me very sad.

  3. #3
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help creating my first logistic Regression model

    Dason,

    When i use str command to chech the file i just loaded it shows me all my columns, except the one i`m trying to predict are Factors.

    but when i use glm function it returns me the error:
    Warning message:
    glm.fit: fitted probabilities numerically 0 or 1 occurred

    and the summary is all wrong.
    What should i do here?

    Even if I change Phase to factor, it still returns me the warning message

    But i don t think the warning message is the problem, the problem is when i run a summary from my regression it returns each of my variables a scale, and not each of my columns

    Something like this:
    Product.Fit.Level2. Low Fit 1.000
    Product.Fit.Level3. Regular Fit 1.000
    Product.Fit.Level4. High Fit 1.000
    Product.Fit.Level5. Very High Fit 1.000
    Product.Fit.LevelNo Info / doesn’t Know 1.000
    Product.Fit.LevelNo Info / Old Account 1.000
    Last edited by Perdido; 07-06-2015 at 11:56 AM. Reason: Aditional data

  4. #4
    Omega Contributor
    Points: 38,410, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,003
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Help creating my first logistic Regression model

    We see from your link that Phase is 0 or 1, binary, and is your dependent variable correct?


    Which of the other variables are you adding to your model as independent variables?
    Stop cowardice, ban guns!

  5. #5
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help creating my first logistic Regression model

    hlsmith,

    Yes, Phase is binary and my dependent variable.

    All the others, numbers and texts, are the ones i`m going to use as independent variables.

    What would be the ideial way to proceed now?

  6. #6
    Omega Contributor
    Points: 38,410, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,003
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Help creating my first logistic Regression model

    Not overly familiar with R, but traditionally text fields can cause problems for software users. I may convert long test strings into categorical groups if possible (e.g., 1, 2, 3, 4,..,n). Other wise a program may treat each word/letter combination as its own unique category.
    Stop cowardice, ban guns!

  7. #7
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Help creating my first logistic Regression model

    Good, but one thing i don`t understand is, if i change them to a number do the software interprets a variable, for example the number 4, as being better, or more, than a variable 1? or it doesnt matter since it is no assigning of weight to individuals variables to for their groups only ( i meant the columns)

  8. #8
    Fortran must die
    Points: 58,790, Level: 100
    Level completed: 0%, Points required for next Level: 0
    noetsi's Avatar
    Posts
    6,532
    Thanks
    692
    Thanked 915 Times in 874 Posts

    Re: Help creating my first logistic Regression model

    I don't know R in SAS you tell the software if the variable is categorical variable (in which case no level is higher than another and normally you are comparing a level to a reference level) or an interval variable in which case it is going to assume numbers are ordered. I am sure R has a similar system.

    There is a lot to be said analytically to converting nominal independent variables into a series of dummy variables. When you have 7 unordered levels what is it really telling you to move from level 1 to 2 and 2 to 3? Even if they are ordered like likert data what that is telling you is subject to dispute (it depends on how you interpret the differences between each level substantively).

    If you are new to statistics starting with logistic regression was brave My advice is to entirely ignore slopes and focus on the Odds Ratios.
    "Very few theories have been abandoned because they were found to be invalid on the basis of empirical evidence...." Spanos, 1995

  9. #9
    Omega Contributor
    Points: 38,410, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    7,003
    Thanks
    398
    Thanked 1,186 Times in 1,147 Posts

    Re: Help creating my first logistic Regression model


    You could also label them A, B, C, D,..,n. My recommendation was to just get away from those long strings, that you probably don't want to type into your code all of the time if running anything else.
    Stop cowardice, ban guns!

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats