#variables
x<-c(10,100,1000,10000,100000);x
## [1] 1e+01 1e+02 1e+03 1e+04 1e+05
y<-c(22,300,3800,40000,600000);y
## [1]     22    300   3800  40000 600000
z<-c(10,250,9000,12000,200000);z
## [1]     10    250   9000  12000 200000
#creating data frame
data.frame(x,y,z)
##       x      y      z
## 1 1e+01     22     10
## 2 1e+02    300    250
## 3 1e+03   3800   9000
## 4 1e+04  40000  12000
## 5 1e+05 600000 200000
#correlation
cor(x,y)
## [1] 0.9994765
cor(x,z)
## [1] 0.9981505
cor(y,z)
## [1] 0.9991731
#regression
lm(y~x+z)
## 
## Call:
## lm(formula = y ~ x + z)
## 
## Coefficients:
## (Intercept)            x            z  
##   -5324.470        3.518        1.265
#Analysis of variance
library(linearModel)
aov(lm(y~x+z))
## Call:
##    aov(formula = lm(y ~ x + z))
## 
## Terms:
##                            x            z    Residuals
## Sum of Squares  278344244624    179991933    111663750
## Deg. of Freedom            1            1            2
## 
## Residual standard error: 7472.073
## Estimated effects may be unbalanced
summary(lm(y~x+z))
## 
## Call:
## lm(formula = y ~ x + z)
## 
## Residuals:
##       1       2       3       4       5 
##  5298.6  4956.4 -5778.6 -5032.0   555.5 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)
## (Intercept) -5324.4702  3844.4490  -1.385    0.300
## x               3.5176     1.4070   2.500    0.130
## z               1.2651     0.7046   1.796    0.214
## 
## Residual standard error: 7472 on 2 degrees of freedom
## Multiple R-squared:  0.9996, Adjusted R-squared:  0.9992 
## F-statistic:  2494 on 2 and 2 DF,  p-value: 0.0004008
#visualization
hist(x)

hist(y)

hist(z)

plot(lm(y~x))

## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced
## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced