Write a function in R to perform the linear regression

Assignment Help Basic Statistics
Reference no: EM132583612

Questions -

Question 1 - Write a function in R to perform the linear regression. You are not allowed to use any linear regression specific functions or any package. Your function should take two inputs namely Y vector and the design matrix X. You need to apply your custom-built function on the following data:

n = 20

X1i = rnorm(n, 10, 2)

X2i = rbeta(n, 2, 3)

Y = -2 - 3*X1i + 4*X2i + rnorm(n)

Also, apply this function on the data data_for_problem_1.xlsx to predict PCB using THICKNESS. Perform the residual analysis to validate the working of your function.

Question 2 - Write a function from scratch which can perform the t-testing for any data (i.e. one-sample, two samples etc. ) in R. This function should mimic the base function t.test(). Use your function to perform t-testing on the following simulated data:

# simulate the data

xi1 = rnorm(20, 3, sqrt(9))

xi2 = 2*xi1

You are not allowed to use any R-package for these task.

Reference no: EM132583612

Questions Cloud

What are the prospects of futures contracts : What are the prospects of futures contracts as a significant risk management tool for firms? Discuss critically
Compute value for fields A : Assuming XA ~ N(200, 202) and XB ~ N(100, 402). Find the following: Compute P90A value for fields A defined as P[XA > P90A] = 0.9
Principles of finance and accounting to healthcare outcomes : Apply principles of finance and accounting to healthcare outcomes, reimbursements, and business operations.
Prepare financial budget : Prepare a financial budget that supports improved business and patient outcomes.
Write a function in R to perform the linear regression : Write a function in R to perform the linear regression. You are not allowed to use any linear regression specific functions or any package
Finance-economics in management of health systems : Compare and contrast the role of finance and economics in the management of health systems in the U.S. and international markets.
Calculate the harmonic mean of two numbers : Calculate the harmonic mean of two numbers x and y is using the expression and calculate and display their harmonic mean in dddd.dd format.
Develop population health plan : Develop a population health plan to address a health concern in the current healthcare industry.
Categorical-hierarchical and relational : Categorical: Comparing categories and distributions of quantities values, Hierarchical: Charting part-to-whole relationships and hierarchies

Reviews

Write a Review

Basic Statistics Questions & Answers

  What is the? student''s weighted mean grade point? score

A student receives the following? grades, with an A worth 4? points, a B worth 3? points, a C worth 2? points, and a D worth 1 point.

  What is the union of the two events

Consider the event that a player scores a point in a game against team A and the event that the same player scores a point in a game against team B.- What is the union of the two events? What is the intersection of the two events?

  Calculate different number systems

Design a digital combinational circuit which compares two 2-bit binary numbers and produces results using a 2-bit binary number (please see the block diagram below). The output Z1Z0 depends on the inputs A1A0 and B1B0 according to the following c..

  Find the probability that the number of college students

Find the probability that the number of college students who say they use credit cards because of the rewards program is (a) exactly two (b) more than two and (c) between two and five inclusive. (round to the nearest thousandth as needed)

  Counting the number of combinations

In his wardrobe at home, a businessman has 7 suits and 8 ties. From those suits and ties he has on hand, he plans to take 3 of the 7 suits and 2 of the 8 ties with him to a conference in San Francisco.

  National financial capability challenge exam

High school students across the nation compete in a financial capability challenge each year by taking a National Financial Capability Challenge exam.

  Color preferences of new car buyers

A researcher wishes to conduct a study of the color preferences of new car buyers. Suppose that40%'>40%40% of this population prefers the color black

  Correlation coefficient between standardized variables be

Describe the relationship between the Housing Cost Index and the Median Family Income by state.- If we standardized both variables, what would the correlation coefficient between the standardized variables be?

  Calculate as standard error of number of undersized corks

If he were to randomly select 120 corks from the next box, then how many of these corks would John expect to be undersized?

  Find the minimum amount for investment a

For example, the minimum amount for investment A might be $0, whereas the minimum amount for investment D might be $50,000.

  Which scientists trashed the public

Refer to the survey described in Example, "Which Scientists Trashed the Public?".

  Percentile of sampling distribution of the mean

Traffic at the airport changed recently, and you collected 36 weeks of data in an effort to estimate the new rate of tire replacements.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd