1

I am getting the below error when i run the R code for glm():

```
> fmla = 'status_id~ratings'
> logisticmodel <- glm(fmla, data = playdata, family=binomial(link="logit"))
```

Could you please correct me where I have gone wrong, I googled a lot on it and the only answer is generally naming convention, however, this is not case for me since I tried with changing the data by placing all the values as 2's and it worked - so it is not a naming issue with variables.

Below is the data description:

```
> str(playdata)
'data.frame': 24160 obs. of 13 variables:
$ idd : int 57251659 63385939 51939145 64339389 33725679 47000250 62738883 33725679 53589441 36670488 ...
$ status_id : int 1 1 1 1 1 1 1 1 1 1 ...
$ id : int 22820543 22953283 22919397 22699949 22658030 22720403 22581860 22915483 22621108 22651736 ...
$ group_id : int 2 2 2 2 2 2 2 2 2 2 ...
$ created_date : POSIXct, format: "2017-03-31 12:45:10" "2017-04-04 10:50:11" "2017-04-03 16:40:04" "2017-03-28 14:40:48" ...
$ question_id : int 20073221 20219031 20185301 19948471 19906458 18651404 19816152 20175471 19865888 19897662 ...
$ surftoanswertime: int 533 484 98 476 388 0 741 757 2222 381 ...
$ skiprate : num 0.981 0.95 0.993 0.875 0.966 ...
$ ratings :integer64 0 0 1 2 0 0 1 1 ...
$ pos :integer64 0 0 1 2 0 0 1 0 ...
$ negratings :integer64 0 0 0 0 0 0 0 1 ...
$ cf : num NA NA 1 1 NA NA 1 0 NA 1 ...
$ cf1 : num -1 -1 1 1 -1 -1 1 0 -1 1 ...
```

Actual formula is as below - only the ratings and negratings are throwing the above error.

```
fmla = 'status_id~skiprate+ratings+negratings+surftoanswertime+cf1'
```

Could you please help me in understanding and correcting the error.

```
> logisticmodel <- glm(fmla, data = playdata, family=binomial(link="logit"))
Error in names(coef) <- xnames : names() applied to a non-vector
In addition: Warning messages:
1: In glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, :
non-finite coefficients at iteration 1
2: glm.fit: algorithm did not converge
```

If I use more columns I am getting the below error:

```
Error in `*tmp*`[fit$pivot] : object of type 'closure' is not subsettable
In addition: Warning messages:
1: In glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, :
non-finite coefficients at iteration 1
2: glm.fit: algorithm did not converge
```

Can you tell where this data is (if it is public data)? It seems I can't reproduce the result with another data. – Ankit Seth – 2018-02-21T09:49:30.047

this is not public data - cannot share it. strange part is that only these two columns are giving error. – surpavan – 2018-02-21T09:52:21.557

1There are two things you need to do (actually try). First, change the data-types from

`integer64`

to`integer`

. Second, try giving parameter`maxit = 30`

inglmfunction`logisticmodel <- glm(fmla, data = playdata, family=binomial(link="logit"), maxit = 30)`

. If this does not work, try 35, 40, 50 etc. The default value is 25, which in your case is not working. But don't go for too large values. It will simply mean that you algorithm will not converge. – Ankit Seth – 2018-02-21T13:20:26.163@AnkitSeth - thank you it worked. The issue is the interger type 64. once I converted it as as.integer() it got solved. Please submit it as answer and I will accept it. Thank you. – surpavan – 2018-02-22T05:47:54.603