How to run a restricted regression model? How can someone run a restricetd Ols or Gmm model in R, that is a zero intercept? Which is the command?
 A: You can use explicit 0 in formula you put into lm or glm function, like lm(y~0+x).
Example:
Generate some data:
y<-1:10
x<-rnorm(1:10)

Model with intercept:
summary(lm(y~x))

Call:
lm(formula = y ~ x)

Residuals:
    Min      1Q  Median      3Q     Max 
-5.2276 -1.1452 -0.2357  1.5542  3.9866 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)    6.085      1.117   5.447 0.000611 ***
x              1.412      1.395   1.012 0.341090    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 3.024 on 8 degrees of freedom
Multiple R-squared:  0.1135,    Adjusted R-squared:  0.002712 
F-statistic: 1.024 on 1 and 8 DF,  p-value: 0.3411

Model without intercept:
summary(lm(y~0+x))

Call:
lm(formula = y ~ 0 + x)

Residuals:
   Min     1Q Median     3Q    Max 
-3.184  2.114  4.917  6.828  9.873 

Coefficients:
  Estimate Std. Error t value Pr(>|t|)
x   -2.518      2.444  -1.031     0.33

Residual standard error: 6.186 on 9 degrees of freedom
Multiple R-squared:  0.1056,    Adjusted R-squared:  0.00618 
F-statistic: 1.062 on 1 and 9 DF,  p-value: 0.3296

