#1
library(datasets)
data(women)
str(women)
lm_1<-lm(weight ~ height, data=women)
summary(lm_1)
sum((women$height - mean(women$height))^2)
sum((women$weight - mean(women$weight))*(women$height - mean(women$height)))
#2
fcq<-read.csv("fcq.csv")
str(fcq)
x_b<-qcc(fcq$x, type="xbar.one")
#####
e<-read.csv("E.csv")
q<-rep(1:20,each=4)
s<-data.frame(e,q)
X<-e$X
my_grp<-qcc.groups(data=X, sample=q)
my_grp
x_bar_cht<-qcc(my_grp, type="xbar")
r_bar_cht<-qcc(my_grp, type="R")
shapiro.test(X)
#3
library(qcc)
#P2
hosp<-read.csv("Hosp.csv")
str(hosp)
hosp$X<-NULL
hosp$X.1<-NULL
hosp$X.2<-NULL
x_b<-qcc(hosp$X, type="xbar.one")
###
F<-read.csv("Fq.csv")
w<-rep(1:15,each=10)
str(F)
f<-F$X
my_grp_1<-qcc.groups(data=f, sample=w)
x_bar_cht_1<-qcc(my_grp_1, type="xbar")
s_bar_cht<-qcc(my_grp_1, type="S")
r_bar_cht<-qcc(my_grp_1, type="R")
F_x<-f[1:90]
F_x<-append(F_x, f[101:150])
w_1<-rep(1:14,each=10)
my_grp_2<-qcc.groups(data=F_x, sample=w_1)
x_bar_cht_1<-qcc(my_grp_2, type="xbar")
s_bar_cht<-qcc(my_grp_2, type="S")
r_bar_cht<-qcc(my_grp_2, type="R")