Вы находитесь на странице: 1из 3

> cloth<-read.csv(file.

choose())
> head(cloth)
X tsales sales margin nown nfull npart naux hoursw hourspw
1 1 750000 4411.765 41 1 1.0000 1.0000 1.5357 76 16.75596
2 2 1926395 4280.878 39 2 2.0000 3.0000 1.5357 192 22.49376
3 3 1250000 4166.667 40 1 2.0000 2.2222 1.4091 114 17.19120
4 4 694227 2670.104 40 1 1.0000 1.2833 1.3673 100 21.50260
5 5 750000 15000.000 44 2 1.9556 1.2833 1.3673 104 15.74279
6 6 400000 4444.444 41 2 1.9556 1.2833 1.3673 72 10.89885
inv1 inv2 ssize start
1 17166.67 27177.04 170 41
2 17166.67 27177.04 450 39
3 292857.20 71570.55 300 40
4 22207.04 15000.00 260 40
5 22207.04 10000.00 50 44
6 22207.04 22859.85 90 41
> str(cloth)
'data.frame': 400 obs. of 14 variables:
$ X : int 1 2 3 4 5 6 7 8 9 10 ...
$ tsales : int 750000 1926395 1250000 694227 750000 400000 1300000 495340 1200000
495340 ...
$ sales : num 4412 4281 4167 2670 15000 ...
$ margin : num 41 39 40 40 44 41 39 28 41 37 ...
$ nown : num 1 2 1 1 2 ...
$ nfull : num 1 2 2 1 1.96 ...
$ npart : num 1 3 2.22 1.28 1.28 ...
$ naux : num 1.54 1.54 1.41 1.37 1.37 ...
$ hoursw : int 76 192 114 100 104 72 161 80 158 87 ...
$ hourspw: num 16.8 22.5 17.2 21.5 15.7 ...
$ inv1 : num 17167 17167 292857 22207 22207 ...
$ inv2 : num 27177 27177 71571 15000 10000 ...
$ ssize : int 170 450 300 260 50 90 400 100 450 75 ...
$ start : num 41 39 40 40 44 41 39 28 41 37 ...
> mean(cloth$tsales)
[1] 833584.2
> median(cloth$tsales)
[1] 694227
> sd(cloth$tsales)
[1] 583463.8
> cor(cloth$tsales,cloth$hoursw)
[1] 0.7091963
> cor(cloth$tsales,cloth$inv1)
[1] 0.1905394
> cor(cloth$tsales,cloth$margin)
[1] 0.2409816
> cor(cloth$tsales,cloth$hourspw)
[1] 0.5523265
> cor(cloth$tsales,cloth$hoursw)
[1] 0.7091963
> plot(hoursw~tsales,data=cloth)
> boxplot(cloth$tsales)
> boxplot.stats(cloth$tsales)
$stats
[1] 50000 495340 694227 976817 1600000

$n
[1] 400

$conf
[1] 656190.3 732263.7

$out
[1] 1926395 1894931 1718000 1850000 1926395 2053200 1926395 3543400 1943500
[10] 2500000 1926395 1926395 1926395 1926395 2700000 1926395 3545901 1926395
[19] 4000000 1926395 2737701 1891500 1926395 2737701 1926395 1926395 1700000
[28] 1800000 2000000 2000000 1950000 1993529 1800000 5000000

> cloth<-subset(cloth,tsales<1600000)
> boxplot(cloth$tsales)
> boxplot(cloth$hoursw)
> boxplot.stats(cloth$hoursw)
$stats
[1] 32 78 100 132 212

$n
[1] 365

$conf
[1] 95.53415 104.46585

$out
[1] 305 270 313 240 244 240 279 224 228 234 250

> cloth<-subset(cloth,hoursw<212)
> boxplot(cloth$hoursw)
> ulmcloth<-lm(tsales~hoursw,data=cloth)
> plot(hoursw~tsales,data=cloth)
> abline(ulmcloth)
> plot(tsales~hoursw,data=cloth)
> abline(ulmcloth,col="red")
> hist(cloth$tsales)
> summary(ulmcloth)

Call:
lm(formula = tsales ~ hoursw, data = cloth)

Residuals:
Min 1Q Median 3Q Max
-528282 -176767 -36409 168236 793177

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 62535 37019 1.689 0.0921 .
hoursw 5942 334 17.792 <2e-16 ***
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

Residual standard error: 239600 on 351 degrees of freedom


Multiple R-squared: 0.4742, Adjusted R-squared: 0.4727
F-statistic: 316.6 on 1 and 351 DF, p-value: < 2.2e-16

> plot(ulmcloth)
Waiting to confirm page change...
Waiting to confirm page change...
Waiting to confirm page change...
Waiting to confirm page change...
> pie(ssize$cloth)
Error in pie(ssize$cloth) : object 'ssize' not found
> pcloth<-table(ssize$cloth)
Error in table(ssize$cloth) : object 'ssize' not found
> pcloth<-table(tsize$cloth)
Error in table(tsize$cloth) : object 'tsize' not found
> pcloth<-table(tsize,cloth)
Error in table(tsize, cloth) : object 'tsize' not found
> pcloth<-table(ssize,cloth)
Error in table(ssize, cloth) : object 'ssize' not found
> pcloth<-table(ssize$cloth)
Error in table(ssize$cloth) : object 'ssize' not found
> pcloth<-table(cloth$ssize))
Error: unexpected ')' in "pcloth<-table(cloth$ssize))"
> pcloth<-table(cloth$ssize)
> pie(pcloth)
>

Вам также может понравиться