- 57
- 0
- 约2万字
- 约 25页
- 2015-10-24 发布于河南
- 举报
R语言作业
R语言作业 1-5章
第二章
x1=c(1.00,0.80,0.26,0.67,0.34,0.80,1.00,0.33,0.59,0.34,0.26,0.33,1.00,0.37,0.21,0.67,0.59,0.37,1.00,0.35,0.34,0.34,0.21,0.35,1.00);x1
A=matrix(x1,nrow=5,ncol=5);A
solve(A)
A.e=eigen(A);A.e
A.e$vectors%*%diag(A.e$values)%*%t(A.e$vectors)
1.
矩阵A:
1.00 0.80 0.26 0.67 0.34
0.80 1.00 0.33 0.59 0.34
0.26 0.33 1.00 0.37 0.21
0.67 0.59 0.37 1.00 0.35
0.34 0.34 0.21 0.35 1.00
矩阵A的逆矩阵
[,1] [,2] [,3] [,4] [,5]
[1,] 3.3881372 -2.1222233 0-1.0684729 -0[2,] -2.1222233 2.9421167 -0-0.1330915 -0[3,] 0.2370609 -0.3359331 1-0.3763728 -0[4,] -1.0684729 -0.1330915 -0 2.0091273 -0[5,] -0.1062280 -0.1616358 -0-0.2156244 1 特征值 [1] 2.7922569 0.8263366 0.7790638 0.4205873 0.1817554
特征向量:
[,1] [,2] [,3] [,4] [,5]
[1,] -0.5255426 0.3402197 -0.1665086 0 0[2,] -0.5186716 0.2343491 -0.1777739 0-0[3,] -0.3131429 -0.9030775 -0.2287038 0 0[4,] -0.4966433 0.0386900 -0.1185744 -0-0[5,] -0.3317705 -0.1108387 0.9350433 0 02.2
e2.2=read.table(clipboard,header=T);e2.2
attach(e2.2)
mean(X)
sd(X)
median(X)
f=hist(X,breaks=c(1000,1300,1600,1900,2200,2500,2800,3100))
f$count
f$count/length(X)
cumsum(f$count/length(X))
qqnorm(X)
qqline(X)
detach(e2.2)
平均工资 1897.2
工资方差 455.9808
工资中位数1872.5
各组频率 0.12 0.14 0.26 0.22 0.14 0.08 0.04
累计频率 0.12 0.26 0.52 0.74 0.88 0.96 1.00
近似服从正态分布
x
y
5h
10h
5-10h
N
Y
0.0
0.2
0.4
0.6
0.8
1.0
2.3
e2.3=read.table(clipboard,header=T)
e2.3
summary(e2.3)
attach(e2.3)
barplot(table(Smoke))
plot(Study,Smoke)
table(Smoke,Study)
tab=table(Smoke,Study)
prop.table(tab,1)
prop.table(tab,2)
prop.table(tab)
prop=function(x) x/sum(x)
apply(tab,2,prop)
t(apply(tab,1,prop))
编号 是否抽烟 Smoke 每天学习时间 Study
Min. : 1.00 否:4 N:4 5-10小时 :4 5h :3
1st Qu.: 3.25
原创力文档

文档评论(0)