+ Reply to Thread
Results 1 to 4 of 4

Thread: Logistic regression and predictions

  1. #1
    Points: 344, Level: 6
    Level completed: 88%, Points required for next Level: 6

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Logistic regression and predictions




    I'm looking to do logistic regression in R with a response variable 'diagnosis' which describes if a patient is of class 0 or class 1. I have 3 co-variates - age, gender and a matrix of 20 genes. I look to predict the response variable for each gene via the following code:

    for (gene in 1:20) {
    model = glm(diagnosis ~ age + gender + gene_matrix[,gene],family="binomial")
    }

    This works but I now want to plot a ROC curve based on all 20 genes rather than individual genes. Given that I have 20 output objects from my logistic regression, I'm unsure of how to do this?
    Last edited by Sheddie; 10-22-2013 at 11:25 AM.

  2. #2
    Devorador de queso
    Points: 95,540, 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,930
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Logistic regression and predictions

    Your code would only allow you to view the model for the 20th gene since you keep overwriting the model every iteration of the loop.

    It's not clear to me what you mean by making an ROC curve based on all 20 genes. If you can describe what you actually mean by that then maybe we can help.
    I don't have emotions and sometimes that makes me very sad.

  3. #3
    Omega Contributor
    Points: 38,289, Level: 100
    Level completed: 0%, Points required for next Level: 0
    hlsmith's Avatar
    Location
    Not Ames, IA
    Posts
    6,992
    Thanks
    397
    Thanked 1,185 Times in 1,146 Posts

    Re: Logistic regression and predictions

    You will definitely need to find a way to automate this process, in that there will be a tremendous number of combinations of variables to calculate all of the Sensitivities and Specificities. I am guessing your code is for R, which I am not familiar with in this content.
    Stop cowardice, ban guns!

  4. #4
    Points: 344, Level: 6
    Level completed: 88%, Points required for next Level: 6

    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Logistic regression and predictions


    Is there any way to save the model outputs for all 20 genes?

    So I could then stick then into this code to plot the ROC curve?

    predictions.vector = predict(log.regression.output.object,full.dataset,type="response")
    preds = prediction(predictions.vector,class.labels)
    perf = performance(preds,"tpr","fpr")
    plot(perf,main="ROC Curve",lwd=2,col="darkgreen")

    I'm looking to plot the curve for a 20-gene logistic regression classifier...so using those 20 genes to classify between the class 0 and class 1 patients which make up the dataset and plotting a ROC curve and computing AUC to see how effective they are at doing that

    I can plot individual ROC curves for each gene but I'd like to assess how effective all 20 genes are at classifying the data set

+ 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