Hi! I'm trying to do a lm() test on three objects. My problem is that R protests and says that the variable lengths differ for one of the objects (Sweden.GDP.gap). But I have double checked that the number of observations are the same. All three objects should contain 9 observations but R only accepts 9 observations in two of the objects. The third must have 10! Very confusing because there is no 10th observation!
# Adjusted Real rate - P > Sweden.p.adjust <- c(4.70243, 1.3776655, 1.117755, 1.6695175, 1.59282, > 1.1017625, -0.04295, 2.2552875, 0.0552875) > > # Adjusted Inflation deviation > Sweden.infl.dev.adjust <- c(0.110382497, -0.261612509, 0.040847515, > -0.195062497, -0.234362485, -0.023408728, 0.206421261, -0.079401261, > 0.071828752) > > # Adjusted GDP-gap > Sweden.GDP.gap.adjust <- c(0.673792123, 1.196706756, 1.196131539, > 0.646944002, -0.312886525, -1.180620213 -0.525964648, -0.369401194, > -0.003280389) > > # OLS regression using ADJUSTED data.# > Sweden.Taylor.real.adjust <- lm(Sweden.p.adjust ~ Sweden.infl.dev.adjust + > Sweden.GDP.gap.adjust) Error in model.frame.default(formula = Sweden.p.adjust ~ Sweden.infl.dev.adjust + : variable lengths differ (found for 'Sweden.GDP.gap.adjust') Why is this happening? / Saint -- View this message in context: http://r.789695.n4.nabble.com/Different-varable-lengths-tp4597768.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.