Reference Level Coefficients are not listing In R for Multiple Regression with Category Predictors using effective coding (sum-zero)

using the effective coding(simple coding) in R to calculate the Coefficients for the following dataset and lm formula

contrasts(dataframe$batch) <- contr.sum(levels(dataframe$batch))
model<- lm(response ~ time*batch, data=dataframe)
summary(model)

this is giving only 2 batch result and 3rd level is missing in the output. how to get the 3rd level coefficients like p-value and t-value. able to find the estimate for level3 negative sum of all other batches estimate.

batch time assay
1 0 100
1 1 101
1 2 102
1 3 101
1 6 103
1 9 105
1 12 103
2 0 102
2 1 99
2 2 98
2 3 98
2 6 97
2 9 98
2 12 97
3 0 100
3 1 97
3 2 97
3 3 96
3 6 98
3 9 97
3 12 96

Get rid of the intercept. You can't have a complete set of dummy variables and an intercept. It's called the dummy variable trap, nothing to do with R.

This is definitely not an issue with R, although I typically do not recommend simply throwing out the intercept unless you have some very good conceptual reason for believing that the intercept should be constrained to 0. What would be a good example of that? Something like:

Interest_Earned ~ b * Funds_Deposited

For this equation you can confidently state that interest earned will be 0 if the funds deposited in the account are also 0.

This has nothing to do with the usual issue of throwing out the intercept, which is indeed almost always a bad idea.

In the case in hand the three dummy variables effectively give a separate intercept for each factor.

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.