+ Reply to Thread
Results 1 to 2 of 2

Thread: Data frame of results

  1. #1
    Points: 1,145, Level: 18
    Level completed: 45%, Points required for next Level: 55

    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data frame of results




    Hi all

    Suppose I have 10 different models as such:

    Code: 
    fit1.glm <- glm(admit ~ gre , data = dat, family = "binomial")
    fit2.glm <- glm(admit ~ gpa, data = dat, family = "binomial")
    fit3.glm <- glm(admit ~ rank, data = dat, family = "binomial")
    ...
    Suppose then, I want to form a data frame as such:

    variable Odds ratio lower CI upper CI
    gre
    gpa
    rank
    ...
    How could this be done? Ciao!!

  2. #2
    Devorador de queso
    Points: 97,539, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent PosterActivity Award
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,987
    Thanks
    309
    Thanked 2,639 Times in 2,254 Posts

    Re: Data frame of results


    It would probably be cleaner if you you originally did something like
    Code: 
    fit <- list()
    fit[[1]] <- glm(admit ~ gre , data = dat, family = "binomial")
    fit[[2]] <- glm(admit ~ gpa, data = dat, family = "binomial")
    fit[[3]] <- glm(admit ~ rank, data = dat, family = "binomial")
    ...
    And even that could be cleaned up. But if you store directly into a list you can use functions like lapply to easily apply the same function to each element which saves a lot of typing later on.
    I don't have emotions and sometimes that makes me very sad.

+ Reply to Thread

           




Tags for this 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