Dataframe 为什么lm为每个自变量生成NA?
我尝试使用lm函数进行线性回归,但每个自变量的输出都是NA。数据帧是数字的 我已经尝试过改变自变量,只使用一个因变量,但结果是一样的Dataframe 为什么lm为每个自变量生成NA?,dataframe,linear-regression,numeric,na,lm,Dataframe,Linear Regression,Numeric,Na,Lm,我尝试使用lm函数进行线性回归,但每个自变量的输出都是NA。数据帧是数字的 我已经尝试过改变自变量,只使用一个因变量,但结果是一样的 # Read csv file gh_old_shorty <- read.csv(file.choose(), header=T, sep=";") # make dataframe numeric as.data.frame(lapply(gh_old_shorty, as.numeric)) # create linear regression m
# Read csv file
gh_old_shorty <- read.csv(file.choose(), header=T, sep=";")
# make dataframe numeric
as.data.frame(lapply(gh_old_shorty, as.numeric))
# create linear regression
model1 <- lm(Year ~ Age + OfficeOfPresidency + MembersOfParliament +
Assembly + GovernmentOfficials + LocalGovernmentOfficials + JudgesAndMagistrates + FightingCorruption, data=gh_old_shorty, na.action = na.omit)
summary(model1)
Call:
lm(formula = Year ~ Age + OfficeOfPresidency + MembersOfParliament +
Assembly + GovernmentOfficials + LocalGovernmentOfficials +
JudgesAndMagistrates + FightingCorruption, data = gh_old_shorty,
na.action = na.omit)
Residuals:
ALL 1 residuals are 0: no residual degrees of freedom!
Coefficients: (8 not defined because of singularities)
Estimate Std. Error t value
(Intercept) 2007 NA NA
Age NA NA NA
OfficeOfPresidency NA NA NA
MembersOfParliament NA NA NA
Assembly NA NA NA
GovernmentOfficials NA NA NA
LocalGovernmentOfficials NA NA NA
JudgesAndMagistrates NA NA NA
FightingCorruption NA NA NA
Pr(>|t|)
(Intercept) NA
Age NA
OfficeOfPresidency NA
MembersOfParliament NA
Assembly NA
GovernmentOfficials NA
LocalGovernmentOfficials NA
JudgesAndMagistrates NA
FightingCorruption NA
Residual standard error: NaN on 0 degrees of freedom