Understanding intercept in simple linear regression and why one variable is a predictor and the other is an outcome variable I'm a new statistics student :) I have some questions about linear regression, i'm using R to do some tests.
I have two simple lists, like:
> a <- c(1,2,3,4)
> b <- c(5,6,7,8)

then I do
> model <- lm(a ~ b)

the result (coefficient) is:
> coef(model)
(Intercept)           b 
         -4           1 

the "relationship" is perfect (1). 
But i didn't understand the intercept value, why is it -4?
Then if i change my R test with:
> b <- c(5,6,7,80)
> a <- c(1,2,3,40)
> model <- lm(a ~ b)
> coef(model)
(Intercept)           b 
 -1.0868825   0.5137503 
> model <- lm(b ~ a)
> coef(model)
(Intercept)           a 
   2.125346    1.945622 

obviously lm(a ~ b) != lm(b ~ a)
But, what are there criteria for selecting which list to put in the first place?
 A: For your first question:
If the output of a regression isn't making sense to me (and even if it is), I always look at the plot of the regression line. In your case, this can be accomplished with this code:
a <- c(1,2,3,4)
b <- c(5,6,7,8)
mod <- lm(a ~ b)
plot(a ~ b, xlim = c(-1,9), ylim = c(-5,5))
abline(mod, lwd = 3)
abline(v = 0, col = 'blue', lwd = 3, lty = 3)
abline(h = 0, col = 'blue', lwd = 3, lty = 3)

This produces the following graph.

The blue lines are the axes, the circles are the original data, and the black line is the regression line. It seems reasonable that the intercept would be at -4. If this isn't convincing enough, try working through the math by hand.
For your second question:
When you've got two sets of meaningless numbers it is hard to decide which should be the independent variable and which should be the dependent variable. In most cases (in fact, probably all cases) there will be some meaning attached to these numbers. In addition, you will have a question that you'd like to answer, such as: What is the effect of hot dog size on the amount of time it takes to finish the hot dog?. I know, it's a silly example, but it gets the point across. You have two variables: $X$ - hot dog size, $Y$ - time to eat the hot dog. Based on the question you'd like to answer, it only makes sense to regress $Y$ on $X$, and not the other way.
A: I would just add to Max's answer that generally speaking, the intercept is the predicted value of your dependant variable (left term of the equation) when the independent variable (right term) equals zero. If you were to include several independent variables, the same goes: the intercept is the value of the independent variable when all those variables are equal to zero. Depending on the context, that value can have practical meaning or not (sometimes, the zero value on the independent variable is not plausible).
Just a warning: when you say "the relationship is perfect (1)" keep in mind that having 1 as the coefficient does not say anything about the "quality" or "perfectness" of the relationship. Rather, you find this information in the standard error (from which the t and p values are calculated), which in this case is 1.602e-17 (I think the only reason why it's not exactly zero is that at some point in the calculations, there has been some binary rounding, so that this value is nothing more than a rounding error). Try changing one of the numbers on either variable, and you'll see the impact on both the coefficient estimate and the standard error.
