gvlma: Create a Gvlma Object

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Top-level function for Global Validation of Linear Models Assumptions.

Usage

1
2
3
gvlma(x, data, alphalevel = 0.05, timeseq, ...)
gvlma.form(formula, data, alphalevel = 0.05, timeseq = 1:nrow(data), ...)
gvlma.lm(lmobj, alphalevel = 0.05, timeseq)

Arguments

x

Either a formula, in which case gvlma.form will be called, or a linear models object, in which case gvlma.lm will be invoked.

formula

A linear models formula interpretable within the dataframe data. Should have a single reponse variable.

lmobj

An object resulting from a call to lm.

data

Required if x is a formula, ignored if x is an lm object. A dataframe in which the variables in the formula x can be interpreted.

alphalevel

Level of significance at which to perform the global and directional tests for linear models assumptions.

timeseq

A vector of length the number of observations in the linear model that gives a "time ordering" for the observations. This time sequence is used in the heteroscedasticity test statistic. Defaults to 1:n where n is the number of observations in the linear model.

...

Additional arguments such as subset that are passed on to the call to lm when x is a formula. Note that weights, while being passed on to the call to lm, will not be used in any special way in the gvlma computations.

Details

gvlma is the top-level function to create a gvlma object for assessment of linear models assumptions.

Value

A gvlma object is returned. This is a list of class “gvlma” that contains all of the components returned by the call to lm for fitting the linear model, plus an additional component entitled “GlobalTest.” This new GlobalTest component is a list with the following components:

LevelOfSignificance

The level of significance at which the decisions reported for the global and directional tests were made.

GlobalStat4

A list consisting of the components Value, pvalue and Decision containing the global test statistic value, associated p-value, and text phrase reporting the decision concerning appropriateness of the linear model assumptions.

DirectionalStat1

A list consisting of the Value, pvalue and Decision associated with the skewness directional test statistic.

DirectionalStat2

A list consisting of the Value, pvalue and Decision associated with the kurtosis directional test statistic.

DirectionalStat3

A list consisting of the Value, pvalue and Decision associated with the link function directional test statistic.

DirectionalStat4

A list consisting of the Value, pvalue and Decision associated with the heteroscedasticity directional test statistic.

timeseq

The ordering of the observations used when computing the heteroscedasticity directional statistic.

call

The call used to invoke gvlma.

Author(s)

Slate, EH slate@stat.fsu.edu and Pena, EA pena@stat.sc.edu.

References

Pena, EA and Slate, EH (2006). “Global validation of linear model assumptions,” J.\ Amer.\ Statist.\ Assoc., 101(473):341-354.

See Also

plot.gvlma, deletion.gvlma, update.gvlma, lm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(CarMileageData)
CarModelAssess <- gvlma(NumGallons ~ MilesLastFill + NumDaysBetw,
                        data = CarMileageData)
CarModelAssess
summary(CarModelAssess)
CarModel2 <- gvlma(lm(NumGallons ~ MilesLastFill + NumDaysBetw,
                      data = CarMileageData))
CarModel2
summary(CarModel2)
plot(CarModel2)

Example output

Call:
lm(formula = NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData)

Coefficients:
  (Intercept)  MilesLastFill    NumDaysBetw  
      5.48051        0.01867        0.08220  


ASSESSMENT OF THE LINEAR MODEL ASSUMPTIONS
USING THE GLOBAL TEST ON 4 DEGREES-OF-FREEDOM:
Level of Significance =  0.05 

Call:
 gvlma(x = NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData) 

                      Value   p-value                   Decision
Global Stat        24.25918 7.087e-05 Assumptions NOT satisfied!
Skewness            0.03298 8.559e-01    Assumptions acceptable.
Kurtosis           17.24229 3.290e-05 Assumptions NOT satisfied!
Link Function       6.90499 8.596e-03 Assumptions NOT satisfied!
Heteroscedasticity  0.07892 7.788e-01    Assumptions acceptable.

Call:
lm(formula = NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.82036 -0.30011  0.02332  0.34082  2.32954 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)   5.480512   0.525739  10.424  < 2e-16 ***
MilesLastFill 0.018666   0.001324  14.095  < 2e-16 ***
NumDaysBetw   0.082196   0.015536   5.291 3.16e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5553 on 202 degrees of freedom
Multiple R-squared:  0.4959,	Adjusted R-squared:  0.4909 
F-statistic: 99.34 on 2 and 202 DF,  p-value: < 2.2e-16


ASSESSMENT OF THE LINEAR MODEL ASSUMPTIONS
USING THE GLOBAL TEST ON 4 DEGREES-OF-FREEDOM:
Level of Significance =  0.05 

Call:
 gvlma(x = NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData) 

                      Value   p-value                   Decision
Global Stat        24.25918 7.087e-05 Assumptions NOT satisfied!
Skewness            0.03298 8.559e-01    Assumptions acceptable.
Kurtosis           17.24229 3.290e-05 Assumptions NOT satisfied!
Link Function       6.90499 8.596e-03 Assumptions NOT satisfied!
Heteroscedasticity  0.07892 7.788e-01    Assumptions acceptable.

Call:
lm(formula = NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData)

Coefficients:
  (Intercept)  MilesLastFill    NumDaysBetw  
      5.48051        0.01867        0.08220  


ASSESSMENT OF THE LINEAR MODEL ASSUMPTIONS
USING THE GLOBAL TEST ON 4 DEGREES-OF-FREEDOM:
Level of Significance =  0.05 

Call:
 gvlma(x = lm(NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData)) 

                      Value   p-value                   Decision
Global Stat        24.25918 7.087e-05 Assumptions NOT satisfied!
Skewness            0.03298 8.559e-01    Assumptions acceptable.
Kurtosis           17.24229 3.290e-05 Assumptions NOT satisfied!
Link Function       6.90499 8.596e-03 Assumptions NOT satisfied!
Heteroscedasticity  0.07892 7.788e-01    Assumptions acceptable.

Call:
lm(formula = NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.82036 -0.30011  0.02332  0.34082  2.32954 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)   5.480512   0.525739  10.424  < 2e-16 ***
MilesLastFill 0.018666   0.001324  14.095  < 2e-16 ***
NumDaysBetw   0.082196   0.015536   5.291 3.16e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.5553 on 202 degrees of freedom
Multiple R-squared:  0.4959,	Adjusted R-squared:  0.4909 
F-statistic: 99.34 on 2 and 202 DF,  p-value: < 2.2e-16


ASSESSMENT OF THE LINEAR MODEL ASSUMPTIONS
USING THE GLOBAL TEST ON 4 DEGREES-OF-FREEDOM:
Level of Significance =  0.05 

Call:
 gvlma(x = lm(NumGallons ~ MilesLastFill + NumDaysBetw, data = CarMileageData)) 

                      Value   p-value                   Decision
Global Stat        24.25918 7.087e-05 Assumptions NOT satisfied!
Skewness            0.03298 8.559e-01    Assumptions acceptable.
Kurtosis           17.24229 3.290e-05 Assumptions NOT satisfied!
Link Function       6.90499 8.596e-03 Assumptions NOT satisfied!
Heteroscedasticity  0.07892 7.788e-01    Assumptions acceptable.

gvlma documentation built on May 2, 2019, 9:20 a.m.

Related to gvlma in gvlma...