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.
> Hi! > > I'm trying to do a lm() test on three objects. My problem is that Rprotests> and says that the variable lengths differ for one of the objects > (Sweden.GDP.gap). But I have double checked that the number ofobservations You shall check it again. BTW How did you checked it?> 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 No, It has only 8. Why do you think it shall have 10?> confusing because there is no 10th observation!You are right, there is no 10th and also no 9th 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?Because your third variable has only 8 values. Regards Petr> > / 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 at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
Missing comma between -1.180620213 and -0.525964648 "Saint" <bahman.zadeh at comhem.se> wrote in message news:1335779012548-4597768.post at n4.nabble.com...> 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. >
Thanks a lot! One gets blind sometimes. -- View this message in context: http://r.789695.n4.nabble.com/Different-varable-lengths-tp4597768p4598762.html Sent from the R help mailing list archive at Nabble.com.
> length(Sweden.GDP.gap.adjust)[1] 8> Sweden.GDP.gap.adjust[1] 0.673792123 1.196706756 1.196131539 0.646944002 -0.312886525 [6] -1.706584861 -0.369401194 -0.003280389 R is reading Sweden.GDP.gapp.adjust as having 8 elements. Why I don't know. John Kane Kingston ON Canada> -----Original Message----- > From: bahman.zadeh at comhem.se > Sent: Mon, 30 Apr 2012 02:43:32 -0700 (PDT) > To: r-help at r-project.org > Subject: [R] Different varable lengths > > 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 at 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.____________________________________________________________ TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if5 Capture screenshots, upload images, edit and send them to your friends through IMs, post on Twitter?, Facebook?, MySpace?, LinkedIn? ? FAST!
> -----Original Message----- > From: sarah.goslee at gmail.com > Sent: Mon, 30 Apr 2012 17:06:19 -0400 > To: jrkrideau at inbox.com > Subject: Re: [R] Different varable lengths > > Because of the missing comma.I knew I needed new glasses !> > On Mon, Apr 30, 2012 at 4:56 PM, John Kane <jrkrideau at inbox.com> wrote: >>> length(Sweden.GDP.gap.adjust) >> [1] 8 >>> Sweden.GDP.gap.adjust >> [1] ?0.673792123 ?1.196706756 ?1.196131539 ?0.646944002 -0.312886525 >> [6] -1.706584861 -0.369401194 -0.003280389 >> >> R is reading Sweden.GDP.gapp.adjust as having 8 elements. ?Why I don't >> know. >> John Kane >> Kingston ON Canada >> >> >>> -----Original Message----- >>> From: bahman.zadeh at comhem.se >>> Sent: Mon, 30 Apr 2012 02:43:32 -0700 (PDT) >>> To: r-help at r-project.org >>> Subject: [R] Different varable lengths >>> >>> 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 >>> >>> > > > -- > Sarah Goslee > http://www.functionaldiversity.org____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!