服务热线
178 0020 3020
## R运行 #R语言运行代码如下: x<-c(0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.20,0.23) y<-c(42.0,43.5,45.0,45.5,45.0,47.5,49.0,53.0,50.0,55.0,55.0) data1=data.frame(x=x,y=y) #数据存入数据框 #拟合线性函数 lm.data1<-lm(y~ x,data=data1) summary(lm.data1) #输出拟合后信息 ab<-round(lm.data1$coefficients[1],3) #回归方程系数a,保留3位小数 bb<-round(lm.data1$coefficients[2],3) #回归方程系数b,保留3位小数 plot(data1$x,data1$y,xlab="x",ylab = "y",col="red",pch="*") #训练数据点 abline(lm.data1,col="blue") #拟合曲线 text(mean(data1$x),max(data1$y),paste("y = ",bb,"x+(",ab,")",sep = ""))#方程式 #BAC蛋白浓度计算 a1<-c(0,0.0625,0.125,0.25,0.5,1) a2<-c(0.079666667,0.098333333,0.124,0.162,0.251,0.410666667) data2=data.frame(x=a1,y=a2) b1<-c(0.333,0.356,0.276,0.156) b2<-c(0.322333333,0.356,0.271333333,0.153666667) data3=data.frame(x=b1,y=b2) Model=lm(y~x,data=data2) summary(Model) #输出拟合后信息 ab<-round(Model$coefficients[1],3) #回归方程系数a,保留3位小数 bb<-round(Model$coefficients[2],3) #回归方程系数b,保留3位小数 plot(data2$x,data2$y,xlab="BAC method for protein concentraion measurement",ylab = "Concentraion(unit:ug/ul)",col="blue",pch=10) #训练数据点 abline(Model,col="blue") #拟合曲线 text(mean(data2$x),max(data2$y),paste("y = ",bb,"x+(",ab,")",sep = ""))#方程式 legend("bottomright",legend = "R^2=0.9994") m<-predict(Model,data3,interval="confidence") points(b1,m[1:4],pch=c("A","B","C","D"),col="red")
结果
附件