How to fit a Linear Regression model with linearly related predictor variables I have three predictor variables x,y and z and a outcome variable "grade". The three predictor variable are linearly related (x+y+z=1). When I fit a linear regression model using these variables, I get NA as the coefficient of one of the predictors.
How do I interpret the results shown below? Or is there any other way of handing such data?

lm(grade~x+y+z, df)
  Call:
  lm(formula = grade ~ x + y + z, data = df)
  Coefficients:
  (Intercept)            x            y            z
      0.6635      -0.6283       0.7285           NA 

 A: If x, y and z are predicted class probabilities as you've stated in the comments, then it might be a lot easier to simply include dummy variables for the predicted class. In that case, there is the effect of being predicted to be x, y, or neither (which means you're predicted to be z). The last (or first) class will then simply be the intercept and you can easily compare all three.
Apart from the problem of colinearity, I can't imagine there being a linear relationship between the grade someone scores and the probability of belonging to a class. How would you even interpret this? Should you consider the difference between $0.99$ and $0.95$ to be the same as the difference between $0.54$ and $0.50$? Because that is what a linear relationship implies. Moreover, not only the probabilities are probably skewed and certainly bounded, but so are the grades.
If you insist on using class probability, you should remove one of the three classes' probabilities, as it is already implicitly in the model by including the other two classes' probabilities. Saying that you cannot look at all three at the same time is a misunderstanding.
A: You shouldn't be using linearly dependent predictors (x+y+z=1) in your model, this issue is known as Multicollinearity.
What you need to do is to drop all the linear dependent columns and refit your model, e.g. using x & y only lm(grade~x+y, df), assuming that x & y are linearly independent.
The mathematical reason behind is that in Linear Regression, it tries to compute the psuedoinverse $(X^TX)^{-1}$ of your input data $X = \begin{pmatrix}
1 & x_{1} & y_{1} & z_{1}\\
\vdots &  \vdots  & \vdots & \vdots\\
1 & x_{n} & y_{n} & z_{n}
 \end{pmatrix} $ , but since the columns are linearly dependent,the matrix is not full rank and thus cannot be inverted. Once you removed the linear dependent column(s), the matrix will become full rank and can be inverted and solved.
A: It may not look like it at first glance, but this question is a sort of duplicate of another question the original poster asked. abhinava stated in comments here that he fit a latent class analysis (LCA). In LCA, you are trying to infer each observation's value of an unseen (i.e. latent) un-ordered categorical variable $K$. It's actually a bit more complex: what you actually get is the probability that each observation falls into each latent class. Thus, abhinava is trying to determine $\overline{grade} | K$.
Imagine you had actually observed the true value of $K$. Then this would be trivial. You'd just treat $K$ as a categorical variable in the regression.
However, again, we haven't got the true value of $K$. We inferred it, and we estimated the probability that each person has $K = 1, K = 2, K = 3...$ In my link, you'll see a brief description of latent class regression, which I believe is how you'd handle this situation.
A less technically correct way to handle it, which I neglected to mention in my other answer, is for abhinava to assign each observation to their modal class, i.e. the latent class they are most likely to belong to. This is wrong, because it ignores the uncertainty in the latent class. Also, what if your LCA model can't be very certain about each person's latent class, e.g. a lot of people have $P(K_i) = 0.4, 0.3, 0.3$? However, if the LCA model does separate people very well, e.g. most people look more like $P(K_i) = 0.9, 0.05, 0.05$, then modal class assignment isn't too far wrong. One can calculate Shannon's entropy after fitting an LCA model. I'm not sure if depmixS4, the package the OP used, does so, but many do, or this can be calculated manually. High values of entropy (one guideline I heard suggested 0.8 or higher; entropy in the LCA context is usually normalized to a 0 to 1 scale) mean modal class assignment shouldn't be too bad.
