A VBA script for Y=aX^b regression (essentially, linear regression)

这是一个简单的可直接在Excel中使用的VBA脚本。用于指数形式的回归:Y=aX^b。这种形式本质上是线性回归。需要注意的是,此代码要求X和Y均为正值,否则请先做必要的变换。

‘Author: zhb (zhanghongbo@itpcas.ac.cn)
‘Date: 2015.7.21
‘Final Revision: 2015.7.22
Option Explicit
Private Sub CommandButton1_Click()
Dim xx As Range
Dim yy As Range
Dim aa As Range
Dim bb As Range
Dim tt As Range
Dim pp As Range
Dim ss As Range
Dim rr As Range
Dim nn As Range
Continue Reading →

A VBA script for estimating snow threshold temperature

‘Author: zhb
‘Email: zhanghongbo@itpcas.ac.cn
‘提取固态降水到新增的三列
Sub DividePrec()
Dim OriPrec As Range
Dim OutPrec01 As Range
Dim OutPrec02 As Range
Dim OutPrec03 As Range
Dim Irow As Integer
Dim vall As Integer
Dim vals As String
Set OriPrec = Range(“H3:H20548″)
Set OutPrec01 = Range(“I3:I20548″)
Set OutPrec02 = Range(“J3:J20548″)
Set OutPrec03 = Range(“K3:K20548″)
For Irow = 1 To OriPrec.Rows.Count

Continue Reading →