#参数估计
data<-read.csv("house_price_gr.csv")
View(data)
mean(data$rate)
a<-sd(data$rate)
a
b<-a/sqrt(nrow(data))
b
alpha<-0.95
qnorm((1+alpha)/2)
qt((1+alpha)/2,nrow(data)-1)
xbar<-mean(data$rate)
xbar-qnorm((1+alpha)/2)*b
xbar+qnorm((1+alpha)/2)*b
xbar+qnorm((1+0.99)/2)*b
xbar-qnorm((1+0.99)/2)*b
#T检验
data<-read.csv("G:/数据分析/五、r/R基础课件/house_price_gr.csv")
View(data)
t.test(data$rate,mu=0.1)
t.test(data$rate,mu=0.1,alternative = "greater")
#两样本T检验
data<-read.csv("G:/数据分析/五、r/R基础课件/creditcard_exp.csv")
View(data)
tapply(data$avg_exp,data$gender,summary)#看均值差别
var.test(data$avg_exp~data$gender)#方差齐性检验
t.test(data$avg_exp~data$gender,var.equal=T)#两样本T检验
#单因素方差分析
oneway.test(avg_exp~edu_class,data,var.equal=F)
anova(lm(avg_exp~edu_class))
library(car)
bartlett.test(avg_exp~edu_class,data)#方差齐性检验