[R] To create a Panel and run a Pooled OLS

Sophie Langenskiold langensk at fas.harvard.edu
Mon Apr 21 05:02:06 CEST 2003

I appreciate your help a lot. Unfortunately, none of your
recommendations work. I have written a small program to illustrate my
problems. I hope there is a solution...

Cross1 <- data.frame(i=c(1,2,3),Y=c(3,2,2),X1=c(2,3,4))
Cross2 <- data.frame(i=c(1,2,3),Y=c(2,3,1),X1=c(5,6,7))
Panel <- merge(Cross1,Cross2,by="i")
OLS <- lm(Panel$Y~Panel$X1)

Thanks again for your help,

-----Original Message-----
From: Spencer Graves [mailto:spencer.graves at PDF.COM] 
Sent: den 21 april 2003 04:51
To: langensk at fas.harvard.edu
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] To create a Panel and run a Pooled OLS

I just see a difference between what I wrote and what I use.  Have you 
tried the following:

	OLS <- lm(y~x1+x2, data=Panel)

spencer graves
If yes, could you replicate the error with a small data set that you
send with your help request?  It can make it easier for others to

Hope this helps. spencer graves

langensk at fas.harvard.edu wrote:
 > Dear all,
 > I have tried to merge two cross sections (crossA and crossB) as 
follows, both
 > crossA and crossB include the same variables, e.g., ID,y,x1,x2:
 > Panel <- merge(crossA,crossB,by="ID")
 > I have, thereafter, tried to run the following pooled OLS:
 > OLS <- lm(Panel$y~Panel$x1+Panel$x2)
 > and have received the following error message "Error in 
 > rownames, variables, varnames, extras, extranames,  : invalid 
variable type"
 > I would be very grateful for help. At the moment, I believe that I 
have tried
 > everything.
 > Thanks in advance,
 > Sophie
 > ______________________________________________
 > R-help at stat.math.ethz.ch mailing list
 > https://www.stat.math.ethz.ch/mailman/listinfo/r-help

More information about the R-help mailing list