dataframe - Error: Coefficients: (4 not defined because of singularities) in R -
i have error in code, couldn't figure out. have dataframe "a", with:
row.names gm variance stddev skewness correltomarket deratio 1 mmm 0.9785122 0.9998918 0.9999459 -1.049053 2.932738 0.07252799
now, need find linear model above dataframe following code
riskmodel <- lm(formula=((a$gm)~(a$variance)+(a$skewness)+ (a$correltomarket)+(a$deratio)),data=a)
when run code, following summary "riskmodel"
call: lm(formula = ((a$gm) ~ (a$variance) + (a$skewness) + (a$correlationtomarket) + (a$deratio)), data = a) residuals: 1 residuals 0: no residual degrees of freedom! coefficients: (4 not defined because of singularities) estimate std. error t value pr(>|t|) (intercept) 0.9785 na na na a$variance na na na na a$skewness na na na na a$correlationtomarket na na na na a$deratio na na na na residual standard error: nan on 0 degrees of freedom
i don't understand why , grateful helps me this. have no idea whats going wrong.
you have single observation in data.frame. can't fit model 5 parameters single observation. need @ least 6 observations able fit parameters , have estimate of variance.
Comments
Post a Comment