Hi

did you look at help page of lme?


r-help-boun...@r-project.org napsal dne 25.10.2010 22:59:40:

> 
> 
> Hi,
> 
> I am trying to run a panel regression where I have a matrix of 
observations
> and a matrix of independant variables - examples would trying to predict
> countries's GDP with their data on education, FDI, tax rates, over time.
> 
> For the purpose of simplicity, my data would be:
> 
> dep = matrix(rnorm(50),ncol=5) 
> indep1 = matrix(rnorm(50),ncol=5)
> indep2 = matrix(rnorm(50),ncol=5)
> 
> >From what I could find, the lme{nlme} function would be the function.
> However, after I installed the package and I type in:
> 
> > lme(dep~indep1, indep2)
> Error in model.frame.default(formula = ~indep1 + dep, data =
> c(-0.63665929869261,  : 
>   'data' must be a data.frame, not a matrix or an array 
> 
> I keep getting error messages even after I transform the data in a data
> frame. Any idea on how I could get R to perform a simple panel 
regression?

How did you transform your data to data frame? The input object shall be 
data frame with one column of dependent values and one or more columns of 
independent variables and one column of categorical variable for 
discrimination.

See
> head(Orthodont)
Grouped Data: distance ~ age | Subject
  distance age Subject  Sex
1     26.0   8     M01 Male
2     25.0  10     M01 Male
3     29.0  12     M01 Male
4     31.0  14     M01 Male
5     21.5   8     M02 Male
6     22.5  10     M02 Male

In lme call you need to give a formula which will be evaluated based on 
the data frame.

something like

lme(GDP~education+FDI+tax+time|Country, my.data.frame, ...)

Regards
Petr

 

> 
> 
> Thanks!
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/Panel-regression-
> tp3012794p3012794.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help@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.

______________________________________________
R-help@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.

Reply via email to