I am doing a factor analysis from ESS dataset. I have chosen 8 IVs and combined 3 countries to create a dataframe. (All NA values are substituted by median)
# "United Kingdom","Denmark","Poland" income #
attach(ESS.GB.DK.PL)
table(income1 <- hinctnta,useNA="ifany")
ESS.GB.DK.PL$income <- as.numeric(hinctnta)
ESS.GB.DK.PL$income [is.na(ESS.GB.DK.PL$income)] <- median(as.numeric(ESS.GB.DK.PL$income), na.rm=T)
But there is an error when i try to run the 7th variable (income): Error in solve.default(cv) : Lapack routine dgesv: system is exactly singular: U[8,8] = 0
# Duplicated the 8 variables to create a dataframe
ESS.GB.DK.PL[,582:589]<-ESS.GB.DK.PL[,574:581]
for (i in 582:589) { ESS.GB.DK.PL[,i]<- as.numeric(ESS.GB.DK.PL[,i]) }
# ~ Substitute missing values
for (i in 582:589) { ESS.GB.DK.PL[,i][is.na(ESS.GB.DK.PL[,i])]<-median(ESS.GB.DK.PL[,i],na.rm=T) }
# ~ Data Frame ******************
str(IV)
IV <- data.frame(ESS.GB.DK.PL[,582:589])
f1 <- factanal(ESS.GB.DK.PL[,582:589], factors = 2)
print(f1,digits=2,cutoff=0,sort=T)
There is no problem with the first 7 variables, i can do a factor analysis with [,582:588] , but failed with [,582:589]. so my question is how to solve the last variable - income.