ExcelVBA编程实现多元线性回归( 三 )
<> "" And UserForm1.fxn4.Text <> "" ThenActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn3.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn4.Text))(i)End Ifx(i, 2) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Valuex(i, 3) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Valuey(i, 1) = ActiveWorkbook.Sheets(1).Range(addy).Cells(i, 1)Next ixt = Application.WorksheetFunction.Transpose(x)xtx = Application.WorksheetFunction.MMult(xt, x)xty = Application.WorksheetFunction.MMult(xt, y)xtxi = Application.WorksheetFunction.MInverse(xtx)beta = Application.WorksheetFunction.MMult(xtxi, xty)yp = Application.WorksheetFunction.MMult(x, beta)For i = 1 To numxActiveWorkbook.Sheets(1).Cells(i, 3).Value = http://kandian.youth.cn/index/yp(i, 1)Next iEnd IfIf nterm = 3 ThenReDim x(numx, 4) As Variant, y(numx, 1) As VariantFor i = 1 To numxx(i, 1) = 1If UserForm1.fxn1.Text ="" ThenActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn2.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn3.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn4.Text))(i)End IfIf UserForm1.fxn2.Text = "" ThenActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn1.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn3.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn4.Text))(i)End IfIf UserForm1.fxn3.Text = "" ThenActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn1.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn2.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn4.Text))(i)End IfIf UserForm1.fxn4.Text = "" ThenActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn1.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn2.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn3.Text))(i)End Ifx(i, 2) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Valuex(i, 3) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Valuex(i, 4) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Valuey(i, 1) = ActiveWorkbook.Sheets(1).Range(addy).Cells(i, 1)Next ixt = Application.WorksheetFunction.Transpose(x)xtx = Application.WorksheetFunction.MMult(xt, x)xty = Application.WorksheetFunction.MMult(xt, y)xtxi = Application.WorksheetFunction.MInverse(xtx)beta = Application.WorksheetFunction.MMult(xtxi, xty)yp = Application.WorksheetFunction.MMult(x, beta)For i = 1 To numxActiveWorkbook.Sheets(1).Cells(i, 3).Value = yp(i, 1)Next iEnd IfIf nterm = 4 ThenReDim x(numx, 5) As Variant, y(numx, 1) As VariantFor i = 1 To numxx(i, 1) = 1ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn1.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn2.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn3.Text))(i)ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 6).Value = http://kandian.youth.cn/index/Application.WorksheetFunction.Transpose(Evaluate("=" & UserForm1.fxn4.Text))(i)x(i, 2) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 3).Valuex(i, 3) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 4).Valuex(i, 4) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 5).Valuex(i, 5) = ActiveWorkbook.Sheets(1).Range(addx).Cells(i, 1).Offset(0, 6).Valuey(i, 1) = ActiveWorkbook.Sheets(1).Range(addy).Cells(i, 1)Next ixt = Application.WorksheetFunction.Transpose(x)xtx = Application.WorksheetFunction.MMult(xt, x)xty = Application.WorksheetFunction.MMult(xt, y)xtxi = Application.WorksheetFunction.MInverse(xtx)beta = Application.WorksheetFunction.MMult(xtxi, xty)yp = Application.WorksheetFunction.MMult(x, beta)For i = 1 To numxActiveWorkbook.Sheets(1).Cells(i, 3).Value = http://kandian.youth.cn/index/yp(i, 1)Next iEnd Ifypre = ActiveWorkbook.Sheets(1).Range("C1:C" & numx).AddressIf nterm = 1 ThenIf UserForm1.fxn1.Text
- 想实现《曼达洛人》的数字布景吗?索尼模块化屏幕即将开售
- 快递员工也能当“教授”?上海快递工程技术高级职称评审实现突破
- 机器人|万州区举办“中国梦科技梦”机器人编程大赛
- 骁龙888首次实现可变分辨率渲染 创造沉浸式游戏体验
- 柔宇FlexPai 2实现多次重复折叠无折痕,斩获CES 2021创新奖
- 飞步无人车:实现首个混线工况下的自动驾驶集卡编队独立整船作业
- 荣耀、高通相继宣布,雷军迎来大敌?任正非的预言正在实现
- 李炳忠自我打脸,去年realme销量翻番的目标远未实现
- 库克靠打工实现1个亿“小目标”iPhone 12全球热销功不可没
- 一个人完成AI开发和部署 百度飞桨实现铁路货车车号精准检测