REGRDIAGNOSTICS: Diagnostics of regressions

Description Usage Arguments Details Value Note See Also Examples

Description

Diagnostics of the output of lm, that is used to fit linear models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 R2.lm (x)
 prt.lm (x)
 mantel.lm (x, Nperm = 1000)
 vif.lm (x)
 RMSE.lm (x) 
 MAE.lm (x)
 predinterval.lm (x, level = 0.95)
 jackknife1.lm (x)
 RMSEjk.lm (x)
 MAEjk.lm (x)

Arguments

x

object of class “lm” (output of ‘lm’)

Nperm

number of permutations

level

significance level

Details

mantel.lm is performed under the assumption that the dependent distance matrix is variable, while the independent distance matrices are fixed and measured without error (they are not related to random variables, see Smouse et al., 1986). Under this assumption, the significance of the regression between distance matrices can be evaluated simultaneously permuting the rows and corresponding columns in only the dependent distance matrix, while the others are held constant.

Value

R2.lm returns the coefficient of determination R^2 and the adjusted coefficient of determination R^2_{adj} of the regression.

prt.lm returns the probability Pr(>|t|) of the significance test (Student t) of the independent variables. If the value is 0.06 for a regressor, its coefficient is not significantly different from 0 for a test with significance level of 5%.

mantel.lm returns the probability P of the Mantel test on every variable conditionated to the others. It substitutes prt.lm when dealing with distance matrices. If P is, for example, 0.92, the variable should be considered significant with significance level greater of 8%.

vif.lm returns the variance inflation factors (VIF) of the independent values of the regression. If VIF > 5 (or 10) there is a problem of multicollinearity.

RMSE.lm returns the root mean squared error of the regression.

MAE.lm returns the mean absolute error of the regression.

predinterval.lm returns the prediction intervals at a specified level in correspondence to the fitted data.

jackknife1.lm returns predicted values by a jackknife (cross-validation) procedure. The procedure (remove 1 observation, fit the model, estimate in the removed point) is repeated for all the points.

RMSEjk.lm returns the root mean squared error of the cross-validation (performed with jackknife1.lm).

MAEjk.lm returns the mean absolute error of the cross-validation (performed with jackknife1.lm).

Note

For information on the package and the Author, and for all the references, see nsRFA.

See Also

lm, summary.lm, predict.lm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
data(hydroSIMN)

D <- annualflows["dato"][,]
cod <- annualflows["cod"][,]

#Dm <- tapply(D,cod,mean)
#datregr <- cbind(Dm,parameters)
datregr <- parameters
regr0 <- lm(Dm ~ .,datregr); summary(regr0)
regr1 <- lm(Dm ~ Am + Hm + Ybar,datregr); summary(regr1)

R2.lm(regr0)
R2.lm(regr1)

prt.lm(regr0)
prt.lm(regr1)

vif.lm(regr0)
vif.lm(regr1)

RMSE.lm(regr0)
RMSE.lm(regr1)

MAE.lm(regr0)
MAE.lm(regr1)

predinterval.lm(regr0)

jackknife1.lm(regr0)
jackknife1.lm(regr1)

RMSEjk.lm(regr0)
RMSEjk.lm(regr1)

MAEjk.lm(regr0)
MAEjk.lm(regr1)

# mantel test on distance matrices
#Y <- AD.dist(D,cod)             # it takes some time
#X <- data.frame(apply(datregr[,c("Hm","Ybar")],2,dist))
#dati <- cbind(X)
#modello <- lm(Y ~ Hm + Ybar, dati)
#mantel.lm(modello, Nperm=100)

nsRFA documentation built on Feb. 26, 2020, 5:19 p.m.