diff --git a/content/math/MOC.md b/content/math/MOC.md index 8d66e40dc..1c95aee71 100644 --- a/content/math/MOC.md +++ b/content/math/MOC.md @@ -8,10 +8,14 @@ date: 2023-12-03 # Statistics -## Basic concept +## Basic Concept * [Quantile](math/Statistics/Basic/Quantile.md) +## Significance Test + +* [Basic about significance test](math/Statistics/significance_test/whats_the_significance_test.md) + # Discrete mathematics ## Set theory diff --git a/content/math/Statistics/significance_test/attachments/Pasted image 20240415174359.png b/content/math/Statistics/significance_test/attachments/Pasted image 20240415174359.png new file mode 100644 index 000000000..8e8d83859 Binary files /dev/null and b/content/math/Statistics/significance_test/attachments/Pasted image 20240415174359.png differ diff --git a/content/math/Statistics/significance_test/whats_the_significance_test.md b/content/math/Statistics/significance_test/whats_the_significance_test.md new file mode 100644 index 000000000..aac9d3194 --- /dev/null +++ b/content/math/Statistics/significance_test/whats_the_significance_test.md @@ -0,0 +1,111 @@ +--- +title: What's the significance test +tags: + - advanced + - statistics + - math +date: 2024-04-15 +--- +⭐⭐The significance test tells us **whether or not what we observe in the sample is expected to be true in the populatio**n, and can be conducted through a **hypothesis test**.⭐⭐ + +# Goal⭐ + +• The sample correlation coefficient ($r$) between x and y is known (can be computed using samples) +• The population correlation coefficient ($\rho$) between x and y is unknown (because we only have sample data) +• Goal: We want to make an inference about the value of $\rho$ based on $r$ + + +# Hypothesis Test + +The hypothesis test will let us infer whether the value of the population correlation coefficient $\rho$ is close to 0 or significantly different from 0. We decide this based on the sample correlation coefficient $r$ and the sample size $n$ + +Situation: + +• **$\rho$ close to 0**: means there is not a significant linear correlation between x and y in the population. +• **$\rho$ significantly different from 0**: means there is a significant correlation between x and y in the population. + +For hypothesis test, we have two types - the **null** and **alternative** hypotheses. + +• The **alternative hypothesis** is always what we are trying to **prove**. +• The **null hypothesis** is the hypothesis that we are trying to provide evidence **against**. + +### Detailed Explaination + +1. **零假设(Null Hypothesis)** - 通常表示为$H_0$​。 零假设是一个默认的假设,它通常表示没有效应、没有差异或变量之间没有关系。换句话说,零假设通常提出了一个“无效果”的声明,比如两组数据的均值没有差异、两个变量之间没有相关性等。在假设检验中,研究者试图通过收集和分析数据来寻找拒绝零假设的证据。 + + 例如,如果研究者想要检验两种药物对血压的影响是否有差异,零假设可能是“两种药物对降低血压的效果没有差异”。 + +2. **备择假设(Alternative Hypothesis)** - 通常表示为$H_1$或$H_a$​。 备择假设与零假设相对立,它提出了一个“有效果”的声明,即存在效应、差异或关系。备择假设通常是研究者真正感兴趣的假设,它反映了研究者希望证明的效应或关系。 + + 在上述药物对血压影响的例子中,备择假设可能是“两种药物对降低血压的效果存在差异”。 + + +### Classic Test Method + +Here's some classic test method: + +* **T-Test** (Student's T-Test) +* **ANOVA** (Analysis of Variance) +* **Mann-Whitney U Test** - MWU (Mann-Whitney U Test) +* **Kruskal-Wallis H Test** - KW (Kruskal-Wallis H Test) +* **Friedman Test** - FT (Friedman Test) +* **ANCOVA** - ANCOVA (Analysis of Covariance) +* **Pearson Correlation Coefficient** - PCC (Pearson Correlation Coefficient) +* **Factor Analysis** - FA (Factor Analysis) +* **Cluster Analysis** - CA (Cluster Analysis) +* **Time Series Analysis** - TSA (Time Series Analysis) +* ... ... + +## T-test + +Here we introduce a very classic test method, called T-test, also called Student’s T-test, which is an inferential statistic that allows to test an assumption applicable to a population, or simply, it allows to use sample data to generalize an assumption to an entire population. + + +> [!info] +> T检验是由威廉·戈塞特(William Sealy Gosset)在20世纪初提出的,他使用笔名“Student”发表了相关论文,因此这种检验有时也被称为“Student's t-test”。它通常用于样本量较小的情况 +### T-value + +Equation: + +$$ +t=\frac{r\times\sqrt{n-2}}{1-r^2} +$$ +$$ +\text{n is the sample size, r is the correlation coefficient} +$$ + +T值(t-value)是从T检验中得到的统计量,它是**样本均值差异与样本内变异性的比率**。T值越大,意味着样本均值之间的差异相对于样本内的变异性越大,这通常会导致更低的p值,从而增加了**拒绝零假设**(即两组均值没有差异)的证据。换句话说,T值越大,我们越有理由相信两组之间的均值差异是真实存在的,而不是由随机变异引起的。 + +T值的大小并不直接影响相关性的可重复性。然而,如果我们在讨论的是重复测量的均值差异,那么在某种程度上,较大的T值可能会使得研究者更有信心认为这种差异是可靠的,因为较大的T值意味着较小的p值,这可能**会使得研究结果在统计上更显著**。但是,这并**不意味着相关性的可重复性得到了提高**,因为**相关性的可重复性涉及到的是变量之间关系的一致性,而不是均值差异的显著性。** + +### P-value + +![](math/Statistics/significance_test/attachments/Pasted%20image%2020240415174359.png) + + +P值(P-value),全称为概率值(Probability value),是统计假设检验中的一个重要概念。**它用于帮助我们决定是否拒绝零假设**(null hypothesis)。**P值衡量的是,在零假设为真的情况下,观察到的统计量(如T值、Z值等)或更极端情况出现的概率**。 + +在进行假设检验时,我们通常设定一个显著性水平(alpha level),常用的值有0.05、0.01等。这个显著性水平是我们事先决定的拒绝零假设的阈值。如果计算出的P值小于这个显著性水平,我们就有理由拒绝零假设,认为观察到的效应或差异是统计上显著的,即不太可能是由随机变异引起的。 + +例如,假设我们进行一个T检验,零假设是两组数据的均值没有差异。如果我们得到的P值为0.03,而我们设定的显著性水平为0.05,那么P值小于0.05,我们就拒绝零假设,认为两组数据的均值存在显著差异。 + +需要注意的是,**P值并不直接告诉我们零假设是真还是假,也不提供效应大小的信息**。它只是表示**在零假设成立的前提下,得到当前统计结果或更极端结果的概率**。此外,P值也不是与发现效应的大小相关联的概率。**一个很小的P值**并不意味着效应很大,它**只意味着结果不太可能是偶然发生的**。 + +在使用P值时,应该**避免一些常见的误解和滥用**,如将P值解释为支持备择假设的概率,或者将P值与研究的结论重要性等同起来。正确理解和解释P值对于统计分析的有效性和科学性的结论至关重要。 + +# Conclusion + +1、小概率原理:小概率事件在一次试验中是几乎不可能发生的,假若在一次试验中小概率事件事实上发生了。那只能认为该事件不是来自我们假设的总体,也就是认为我们对总体所做的假设不正确。 + +2、观察到的显著水平:由样本资料计算出来的检验统计量观察值所截取的尾部面积。这个概率越小,反对原假设,认为观察到的差异表明真实的差异存在的证据便越强,观察到的差异便越加理由充分地表明真实差异存在。 + +3、检验所用的显著水平:针对具体问题的具体特点,事先规定这个检验标准。 + +4、在检验的操作中,把观察到的显著性水平与作为检验标准的显著水平标准比较,小于这个标准时,得到了拒绝原假设的证据,认为样本数据表明了真实差异存在。大于这个标准时,拒绝原假设的证据不足,认为样本数据不足以表明真实差异存在。 + +5、检验的操作可以用稍许简便一点的作法:根据所提出的显著水平查表得到相应的值,称作临界值,直接用检验统计量的观察值与临界值作比较,观察值落在临界值所划定的尾部内,便拒绝原假设;观察值落在临界值所划定的尾部之外,则认为拒绝原假设的证据不足。 + + +# Reference + +* https://kimi.moonshot.cn/chat \ No newline at end of file diff --git a/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171344.png b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171344.png new file mode 100644 index 000000000..65b7700e1 Binary files /dev/null and b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171344.png differ diff --git a/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171351.png b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171351.png new file mode 100644 index 000000000..b3134c717 Binary files /dev/null and b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171351.png differ diff --git a/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171510.png b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171510.png new file mode 100644 index 000000000..6a0b2fbdc Binary files /dev/null and b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171510.png differ diff --git a/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171736.png b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171736.png new file mode 100644 index 000000000..150ae79ef Binary files /dev/null and b/content/signal_processing/advanced_statistic/attachments/Pasted image 20240415171736.png differ diff --git a/content/signal_processing/advanced_statistic/autocorrelation/attachments/Pasted image 20240415171834.png b/content/signal_processing/advanced_statistic/autocorrelation/attachments/Pasted image 20240415171834.png new file mode 100644 index 000000000..05c70c882 Binary files /dev/null and b/content/signal_processing/advanced_statistic/autocorrelation/attachments/Pasted image 20240415171834.png differ diff --git a/content/signal_processing/advanced_statistic/autocorrelation/attachments/Pasted image 20240415171855.png b/content/signal_processing/advanced_statistic/autocorrelation/attachments/Pasted image 20240415171855.png new file mode 100644 index 000000000..f7e9b3a66 Binary files /dev/null and b/content/signal_processing/advanced_statistic/autocorrelation/attachments/Pasted image 20240415171855.png differ diff --git a/content/signal_processing/advanced_statistic/autocorrelation/autocorrelation.md b/content/signal_processing/advanced_statistic/autocorrelation/autocorrelation.md new file mode 100644 index 000000000..aff05673e --- /dev/null +++ b/content/signal_processing/advanced_statistic/autocorrelation/autocorrelation.md @@ -0,0 +1,223 @@ +--- +title: Autocorrelation in Signal Processing +tags: + - advanced + - signal + - statistics + - signal-processing +date: 2024-04-15 +--- +# Background +## Covariance + + +Covariance can classify three types of relationships between two random variables. + +1. **Relationships with positive trends** +2. **Relationships with negative trends** +3. **Times when there is no relationship because there is no trend** + +Also very importantly, covariance is a **computational stepping stone** to more interesting thing, like **correlation.** + + +Here's the equation to calculate the covariance: + +$$ +\begin{equation} +\begin{split} +cov(X, Y) & = E[(X-E[X])(Y - E[Y])] \\ +& = E[XY] - E[X]E[Y] \\ +cov(X, Y) & = \frac{\sum(x-\overline{x})(y-\overline{y})}{n-1} \\ +\end{split} +\end{equation} +$$ +![](signal_processing/advanced_statistic/attachments/Pasted%20image%2020240415171344.png) + +![](signal_processing/advanced_statistic/attachments/Pasted%20image%2020240415171351.png) + + +Covariance is hard to **interpret** because it is sensitive to the **scale** + + +To solve the scale effect, here's the correlation: + +## Correlation + +![](signal_processing/advanced_statistic/attachments/Pasted%20image%2020240415171510.png) + + +We can quantify the strength of the relationship with correlation (**Pearson’s correlation**) + +$$ +r= corr(X, Y) = \frac{cov(X, Y)}{\sqrt{var(X)}\sqrt{var(Y)}} +$$ + +$corr(X, Y)$ is between -1 to 1 + + +> [!tip] +> Correlation can still be 1 even we have so little data, even only 2 random dots In general, more data, **the more confidence we believe the correlation** +> +> NOTE: When we’re talking about correlation, we’re only talking about using **straight line** + + +![](signal_processing/advanced_statistic/attachments/Pasted%20image%2020240415171736.png) + +For correlation, we usually use **p-value** to **quantify the confidence** of the straight line relationship. **The more samll p-value, the more confident we say they are straight line relationship**; Like the figure: + +![](signal_processing/advanced_statistic/autocorrelation/attachments/Pasted%20image%2020240415171834.png) + +![](signal_processing/advanced_statistic/autocorrelation/attachments/Pasted%20image%2020240415171855.png) + + +About P-value, you have better know what's [significance test](math/Statistics/significance_test/whats_the_significance_test.md) + + +## Random Signal + +- 随机信号(Random Signals)在任何时间的取值都是不能先验确定的随机变量 +- 虽然随机信号的取值不能先验确定,但这些取值却服从某种统计规律,换言之,随机信号或过程可以用概率分布特性统计地描述 +- 随机变量 $X=x(t)$,离散状态为随机序列 $x(n)$,$x_k(n)$是随机序列$x(n)$的一个样本序列 + +### Statistics for Random Signal + +$$ +\mu_x(n)=E\{x(n)\}=\lim_{N\rightarrow\infty}\frac{1}{N}\sum_{k=1}^N x_k(n) +$$ +$$ +E\{x^2(n)\}=\lim_{N\rightarrow\infty}\frac{1}{N}\sum_{k=1}^N x^2_k(n) +$$ +$$ +\sigma^2_x(n)=E\{[x(n)-\mu_x(n)]^2\}=\lim_{N\rightarrow\infty}\frac{1}{N}\sum_{k=1}^N[x_k(n)-\mu_x(n)]^2 +$$ +$$ +\sigma^2_x(n)=E\{x^2(n)\}-\mu^2_x(n) +$$ +$$ +R_x(n_1,n_2)=E\{x(n_1)x(n_2)\}=\lim_{N\rightarrow\infty}\frac{1}{N}\sum_{k=1}^N x_k(n_1)x_k(n_2) +$$ + +# Autocorrelation + +## Equation + + +$$ +R_x(n_1,n_2) = E\{x(n_1)x(n_2)\}=\lim_{N\rightarrow\infty}\frac{1}{N}\sum_{k=1}^{N}x_k(n_1)x_k(n_2) +$$ +若令时移m=n_2-n_1,有: + +$$ +R_x(n,n+m) = E\{x(n)x(n+m)\}=\lim_{N\rightarrow\infty}\frac{1}{N}\sum_{k=1}^{N}x_k(n)x_k(n+m) +$$ + + +## Properties + +1. **Symmetry** + +$$ +R_x(m)=R_x(-m) +$$ + +2. **Maximum at zero** + +$$ +R_x(0) \geq |R_x(m)| +$$ + +$$ +R_x(0)=E\{x(n)x(n)\}=E\{x^2(n)\} \geq 0 +$$ + +$$ +E\{[x(n)\pm x(n+m)]^2\} \geq 0 +$$ + +So, + +$$ +E\{x^2(n)\} \pm 2E\{x(n)x(m+n)\} + E\{x^2(m+n)\} \geq 0 +$$ + +Depending on stable signal, + +$$ +E\{x^2(n)\} = E\{x^2(m+n)\} = R_x(0) +$$ + +So, + +$$ +2R_x(0)\pm2R_x(m) \geq 0 +$$ + +$$ +R_x(0) \geq |R_x(m)| +$$ + +3. **Relation between Autocovariance and Autocorrelation** + +$$ +C_x(m)=R_x(m)-\mu_x^2 +$$ + +$$ +C_x(0)=R_x(0)-\mu_x^2=E\{x^2(n)\}-\mu_x^2 = \sigma_x^2 +$$ + +4. 在**非周期平稳序列**上,随机变量在时间越来越远后,相关性变得越来越弱,$m \rightarrow \infty$,可以认为不相关 + +$$ +R_x(\infty)=\lim_{m\rightarrow\infty}R_x(m)=\lim_{m\rightarrow\infty}E\{x(n)x(m+n)\} = E\{x(n)\}E\{x(n+m)\}=\mu_x^2 +$$ + +5. 平稳信号**不含相位信息** + +$$ +y(n)=x(n-l) +$$ + +$$ +R_y(m)=R_x(m),C_y(m)=C_x(m) +$$ + +6. 本质性质,**正定性(Positive Definiteness)** + +**Positive Definiteness Matrix** + +$$ +A\in R^{n\times n},\text{ so, it have any vector } \alpha\in R^n: \\ +\alpha^T A \alpha \geq 0 +$$ + +将正定性推广到相关函数,有随机变量$X=[x(1),x(2),\cdots,x(n)]^T,$ 则存在相关矩阵$R$, + +$$ +R=\begin{bmatrix} +R(0) & \cdots & R(-n) \\ +\vdots & \ddots & \vdots \\ +R(n) & \cdots & R(0) +\end{bmatrix} +$$ + +存在任意向量$\alpha \in R^n$ + +$$ +\alpha^T R \alpha \geq0 +$$ + +从频域角度来看,Bochner: + +若$f(x)$正定,则等价于: + +$$ +\mathcal{F}(f(x)) = \int_{-\infty}^{\infty}f(x)e^{-j\omega x}dx \geq 0 +$$ + +其傅里叶变换始终大于0 + +# Reference + +* https://pinkr1ver.notion.site/Autocorrelation-Analysis-Power-Spectral-Density-330755770347472989062c6b31f18a21?pvs=4 +* https://www.youtube.com/watch?v=qtaqvPAeEJY&t=24s \ No newline at end of file diff --git a/content/signal_processing/advanced_statistic/autocorrelation/period_detect.md b/content/signal_processing/advanced_statistic/autocorrelation/period_detect.md new file mode 100644 index 000000000..e48ca446c --- /dev/null +++ b/content/signal_processing/advanced_statistic/autocorrelation/period_detect.md @@ -0,0 +1,9 @@ +--- +title: Autocorrelation to Detect Period +tags: + - statistics + - math + - advanced + - signal-processing +date: 2024-04-15 +--- diff --git a/content/signal_processing/device_and_components/oscilloscope/oscilloscope.md b/content/signal_processing/device_and_components/oscilloscope/oscilloscope.md index 0252088dc..c9362551e 100644 --- a/content/signal_processing/device_and_components/oscilloscope/oscilloscope.md +++ b/content/signal_processing/device_and_components/oscilloscope/oscilloscope.md @@ -65,3 +65,5 @@ Let's see the vertical subsystem of the oscilloscope. The basic form of an analo # Reference * https://www.linkedin.com/pulse/working-principle-indicators-oscilloscope-1-na-wang-6pkmc/ +* https://zhuanlan.zhihu.com/p/672667254 +* https://zhuanlan.zhihu.com/p/393063086 \ No newline at end of file diff --git a/content/signal_processing/signal_processing_MOC.md b/content/signal_processing/signal_processing_MOC.md index e0bb0fd8d..4eb6c2ca5 100644 --- a/content/signal_processing/signal_processing_MOC.md +++ b/content/signal_processing/signal_processing_MOC.md @@ -41,3 +41,16 @@ date: 2024-03-18 * [Gaussian Impulse Generating](signal_processing/impulse_generating/gaussian_impulse.md) + +## Autocorrelation + +* [Autocorrelation in Signal Processing](signal_processing/advanced_statistic/autocorrelation/autocorrelation.md) +* [Autocorrelation to Detect Period](signal_processing/advanced_statistic/autocorrelation/period_detect.md) + +# Software + +## CST MWS + +* [CST MWS Basic](signal_processing/software/simulation/CST/basic.md) + + diff --git a/content/signal_processing/software/simulation/CST/basic.md b/content/signal_processing/software/simulation/CST/basic.md new file mode 100644 index 000000000..8bff39cd5 --- /dev/null +++ b/content/signal_processing/software/simulation/CST/basic.md @@ -0,0 +1,9 @@ +--- +title: Basic about CST Microwave Studio (MWS) +tags: + - software + - "#signal-processing" + - "#signal" +date: 2024-04-15 +--- +CST WMS是一款专业的三维电磁仿真软件,专门用于提供**高频**问题的快速和精确的三维电磁仿真。 \ No newline at end of file