You are on page 1of 5

R version 3.6.

2 (2019-12-12) -- "Dark and Stormy Night"


Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R es un software libre y viene sin GARANTIA ALGUNA.


Usted puede redistribuirlo bajo ciertas circunstancias.
Escriba 'license()' o 'licence()' para detalles de distribucion.

R es un proyecto colaborativo con muchos contribuyentes.


Escriba 'contributors()' para obtener más información y
'citation()' para saber cómo citar R o paquetes de R en publicaciones.

Escriba 'demo()' para demostraciones, 'help()' para el sistema on-line de ayuda, o 'help.start()' para
abrir el sistema de ayuda HTML con su navegador. Escriba 'q()' para salir de R.

[ Previously saved workspace restored ]

> DBH <- c(6,9,8,3,10,4,5,2,11,9,10, 2)


> D16 <-c(10,12,12,4,12,6,8,2,18,9,17, 2)
> HT <-c(3,11,4,1,11,1,7,4,8,10,8, 5)
> Datos<-data.frame(DBH=DBH,D16=D16,HT=HT )
> plot(Datos )
> cor(Datos )
DBH D16 HT
DBH 1.0000000 0.9360778 0.7334451
D16 0.9360778 1.0000000 0.5495197
HT 0.7334451 0.5495197 1.0000000
> local({pkg <- select.list(sort(.packages(all.available = TRUE)),graphics=TRUE )
+ if(nchar(pkg)) library(pkg, character.only=TRUE )})
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: carData
Loading required package: sandwich
Loading required package: effects
Registered S3 methods overwritten by 'lme4':
method from
cooks.distance.influence.merMod car
influence.merMod car
dfbeta.influence.merMod car
dfbetas.influence.merMod car lattice
theme set by effectsTheme() See
?effectsTheme for details.

Versión del Rcmdr 2.6-2

Attaching package: 'Rcmdr'

The following object is masked from 'package:base':

errorCondition > partial.cor(Datos )

Partial correlations:
DBH D16 HT
DBH 0.00000 0.93858 0.74529
D16 0.93858 0.00000 -0.57308
HT 0.74529 -0.57308 0.00000

Number of observations: 12
> fit=lm(DBH~D16+HT)
> sfit=summary(fit )
> sfit

Call:
lm(formula = DBH ~ D16 + HT)

Residuals:
Min 1Q Median 3Q Max
-1.2065 -0.5262 -0.1497 0.5443 1.4465
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.33732 0.56736 0.595 0.56679
D16 0.48108 0.05895 8.160 1.89e-05 ***
HT 0.28865 0.08608 3.353 0.00848 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.8597 on 9 degrees of freedom


Multiple R-squared: 0.945, Adjusted R-squared: 0.9328
F-statistic: 77.29 on 2 and 9 DF, p-value: 2.149e-06

> confint(fit )
2.5 % 97.5 % ( Intercept ) -
0.94613861 1.6207785
D16 0.34771091 0.6144411
HT 0.09393154 0.4833739
> cv=100*(0.8597/mean(DBH ))
> cv
[1] 13.05873
> par(mfrow=c(2,2))
> plot(fit )
> e<-residuals(fit )
> d<-e/sfit$sigma
> hist(d,probability=T,xlab="Residuos estandarizados",main="",xlim =c(-3,3))
> d.seq<-seq(-3,3,length=50)
> lines(d.seq,dnorm(d.seq,mean(d),sd(d))) > shapiro.test(e)

Shapiro-Wilk normality test

data: e
W = 0.97028, p-value = 0.9137

> library(lmtest )
Loading required package: zoo

Attaching package: ‘zoo’

The following objects are masked from ‘package:base’:

as.Date, as.Date.numeric

> bptest(fit) studentized Breusch-


Pagan test

data: fit
BP = 2.771, df = 2, p-value = 0.2502
> n<-length(d)
> plot(d[1:(n-1)],d[2:n],xlab="Residuo i",ylab="Residuo i-1" )
> lines(lowess(d[1:(n-1)],d[2:n]),col="red")

> library(lmtest)
> dwtest(fit,alternative="two.sided") Durbin-Watson
test

data: fit
DW = 1.9561, p-value = 0.7617
alternative hypothesis: true autocorrelation is not 0.

You might also like