Question

In: Computer Science

R programing question Generate two vectors x and y of length B=10000 so that each of...

R programing question

Generate two vectors x and y of length B=10000 so that each of the entries is independent, with Xi ~ N(0,1) and Yi ~ N(1,4) for i=1,2,...,10000

Solutions

Expert Solution

ANSWER:

Given that,

length B=10000 // that each of the entries is independent, with Xi ~ N(0,1) and Yi ~ N(1,4) for i=1,2,...,10000

R programing,

B=10000

x=rnorm(B)

y=rnorm(B,1,4)

hist(x,main=“Histogram of x”)

hist(y,xlim=c(-15,15),main="Histogram of y")

Explanation of the R programing:----

Ø Here B is sample size that is 10000

Ø X=rnorm(B) means x is a vector of sample size B from normal distribution with mean=0 and variance=1

Ø y=rnorm(B,1,4) means y is a vector of sample size B from normal distribution with mean=1 and variance=4

Ø hist(x,main=“Histogram of x”) is histogram of x

Ø hist(y,xlim=c(-15,15),main="Histogram of y") is histogram of y

Generate two vectors x and y:

> B=10000

> x=rnorm(B)

> y=rnorm(B,1,4)

> hist(x,main=“Histogram of x”)

> hist(y,xlim=c(-15,15),main="Histogram of y")

Here Histogram of x is centered at zero whereas Histogram of y is centered at 1.

Spread of histogram of y is greater than that of x because for x variance is 1 and that of y is 4 therefore as variance increases spread increases.


Related Solutions

Let R[x, y] be the set of polynomials in two coefficients. Prove that R[x, y] is...
Let R[x, y] be the set of polynomials in two coefficients. Prove that R[x, y] is a vector space over R. A polynomial f(x, y) is called degree d homogenous polynomial if the combined degree in x and y of each term is d. Let Vd be the set of degree d homogenous polynomials from R[x, y]. Is Vd a subspace of R[x, y]? Prove your answer.
a. Generate a model for y as a function of x b. Is this model useful?...
a. Generate a model for y as a function of x b. Is this model useful? Justify your conclusion based on i) R2 adjusted, ii) Hypothesis test for model coefficient, iii) overall model adequacy test and iv) regression assumptions c. If needed, modify model as appropriate and generate the new model. Highlighted the parts that I need most. Please be detailed with explanation and use Excel. Thank you. x y 5 6 6 9 7 11 8 13 9 14...
Each of the following vectors is given in terms of its x- and y-components.
Each of the following vectors is given in terms of its x- and y-components.Part Avx = 23 m/s , vy = 45 m/s . Find the vector's magnitude.Part Bvx = 23 m/s , vy = 45 m/s . Find the vector's direction.Part Cax = 9.0 m/s2 , ay = -3.5 m/s2 . Find the vector's magnitude.Part Dax = 9.0 m/s2 , ay = -3.5 m/s2 . Find the vector's direction
3. (a) Using x, y, z vectors of each atom in a SO2molecule to derive the...
3. (a) Using x, y, z vectors of each atom in a SO2molecule to derive the reducible representation (assuming that the principle axis is collinear with the z axis and the molecule is lying on the xz plane). (b) Classify the irreducible representations into translational, rotational, and vibrational modes. (c) Which vibrational modes are infrared active. (d) Sketch the three vibrational modes including the symmetric stretch, antisymmetric stretch, and symmetric bend. (e) The calculated IR spectrum of SO2show three peaks...
Consider walks in the X-Y plane where each step is R: (x, y)→(x+1, y) or U:...
Consider walks in the X-Y plane where each step is R: (x, y)→(x+1, y) or U: (x, y)→(x, y+a), with a a positive integer. There are five walks that contain a point on the line x + y = 2, namely:  RR, RU1, U1R, U1U1, and U2. Let a_n denote the number of walks that contain a point on the line x + y = n (so a_2 = 5). Show that a_n = F_{2n}, where F_n are the Fibonacci numbers...
If X, Y and Z are three arbitrary vectors, prove these identities: a. (X×Y).Z = X.(Y×Z)...
If X, Y and Z are three arbitrary vectors, prove these identities: a. (X×Y).Z = X.(Y×Z) b. X×(Y×Z) = (X.Z)Y – (X.Y)Z c. X.(Y×Z) = -Y.(X×Z)
Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are row vectors of equal length and that c and d are scalars.
Write a MATLAB assignment statement for each of the following functions, assuming that w, x, y, and z are row vectors of equal length and that c and d are scalars.
Determine whether each statement is true or false, and prove or disprove, as appropriate. (a) (∀x∈R)(∃y∈R)[xy=1].(∀x∈R)(∃y∈R)[xy=1]....
Determine whether each statement is true or false, and prove or disprove, as appropriate. (a) (∀x∈R)(∃y∈R)[xy=1].(∀x∈R)(∃y∈R)[xy=1]. (b) (∃x∈R)(∀y∈R)[xy=1].(∃x∈R)(∀y∈R)[xy=1]. (c) (∃x∈R)(∀y∈R)[xy>0].(∃x∈R)(∀y∈R)[xy>0]. (d) (∀x∈R)(∃y∈R)[xy>0].(∀x∈R)(∃y∈R)[xy>0]. (e) (∀x∈R)(∃y∈R)(∀z∈R)[xy=xz].(∀x∈R)(∃y∈R)(∀z∈R)[xy=xz]. (f) (∃y∈R)(∀x∈R)(∃z∈R)[xy=xz].(∃y∈R)(∀x∈R)(∃z∈R)[xy=xz]. (g) (∀x∈Q)(∃y∈Z)[xy∈Z].(∀x∈Q)(∃y∈Z)[xy∈Z]. (h) (∃x∈Z+)(∀y∈Z+)[y≤x].(∃x∈Z+)(∀y∈Z+)[y≤x]. (i) (∀y∈Z+)(∃x∈Z+)[y≤x].(∀y∈Z+)(∃x∈Z+)[y≤x]. (j) (∀x,y∈Z)[x<y⇒(∃z∈Z)[x<z<y]].(∀x,y∈Z)[x<y⇒(∃z∈Z)[x<z<y]]. (k) (∀x,y∈Q)[x<y⇒(∃z∈Q)[x<z<y]].(∀x,y∈Q)[x<y⇒(∃z∈Q)[x<z<y]].
a) Calculate the x- and y-components of the following two force vectors: F1 = 200 Newtons...
a) Calculate the x- and y-components of the following two force vectors: F1 = 200 Newtons @ 30°, F2 = 100 Newtons @ 135° b) What is the magnitude & direction of the resultant vector: R = F1 + F2 3. A football is kicked on a horizontal field at an angle of 40° and a speed of 27 m/sec. a) What are the horizontal & vertical components of the initial velocity? b) Using just your answer for part a,...
Let A be an m x n matrix and b and x be vectors such that...
Let A be an m x n matrix and b and x be vectors such that Ab=x. a) What vector space is x in? b) What vector space is b in? c) Show that x is a linear combination of the columns of A. d) Let x' be a linear combination of the columns of A. Show that there is a vector b' so that Ab' = x'.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT