Sorry if you cannot understand my question in advance, because English is not my first language. I'm currently working with time series datas(total 37 years) in R. When I tried ndiffs(), I found out that I have to do different integration for 5 variables(murderts, popdiff1, unem, policediff1, gdpdiff2). The code was this:
mod3 <- tslm(murderts ~ popdiff1 + unem + policediff1 + gdpdiff2)
I want to try a linear regression with these 5 variables. But the numbers of datas are different, so this warning message keeps popping out.
'Error in model.frame.default(formula = formula, data = data, na.action = na.exclude, : variable lengths differ (found for 'popdiff1')'
I think it's because of the different number of NAs in variables. I tried remove NAs, but it didn't work. And I know this is wrong, but I put 0 in NAs but the outcome does not have any statistical significance.
How can I make a linear regression equation with this? (with tslm() or lm())
Comments
Post a Comment