首页 > 其他分享 >STAT3006/7305 STAT3006/7305  covariance matrix

STAT3006/7305 STAT3006/7305  covariance matrix

时间:2024-07-31 19:06:53浏览次数:13  
标签:linear 7305 STAT3006 X2 mean distribution X1 matrix

STAT3006/7305

Tutorial 1

1. Assume is bivariate normal with mean and covariance matrix

Derive an expression for the marginal distribution of X1 .

2. For the above problem, derive an expression for the conditional distribution of X1 from the bivariate normal, given X2  = 0.

3. If the variates XT   =  [X1  X2  X3] and Y T   =  [Y1  Y2  Y3] are independently and trivariate normally distributed with respective mean and covariance:

 

(a) Determine the distribution of X − Y.    (b) Determine the correlation matrix for X.

(c) Use R (or Python) to determine the correlation matrix for Y. (d) What is the distribution of Y1 and Y2 when Y3 is fixed to 4?    (e) What is the partial correlation of Y1 and Y2 when Y3 is fixed?

4. In introductory statistics courses, you likely encountered rules for the mean and  variance of linear combinations of univariate random variables. Specifically, given random variables X1 and X2 and constants a and b, consider the linear combina-  tion

Y = aX1 + bX2 .

The mean of the linear combination is the linear combination of the means:

E(Y) = aE(X1 ) + bE(X2 )

The variance of the linear combination is as follows:

Var(Y) = a2 Var(X1 ) + b2 Var(X2 ) + 2 ab Cov(X1 , X2 ).

Derive corresponding expressions for the mean and variance of linear combina- tions of arbitrary p-dimensional random variables:  AX + BY.  Do not assume that any of these variables are independent of others.

Hints:  let =  (XY T )T, consider a suitable matrix C and the properties of CZ. Assume E(X) = μX, E(Y ) = μY , Cov(X X) = ΣXX , Cov(Y Y ) = ΣYY , Cov(X Y ) = ΣXY .

5. Simulation, estimation, accuracy and plotting

(a) UseR’smvtnorm package (or similar) to generate 100 (pseudo-)random vec- tors from the distribution for given in the previous question.

(b) Calculate the A matrix (sums of squares and cross-products) and and the maximum likelihood estimate of all the parameters of the corresponding normal model using the data produced above. Use R or Python.

(c) Calculate the Euclidean error for the estimated mean versus the true mean using R or Python.

(d) Calculate the Frobenius norm for the difference between the estimated cor- relation matrix and the true correlation matrix using R or Python..

(e) Try to plot some (e.g. 2 or 3) contours of the marginal distribution (first two dimensions) for the true and estimated distributions, in different colours. Add the data points.

(f) If you had produced e.g. 100,000 random vectors instead, think about how you might reasonably produce a plot similar to the one above.  Implement this method, producing a plot.  Does this method also work well for the original sample size of 100?

 

标签:linear,7305,STAT3006,X2,mean,distribution,X1,matrix
From: https://www.cnblogs.com/vx-codehelp/p/18335265

相关文章

  • LeetCode 756. Pyramid Transition Matrix
    原题链接在这里:https://leetcode.com/problems/pyramid-transition-matrix/description/题目:Youarestackingblockstoformapyramid.Eachblockhasacolor,whichisrepresentedbyasingleletter.Eachrowofblockscontains onelessblock thantherowbenea......
  • 仅将 sympy Matrix 的上三角值从 numpy.triu() 复制到数组中?
    我有一个方阵A(可以是任何大小),我想获取上三角部分并将这些值放入一个数组中,而没有中心对角线下方的值(k=0)。A=sympy.Matrix([[4,0,3],[2,4,-2],[-2,-3,7]])使用A_upper=numpy.triu(A)让我A_Upper=sympy.M......
  • 0054_Spiral-Matrix【M】
    JY:矩阵螺旋式遍历(一圈圈螺旋式、从外到里)参考:0054_Spiral-Matrix【M】·语雀1、基于矩阵4个边界指针实现顺时针顺序一层层遍历,共需遍历math.ceil(min(m,n)/2)圈fromtypingimportList,DictclassSolution:defspiralOrder(self,matrix:List[Lis......
  • 0059_Spiral-Matrix-ii【M】
    JY:矩阵的螺旋遍历相似题:0054_Spiral-Matrix【M】参考:0059_Spiral-Matrix-ii【M】 1、基于4个边界指针参考0054_Spiral-Matrix【M】中的解法2classSolution:defgenerateMatrix(self,n:int)->[[int]]:left,right,top,bottom=0,n-1,0,n......
  • Vova Escapes the Matrix
    做的时候就差如何得出一个点到两个不同的出口的最短路和次短路了啊分类讨论如果图不能到达出口,那么可以把所有'.'都填了如果图只能达到一个出口,那么就是所有'.'的个数减去起点到这个出口的最短路如果图可以到达两个及以上出口,考虑填满陷阱之后,图长成什么样子:此时一定刚好还剩......
  • G. A/B Matrix
    原题链接题解每行有a个,所以总共有\(n\cdota\)个每列有b个,所以总共有\(m\cdotb\)个所以要满足\(na=mb\)想象一下这个场景:每一行,每次往当前列中,最左端的一最少的列的开始连续放置1code#include<bits/stdc++.h>#definelllonglongusingnamespacestd;voids......
  • [LeetCode] 1380. Lucky Numbers in a Matrix
    Givenanmxnmatrixofdistinctnumbers,returnallluckynumbersinthematrixinanyorder.Aluckynumberisanelementofthematrixsuchthatitistheminimumelementinitsrowandmaximuminitscolumn.Example1:Input:matrix=[[3,7,8],[9,11,......
  • manim边学边做--Matrix
    在代数问题中,矩阵是必不可少的工具,manim中提供了一套展示矩阵(Matrix)的模块,专门用于在动画中显示矩阵格式的数据。关于矩阵的类主要有4个:Matrix:通用的矩阵IntegerMatrix:元素是整数的矩阵DecimalMatrix:元素包含小数的矩阵MobjectMatrix:元素可以是图形的矩阵其实IntegerMatrix......
  • 机器学习分类结果精度测定 - 混淆矩阵(Confusion Matrix)
    一、引言机器学习和数据科学中一个经常被忽视,但至关重要的概念是模型评估。你可能已经建立了一个非常先进的模型,但如果没有合适的评估机制,你就无法了解模型的效能和局限性。这就是混淆矩阵(ConfusionMatrix)派上用场的地方。1.1什么是混淆矩阵?混淆矩阵是一种特定的表格布局......
  • [ARC115B] Plus Matrix 的题解
    题目大意给你一个\(n\timesn\)的数组\(C\),\(c_{i,j}=a_i+b_j\),求\(a\)数组与\(b\)数组,不保证有解,其中\(1\len\le500,1\lec_{i,j}\le10^9\),而且\(a_i,b_i\)都是非负整数。\[\begin{bmatrix}a_1+b_1&a_1+b_2&\cdots&a_1+b_{n-1}&a_1+b_n\\a_2+b_......