Search code examples
rglmspeedglm

Speeglm $ operator is invalid for atomic vectors


I am trying to execute the following code of a binary logit:

mylogit <- speedglm(dependent_variable ~ InterestRate, data = my_data, family = "binomial")

But I get the following error:

> mylogit <- speedglm(dependent_variable ~ InterestRate, data = my_data, family = "binomial")
Error: $ operator is invalid for atomic vectors

Here are the heads of the variables:

> head(my_data$dependent_variable)
[1] 0 1 1 1 1 1
> head(my_data$InterestRate)
[1] "0.165500" "0.165500" "0.165500" "0.165500" "0.165500" "0.165500"

Any ideas how to fix this?

EDIT:

Changing

family = "binomial"

to

family=binomial('logit')

seems to make it work


Solution

  • EDIT:

    Changing

    family = "binomial"
    

    to

    family=binomial('logit')
    

    seems to make it work