Hi, r-users
I got a problem when I try to call a *gls* function in loop structure.
The gls function seems not able to recognize the parameters that I pass
into the loop function!
(But, if I use lm function, it works.)
The code looks like this:
=================================================
gls.lm <- function(Data, iv1, dv1)
{
gls.model <- gls(Data[ , dv1] ~ Data[ , iv1], correlation = corARMA(p=1),
method='ML',na.action=na.omit, data = Data)
print(summary(gls.model))
}
regResultMatrix <- gls.lm(DR, 'Period', 'Aircraft')
regResultMatrix <- gls.lm(DR, 'Period', 'Total.Employees')
==================================================
The "DR" is the data in excel file which includes three columns: Period,
Aircraft and Total.Employees.
And, I got the error message like this:
*Error in eval(expr, envir, enclos) : object 'dv1' not found*
Could any one tell me what is going on there?
Thanks in advance.
Miles
--
ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼
Miles Yang
Mobileï¼+61-411-985-538
E-mailï¼[email protected]
ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.