[R] restricted coefficient and factor in linear regression.

From: Oh Dong-hyun <oh.dongh_at_gmail.com>
Date: Sat, 14 Jun 2008 14:49:44 +0200


Hi,

my data set is data.frame(id, yr, y, l, e, k).

I would like to estimate Lee and Schmidts (1993, OUP) model in R.

My colleague wrote SAS code as follows:
** procedures for creating dummy variables are omitted **

My R code is as follows:
##############
library(plm)
dt <- read.table("dt.dta", sep = "\t", header= T)

dt$id <- factor(dt$id)
dt$yr <- factor(dt$yr)
fit.model <- I(log(y)) ~ I(log(l)) + I(log(e)) + yr * id
re.fit.gls <- pggls(fit.model, data = dt)
#################

I've got the following error message:
##### Error message ###############
Error in dimnames(x) <- dn :
  length of 'dimnames' [2] not equal to array extent #### End of Error message############

I would like to figure out three things. 1. How can I restrict coefficient in model? As you can see in SAS code, coefficient of dt1 is restricted to 1. 2. If it is possible to restrict coefficients, it is possible to restrict coefficients of factors? If so, how?

Thanks in advance.

Best,



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 Jun 2008 - 23:23:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 15 Jun 2008 - 19:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive