-1

I'm trying to run a multivariate linear regression on a data set but the summary has one of my categorical variables appearing twice with different coefficient values.

Below is a snapshot of the dataset and the regression output.

''' data = read.csv("Data.csv") data1 = select(data, Generosity, MALE, ECON, FIRST, FIELD, EXP, ECON300, ECON400, EMPLOY, STUDLOAN, DEBT) head(data1)

reg1 = lm(Generosity~MALE + ECON + FIRST + FIELD + EXP + ECON300 + ECON400 + EMPLOY + STUDLOAN + DEBT, data = data1) summary(reg1)''' dataset previewenter image description here

FIELDSOCSCI appears twice?

user9170959
  • 35
  • 1
  • 5
  • code, including packages and versions? – Argalatyr May 29 '19 at 00:02
  • 5
    I would check the variable FIELD with `unique(dat$FIELD)` to see if there are two SOCSCI entries. Maybe one has an extra space at the end... – Nick May 29 '19 at 00:03
  • 1
    [Please provide](https://stackoverflow.com/questions/5555408/convert-the-values-in-a-column-into-row-names-in-an-existing-data-frame-in-r) data and code as plain text, not images, so users can easily copy/paste. – neilfws May 29 '19 at 00:05

1 Answers1

0

Check in your dataframe if there is a second spelling of SOCSCI and if so, decide for one and change the other by replacing it in your code. Acutally, lm(formula, data,...) should not result in two entries for the same variable.

Penelope
  • 3
  • 2