R code with comments
--
#the function to get the confidence interval
calculate_mean_ci<-function(x,sigma,level){
#get the sample mean
xbar<- mean(x)
#get the sample size
n<-length(x)
#get the significance level
alpha<-1-level/100
#get the critical value
z<- qnorm(1-alpha/2,0,1)
#get the lower limit
lwr<-xbar-z*sigma/sqrt(n)
#get the upper limit
upr<-xbar+z*sigma/sqrt(n)
return(c(lwr,upr))
}
#test the function
x<-c(10,12,14,15,25,9,11,17,18)
calculate_mean_ci(x,5,95)
--
get this
![[1] 11.28895 17.82216](http://img.homeworklib.com/questions/aceb0f80-ebd8-11ea-911f-b15d3e95bef1.png?x-oss-process=image/resize,w_560)
• Write a function calculate_mean_ci(). • The inputs to this function are of the form (x,...
Solve it using matlab and there is an example for a similar
one i put
• Write a function calculate_mean_ci(). The inputs to this function are of the form (x, sigma, level). These are x: a numeric vector. sigma : population standard deviation. level : the confidence level given as a percentage, e.g., 95. • The output is a vector of length two of the form (lwr, upr), where lwr = - 20.025 4 and upr = 1 + 20.025...
·Write a Cl Calculator in MATLAB (function name ci_calc.m). Your function should take four input arguments: σ, x,n, p% Confidence Interval Calculator σ (Std Dev) Sample mean Sample size Confidence level 577.4 37.4556 100 90% Numeric input Numeric input Numeric input Numeric input Lower limit of Cl -57.52 Numeric output Upper limit of Cl 132.43 Numeric output
In 1181:from scipy import stats fron rath import sgrt Confidence Interval For a sample with size large enough, by central limit theorem we can assume its mean follows normal distribution. And if we also know the standard deviation of the population, we are able to calculate a confidence interval to estimate the population mean. Problem 1 A confidence interval is usually given by sample mean m plus and minus a margin of error r The contidence interval is larger (less...
8. Write a MATLAB function that will take as inputs a set of data (x,y) and output the best estimate of the integral using a Romberg Array. The function should perform two trapezoidal integrations using the full interval and half the interval, and then combine these integrations in a Romberg Array. Your function should also output the relative error of the integral. Please note that the data entered may not be evenly spaced and your function should make sure that...
Use Mat Lab to write a function called forwarddiff.m that takes data sample locations and function samplings at those locations as inputs and returns an approximation of the derivative at the sample points based on forward finite difference method with order of accuracy O(h^3). The function should display nothing to the screen unless an error or warning occurs. The detailed specification is as follows: The approximation of derivative by forward difference method (for O(h^3) is given as: f' (x_1) =...
MATLAB QUESTION Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when called, it gives control to the user and asks the user to input a length-3 vector. Then the function prints: The sum of ___, ____, and ____ is ____. [new line] where the first three blanks are filled by each element in input vector, and the last blank is the sum of all three elements.
6. Write a function with two inputs x and y and one output z. If x = y, then the output should be z = 2x + y and if x >y then the output is z= x - y. test the result for (a) x=10, y = -2 (b) x = 5, y=6 Mathish
Questions a) Write a (Matlab) function, which accepts the following inputs: -the finite set of Fourier series coefficients a-N, a-N+1,.. , a-1, ao, a1, aN-1, aN the fundamental period T of the signal to be reconstructed a vector t representing the times for which the signal will be constructed - and produces as output xv(t) (i.e., the output of the (Matlab) function should be a vector x of length equal to the length of t containing the values of xN...
SHORT ANSWER. Write the word or phrase that best comple tes each statement or answers the question. Use the given information to find the minimum sample size required to estimate an unknown population mean 7) Margin of error: $135, confidence level: 95%, σ-S500 MULTIPLE CH OICE. Choose the one alternative that best completes the statement or answers the question. Use the given degree of confidence and sample data to construct a confidence interval for the population mean μ Assume that...
Write a function called calc_crown_area that will receive pairs of lengths of radii as input arguments, and will return the areas of the crowns. The function should work when: • the inputs are a pair of single values, i.e. one scalar for the inner radius and one scalar for the outer radius. In this case, the function will return one single output for the area. • the inputs are a pair of vectors, i.e. one vector of inner radii (R1)...