Question: Probit Regression modelling in R
0
gravatar for krushnach80
11 months ago by
krushnach80470
krushnach80470 wrote:

I have already made a post in stack, wont; make a duplicate here, so Im giving the link here probit modelling question

I would be really glad if I get input about it since im not sure if im doing it correctly or not ..

so df is my original data frame so ,im making d2 to change my sample into factors
  
  conc<- c(6 , 5, 4,3,2,1,0,-1,-2)
    IMRS <- c(1,1,0.23,1,1,0.8,0.4,0.5,0.0)
    S18S <- c(1,1,.69,1,1,0.33,0.4,0.0,0.0)
     df <- data.frame(conc,IMRS,S18S)

head(df)
  conc IMRS S18S
1    6 1.00 1.00
2    5 1.00 1.00
3    4 0.23 0.69
4    3 1.00 1.00
5    2 1.00 1.00
6    1 0.80 0.33



     library(tidyr)
     d2=gather(df,SAMPLE,y,IMRS,S18S,factor_key=T)
    head(d2)

conc SAMPLE    y
1    6   IMRS 1.00
2    5   IMRS 1.00
3    4   IMRS 0.23
4    3   IMRS 1.00
5    2   IMRS 1.00
6    1   IMRS 0.80

    glm.out=glm(SAMPLE~conc+y,d2,family = binomial(link = "probit"))
    summary(glm.out) 


     library(ggplot2)
     lr_data <- data.frame(predictor=glm.out$linear.predictors,
                           prob=glm.out$fitted.values, SAMPLE=d2$SAMPLE)


     ggplot(lr_data, aes(x=predictor, y=prob, color=SAMPLE)) + geom_point(size=10)+
       geom_line(linetype = "dashed",lwd = 0.5)+geom_hline(yintercept = 0.65)

Build a model that predicts the level of your dependent variable (x) based on concentration (y)

So am i doing it in opposite manner ? or it wont matter .let me know

"Predict values from the model using predict()"

Can you plug that into my code how do i use or do that? because I been through the tutorials im not sure/cofident about using the

predict()
R • 417 views
ADD COMMENTlink modified 11 months ago • written 11 months ago by krushnach80470
1

Hi Krushnach, there is not enough information provided - perhaps not even you is sure of the experiment? It is also confusing (looking at the post on StackExchange) because you produce an object called df and then one called d2. From where did you obtain the figure that you posted?

The standard procedure would be:

  1. Build a model that predicts the level of your dependent variable (x) based on concentration (y)
  2. Predict values from the model using predict()
  3. Plot the original values and also the predicted values to see how they fit (visually)
ADD REPLYlink written 11 months ago by Kevin Blighe39k

updated my question with code..the figure i got from a paper where they did this probit analysis

ADD REPLYlink written 11 months ago by krushnach80470

Okay, can you share the paper? I am interested to see it

ADD REPLYlink written 11 months ago by Kevin Blighe39k

hi kevin I don;t have acess to that figure i followed your procedure and I get something similar to that

 curve(plogis( 0.1792 + 0.8259*x), min(df$A), 
      max(df$A), add=TRUE, lwd=2, lty=3)

Since i took the example from stack I wanted to ask what is the equivalent of this plogis for probit ?


ADD REPLYlink written 11 months ago by krushnach80470
1

Whoever up-voted @Kevin's comment above should consider the following.

Upvoting posts/comments is meant to be used in cases where the content of the post/comment contributes to solving original question/adds useful information. Upvoting "can you share the paper?" above does not help anyone and is a misuse of the voting system.

ADD REPLYlink modified 11 months ago • written 11 months ago by genomax63k

okay im sorry i hit it, my apology now i reversed it

ADD REPLYlink written 11 months ago by krushnach80470
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2494 users visited in the last hour