Home > database >  Error while trying to create a qqPlot of a linear model
Error while trying to create a qqPlot of a linear model

Time:07-19

I am having some issues while creating a qqPlot for my linear model. All my other "tests" are working just fine.

To start, here are the packages that I am using:

library(astsa)
library(TSA)
library(RcmdrMisc)
library(forecast)
library(readxl)

Here is my data:

> data
     Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2018  42  31  34  44  34  58  29  57  33  60  43  24
2019  30  22  27  37  29  69  39  36  52  55  51  20
2020   2

Which I created using:

ts(data = data, start = c(2018,1), frequency = 12)

I successfully created a model using the following:

seasonalMeansModel <- tslm(data ~ trend   season-1)

Now when I want to create a Q-Q Plot, I use the following:

qqPlot(seasonalMeansModel)

And I get this error:

> qqPlot(seasonalMeansModel)
Error in lm(formula, data = data, na.action = na.exclude, ...) : 
  formal argument "na.action" matched by multiple actual arguments

I tried changing the argument for "na.action" when creating the lm, but no luck.

Appreciate any help!

CodePudding user response:

Try this:

MeansModel <- ts(seasonalMeansModel$coefficients)
qqnorm(MeansModel)
  • Related