3
$\begingroup$

I am working on an exercise question, and I am a bit stuck unsure on how to proceed. I was given the data below and asked to graphically display the relationship between dose and kill rate.

enter image description here

Using R, I created a data frame to represent the values from the table with the following commands,

dose <- c("1", "2", "3", "4", "5", "6")
insecticide <- c("1", "2", "3")
data.df <- expand.grid(dose=dose, insecticides=insecticide)

kills <- c(3, 5, 19, 19, 24, 35,
           2, 14, 20, 27, 41, 40,
           28, 37, 46, 48, 48, 50)

total_beetles <- c(50, 49, 47, 38, 49, 50,
                   50, 49, 50, 50, 50, 50,
                   50, 50, 50, 50, 50, 50)

beetles.df <- as.data.frame(data.df) %>%
  mutate(kills = kills, beetles=total_beetles, 
         killrate=kills/beetles)

I then displayed the relationship between dose and kill rate graphically using a facet wrap to view the insecticides as well.

ggplot(data=beetles.df, mapping=aes(x=dose, y = killrate, 
       color=insecticides)) + geom_point() + 
       facet_wrap(vars(insecticides))

Now for this exercise question, I was asked to, plot the linear logistic fitted curve for each of the insecticides plus the combination, but I am not sure I can plot a logistic curve in this case since wouldn't my response variable have to be binary to apply a logistic curve. I am just a bit confused maybe on the wording of this question.

$\endgroup$
1
  • $\begingroup$ I don't see where you fit anything in this code. Did you omit part of it? $\endgroup$
    – whuber
    Commented Mar 19 at 18:31

1 Answer 1

1
$\begingroup$

but I am not sure I can plot a logistic curve in this case since wouldn't my response variable have to be binary to apply a logistic curve.

You have multiple observations at the same value of insecticide. So you get counts per total number of observations. Such counts are binomial distributed which is a sum of Bernoulli distributed variables. The count variable is actually under the hood a binary variable (a sum of several binary variables).

See also: In using the cbind() function in R for a logistic regression on a $2 \times 2$ table, what is the explicit functional form of the regression equation?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.