Professional Documents
Culture Documents
R Version 3
R Version 3
> LOG(5)}
Error: unexpected '}' in "LOG(5)}"
> LOG(5)
Error in LOG(5) : could not find function "LOG"
> i<-5
> i
[1] 5
> (e<-2)
[1] 2
> e+i
[1] 7
> e-i
[1] -3
> e*i
[1] 10
> o=e+i
> 0
[1] 0
> o
[1] 7
> u<-e^i
> u
[1] 32
> a<-c(1,2,3)
> a
[1] 1 2 3
> d<-(4,5,6)
Error: unexpected ',' in "d<-(4,"
> d
Error: object 'd' not found
> d<-c(4,5,6)
> d
[1] 4 5 6
> d+a
[1] 5 7 9
> max(a)
[1] 3
> min(a)
[1] 1
> max(d)
[1] 6
> min(d)
[1] 4
> max(a)-min(d)
[1] -1
> max(d)-min(a)
[1] 5
> sort(a)
[1] 1 2 3
> h(9,8,7,6,5,4,3,2,1)
Error in h(9, 8, 7, 6, 5, 4, 3, 2, 1) : could not find function "h"
> h<-c(9,8,7,6,5,4,3,2,1))
Error: unexpected ')' in "h<-c(9,8,7,6,5,4,3,2,1))"
> h<-c(9,8,7,6,5,4,3,2,1)
> h
[1] 9 8 7 6 5 4 3 2 1
> sort(h)
[1] 1 2 3 4 5 6 7 8 9
> length(h)
[1] 9
> sum(h)
[1] 45
> prod(h)
[1] 362880
> summary(h)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1 3 5 5 7 9
> min(h)
[1] 1
> mean(h)
[1] 5
> sd(h)
[1] 2.738613
> var<-=sd(h)^2
Error: unexpected '=' in "var<-="
> var=sd(h)^2
> var
[1] 7.5
> var(h)
[1] 7.5
> table(h)
h
1 2 3 4 5 6 7 8 9
1 1 1 1 1 1 1 1 1
> hist(h)
> numeric(10)
[1] 0 0 0 0 0 0 0 0 0 0
> numeric(20)
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> numeric(22)
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> sd(h)
[1] 2.738613
> rep(1,20)
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> rep(2,20)
[1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
> w<-numeric(20)
> w
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> seq(50)
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
[20] 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
[39] 39 40 41 42 43 44 45 46 47 48 49 50
> seq(4,20,2)
[1] 4 6 8 10 12 14 16 18 20
> 5:15
[1] 5 6 7 8 9 10 11 12 13 14 15
> 0==1
[1] FALSE
> 0<1
[1] TRUE
> 1==1
[1] TRUE
> 5==4
[1] FALSE
> (r<-c(7,2,6,9,4,1,3))
[1] 7 2 6 9 4 1 3
> (w<-r<3|r>=6)
[1] TRUE TRUE TRUE TRUE FALSE TRUE FALSE
> milista<-list(A=seq(8,36,4),this="that",idm=diag(3))
> milista
$A
[1] 8 12 16 20 24 28 32 36
$this
[1] "that"
$idm
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1
> names(milista)
[1] "A" "this" "idm"
> milista$A
[1] 8 12 16 20 24 28 32 36
> A<-matrix(c(2,-4,-1,5,7,0),nrow = 2)
> A
[,1] [,2] [,3]
[1,] 2 -1 7
[2,] -4 5 0
> B<-matrix(c(2,1,0,3,-1,-5),nrow = 2)
> B
[,1] [,2] [,3]
[1,] 2 0 -1
[2,] 1 3 -5
> A+B
[,1] [,2] [,3]
[1,] 4 -1 6
[2,] -3 8 -5
> A-B
[,1] [,2] [,3]
[1,] 0 -1 8
[2,] -5 2 5
> A*B
[,1] [,2] [,3]
[1,] 4 0 -7
[2,] -4 15 0
> A/B
[,1] [,2] [,3]
[1,] 1 -Inf -7
[2,] -4 1.666667 0
> library(readxl)
> DATTOS <- read_excel("DATTOS.xlsx")
> View(DATTOS)
> DATTOS
# A tibble: 10 x 3
OBS Y C
<dbl> <dbl> <dbl>
1 1. 40. 10.
2 2. 42. 15.
3 3. 48. 22.
4 4. 56. 24.
5 5. 50. 30.
6 6. 58. 32.
7 7. 60. 38.
8 8. 69. 40.
9 9. 72. 45.
10 10. 84. 49.
> plot(Y,C)
Error in plot(Y, C) : object 'Y' not found
> Y
Error: object 'Y' not found
> (Y<-c(40,42,48,46,50,58,60,69,72,84))
[1] 40 42 48 46 50 58 60 69 72 84
> (C<-c(10,15,22,24,30,32,38,40,45,49))
[1] 10 15 22 24 30 32 38 40 45 49
> plot(Y,C)
> cor(Y,C)
[1] 0.9546402
> R=cor(Y,C)
> R
[1] 0.9546402
> R^2
[1] 0.9113379
> library(stats)
> install.packages("car")
Installing package into ‘C:/Users/Viviana/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’, ‘lme4’,
‘SparseM’, ‘MatrixModels’, ‘pbkrtest’, ‘quantreg’
clase 6/03/2018
datos de la regresion
HISTOGRAMA
z<-residuals(model1)
Error in residuals(model1) : object 'model1' not found
> plot(z)
Error in plot(z) : object 'z' not found
> View(reg1)
> z<-residuals(reg1)
> plot(z)
> histogram(z)
Error in histogram(z) : could not find function "histogram"
> hist(z)
POSEEER TRABAJO 1
Tener # hijos 4