Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Cau 1 a
- setwd("D:/Thực hành XSTK/Bai TH04-05/Data cho cac bai thuc hanh")
- data=read.csv('volume.csv',header=)
- x=(data['machine1'])
- y=(data['machine2'])
- n1=unlist(x)
- n2=unlist(y)
- t.test(n1,n2,alternative='two.sided',var.equal=FALSE,conf.level=0.95)
- #Cau 1 d
- test.leq.oneside=function(x, y, a , a1 ,a2 ,alpha)
- {
- Sx=var(x)
- Sy=var(y)
- n=length(x)
- m=length(y)
- Sp=((n-1)*Sx^2+(m-1)*Sy^2)/(n+m-2)
- Mx=mean(x)
- My=mean(y)
- T0 = (Mx-My)/sqrt(Sx^2/n+Sy^2/m)
- df = ((Sx^2/n+Sy^2/m)^2)/((Sx^2)^2/(n-1)+(Sy^2)^2/(m-1))
- t = pt(1-alpha/2,df)
- p_value = 2* pt(abs(T0), df)
- if(abs(T0)>t)
- print("Bac Bo")
- else
- print("Khong du dieu kien")
- print(p_value)
- }
- test.leq.oneside(n1,n2,0,0.2,0.3,0.05)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement