2
$\begingroup$

When I try to a linear regression model of my data and put in lm(DrinkDeath_1_1_~A1+A2+A3) I keep getting this: Error in model.frame.default(formula = DrinkDeath_1_1_ ~ A1, drop.unused.levels = TRUE) : invalid type (list) for variable 'DrinkDeath_1_1_' as an error message.

My linear model should be in this shape B = A1 * X1 + A2 * X2 + A3 * X3 and the names of the dataset are "Index" "A0" "A1" "A2" "A3" "A4" "B".

How can I make this linear regression?

$\endgroup$
1
  • $\begingroup$ The error is telling you that DrinkDeath_1_1 is not of the right type. It should be a single numeric vector. Try str(DrinkDeath_1_1) Perhaps DrinkDeath_1_1 = as.numeric(DrinkDeath_1_1) will help. $\endgroup$ Oct 12, 2019 at 12:52

0