Using R Studio,
Generate a standard normal random. using rnorm()
Check whether this number is >1.96 or <-1.96.
Replicate this 1000 times and count the number of observations that are greater than 1.96 or less than -1.96.
Calculate the ratio of this number to the the number of replications and see whether this is close to 0.05.
HINT:
num <- 0
for (i in 1 : 1000) {
a <-
}
num/1000
To generate standard normal variable
rnorm(1,0,1)
[1] -0.5811594
The number is not >1.96 or <-1.96
Replication
num <- 0
for (i in 1 : 1000) {
a=rnorm(1,0,1)
if(a>1.96||a<(-1.96))
{num=num+1}
}
num
[1] 53
There are 53 observations <-1.96 or
> 1.96
Required ratio
num/1000
[1] 0.053
The number is close to 0.05
Using R Studio, Generate a standard normal random. using rnorm() Check whether this number is >1.96...
pick a number for mean and standard deviation generate 5 random numbers using a normal distribution and mean and standard deviation from (i) using your 5 numbers find the mean and the standard deviation of your data How far is your sample mean from your true mean? By 'far' I mean how many sample standard deviations. use the absolute value of distance here Repeat steps 2-4 1000 times. you should now have 1000 measures how far your sample mean is...
R studio #Exercise : Calculate the following probabilities : #1. Probability that a normal random variable with mean 22 and variance 25 #(i)lies between 16.2 and 27.5 #(ii) is greater than 29 #(iii) is less than 17 #(iv)is less than 15 or greater than 25 #2.Probability that in 60 tosses of a fair coin the head comes up #(i) 20,25 or 30 times #(ii) less than 20 times #(iii) between 20 and 30 times #3.A random variable X has Poisson...
In R, Part 1. Learn to understand the significance level α in hypothesis testing. a) Generate a matrix “ss” with 1000 rows and 10 columns. The elements of “ss” are random samples from standard normal distribution. b) Run the following lines: mytest <- function(x) { return(t.test(x,mu=0)$p.value) } mytest(rnorm(100)) Note that, when you input a vector in the function mytest, you will get the p-value for the one sample t-test H0 : µ = 0 vs Ha : µ =/= 0....
Please write a JAVA program according to following
requirement. Thanks
Part 2 -Arrays We can use the Math.random method to generate random integers. For example, Math.random () generates a random integer greater than or equal to 0 and less than 1. The expression Math. random) 6generates random numbers between 0 and 5, simulating the throw of a die. In this lab assignment, you will use an array to test whether the random generator is fair; that is, whether each possible...
Rules to follow are:Declare an array with 1000 elements of type intThen in a loop generate 1000 random numbers and assign one to each element in the arrayThe random numbers should be between 1 and 50do not use rand or srand, use code is providedThen, prompt the user to enter a number, store this number in a local variable, the number should be safety checked using the GetInteger() functionThen, iterate through the array and determine how many times the user's...
Using RStudio, Create an R-Script: (1) You will generate a numeric matrix of size 21 by 21 and will name it tmp. To do so, draw 21×21 = 441 random observations from the standard normal distribution. Before doing so, set the seed for the random number generator to 37. See help for set.seed(). (2) Change the diagonal elements of tmp to 1s. (3) Calculate condition number of tmp. See help for cond(). (4) Calculate the inverse of tmp. See help...
Using RStudio, Create an R-Script: (1) You will generate a numeric matrix of size 21 by 21 and will name it tmp. To do so, draw 21×21 = 441 random observations from the standard normal distribution. Before doing so, set the seed for the random number generator to 37. See help for set.seed(). (2) Change the diagonal elements of tmp to 1s. (3) Calculate condition number of tmp. See help for cond(). (4) Calculate the inverse of tmp. See help...
Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive integer numbers from 1 to 999 (lottery numbers) and takes a single input from the user and checks the input against the 15 lottery numbers. The user wins if her/his input matches one of the lottery numbers. Your implementation must have a level of modularity (using functions) Functions you need to implement: Define function initialize() that takes array lotterNumbers[] as a parameter and assigns...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace FileWriter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCreate_Click(object sender, EventArgs e)
{
try
{
//write code that assigns the value in the textbox to an Integer
variable
if // write code that validates whether or not the data entered in
the textbox is greater than or equal to 1 *...
python code for guessing game users enter the number the computer
will guess
8:38 PM 100 nstructure.com 1. Number guessing game : (5 points) 1) Requirements: Your program will ask the user to enter a number between 1 and 1000. Then it will try to guess the correct number with the guaranteed minimal average number of guesses. Which search algorithm should you use? 2) Expected Output: Enter a number between 1 and 1000? 784 Computer guesses: 500 Type 'l' if...