0
Error: unexpected symbol in:
"body.glm <- glm(Bodyfat ~ Density + Age + Weight + Height + Neck + 
                 Chest + Abdomen + Hip + Thigh + Knee + Ankle + Biceps + Forearm + Wrist)set.seed (3)"

I am getting this when trying to get my GLM. I don't know if its an issue on how the code is written or if its the dataset.

when running str(bf)

'data.frame':   252 obs. of  15 variables:
 $ Density: num  1.07 1.09 1.04 1.08 1.03 ...
 $ Bodyfat: num  12.3 6.1 25.3 10.4 28.7 20.9 19.2 12.4 4.1 11.7 ...
 $ Age    : int  23 22 22 26 24 24 26 25 25 23 ...
 $ Weight : num  154 173 154 185 184 ...
 $ Height : num  67.8 72.2 66.2 72.2 71.2 ...
 $ Neck   : num  36.2 38.5 34 37.4 34.4 39 36.4 37.8 38.1 42.1 ...
 $ Chest  : num  93.1 93.6 95.8 101.8 97.3 ...
 $ Abdomen: num  85.2 83 87.9 86.4 100 94.4 90.7 88.5 82.5 88.6 ...
 $ Hip    : num  94.5 98.7 99.2 101.2 101.9 ...
 $ Thigh  : num  59 58.7 59.6 60.1 63.2 66 58.4 60 62.9 63.1 ...
 $ Knee   : num  37.3 37.3 38.9 37.3 42.2 42 38.3 39.4 38.3 41.7 ...
 $ Ankle  : num  21.9 23.4 24 22.8 24 25.6 22.9 23.2 23.8 25 ...
 $ Biceps : num  32 30.5 28.8 32.4 32.2 35.7 31.9 30.5 35.9 35.6 ...
 $ Forearm: num  27.4 28.9 25.2 29.4 27.7 30.6 27.8 29 31.1 30 ...
 $ Wrist  : num  17.1 18.2 16.6 18.2 17.7 18.8 17.7 18.8 18.2 19.2 ...

this is the data frame.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Is the set.seed part literally on the same line as the call to glm? – Dason Nov 03 '21 at 19:28
  • Yes, if not it throws out "Error in y - mu : non-numeric argument to binary operator " – Joaquin Gutierrez Nov 03 '21 at 20:30
  • What if you run `body.glm <- glm(Bodyfat ~ Density + Age + Weight + Height + Neck + Chest + Abdomen + Hip + Thigh + Knee + Ankle + Biceps + Forearm + Wrist, data = bf)` and keep the `set.seed()` line on a separate line? – Phil Nov 04 '21 at 01:54

0 Answers0