Question: When I try to run the dot function with the residuals and regressor, I get an error that Conj(x) * y : non-conformable arrays. I
When I try to run the dot function with the residuals and regressor, I get an error that "Conj(x) * y : non-conformable arrays." I think its because during the regression (lm), couple of the rows are dropped due to empty data sets. How do I create a vector containing data used in the regression from each respective regressor, so I can perform the dot function?
Here is the relevant code
RegressP3 <- lm(earn~grade+ages+ageq,data=datatest) RegressP3 summary(RegressP3) #returns the R squared value anova(RegressP3) # TSS = RSS + ESS jtools :: summ (RegressP3) sum (RegressP3$residuals) yhat<-fitted (RegressP3)
dot(as.vector(RegressP3$residuals), as.vector(datatest$grade)) dot(as.vector(RegressP3$residuals), as.vector(datatest$ages)) dot(as.vector(RegressP3$residuals), as.vector(datatest$ageq))
ERROR: Error in Conj(x) * y : non-conformable arrays
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
