Enable contrast version

Tutor profile: Jordan U.

Inactive
Jordan U.
Bioinformatics Researcher at UCLA
Tutor Satisfaction Guarantee

Questions

Subject:R Programming

TutorMe
Question:

Write a function, called mean_replace that takes a vector and replaces all the missing values with the mean of the vector and returns the new vector. For example, an input of $$[4, 6, 2, 1, 10, 9, NA, 3, NA]$$ should return $$[4, 6, 2, 1, 10, 9, 5, 3, 5].$$

Inactive
Jordan U.
Answer:

When tackling a problem like this, it is important to break it down and think about the individual components that you will to solve the problem at hand. For this problem in particular, we would need two things: 1) the average (mean) of all the non-missing values of the given vector. 2) the indices of the missing values that we need to replace. The nice thing about R is that it has many built in function that we can use to solve this problem. R has a $$mean()$$ function that returns the average, given a vector. However, because our vector has missing values, we must not forget the optional argument $$na.rm = T$$, which tells the $$mean()$$ function to ignore $$NA$$ values. For example, if our vector is called $$x$$, the mean can simply be found by $$mean(x, na.rm = T)$$. Another helpful function for this problem is the $$is.na()$$ function, which can take a vector and return a boolean vector, that has TRUE where the values of the vector are $$NA$$ and FALSE where the values of the vector are not $$NA$$. So putting it all together, we can write the mean_replace function as follows, mean_replace <- function(x) #function declaration #you can pass in as many parameters as you want, separated #by commas, but for this problem, we just need 1 (the vector x). { x[is.na(x)] = mean(x, na.rm = T) #in R, '[ ]' is used to index vectors #x[is.na(x)] will reference all the elements of x that are NA #these values will be replaced by the mean of x x #this line is needed to return the updated vector }

Subject:Calculus

TutorMe
Question:

Consider the equation, $$f(x) = 4x^2- 9x + 3$$, and answer the following questions. a) Is the functions increasing or decreasing at x = - 1? b) Is the function increasing or decreasing at x = 2? c) Find the critical point(s) of this function.

Inactive
Jordan U.
Answer:

Evaluating the derivative of a function at different points can tell us a lot about the function's behavior. So to answer the questions, we will start by taking the derivative (denoted by $$f'(x)$$) of the given function, $$f(x) = 4x^2-9x+3$$ $$f'(x) = 2(4)x^{2-1} -1(9)x^{1-1} = 8x - 9$$ a) Plugging values directly into the derivative of a function will allow you to determine the rate of change of the function at that specific point. So plugging x = -1 into the derivative equation, $$f'(x) = 8x - 9$$ $$f'(-1) = 8(-1) - 9 = - 8 - 9 = - 17$$ Since $$f'(-1)$$ is negative, the function $$f(x) = 4x^2 - 9x + 3$$ is decreasing at x = - 1. b) Similar to part a, plugging x = 2 into the derivative equation, $$f'(x) = 8x - 9$$ $$f'(2) = 8(2) - 9 = 16 - 9 = 7$$ Since $$f(2)$$ is positive, the function $$f(x) = 4x^2 - 9x + 3$$ is increasing at x = 2. c) A critical point of an equation is a point at which the function is neither increasing or decreasing. In other words, it is where the rate of change is 0 so by setting our derivative equation equal to 0 and solving for x, we can find the critical point(s) of the function. $$f'(x) = 8x - 9 = 0$$ $$8x - 9 = 0$$ $$8x = 9$$ $$x = \frac{9}{8}$$ Thus, a critical point of the function $$f(x) = 4x^2 - 9x + 3$$ occurs at $$x = \frac{9}{8}$$. To find the y-value of the critical point, we can plug $$x = \frac{9}{8}$$ into the function, $$f(\frac{9}{8}) = 4(\frac{9}{8})^2 - 9(\frac{9}{8}) + 3 = 4(\frac{81}{64}) - \frac{81}{8} + 3 = \frac{81}{16} - \frac{162}{16} + \frac{48}{16} = -\frac{33}{16}$$ Therefore, $$(\frac{9}{8}, -\frac{33}{16})$$ is a critical point of the function $$f(x) = 4x^2 - 9x + 3$$.

Subject:Statistics

TutorMe
Question:

What is the difference between a Type l error and a Type ll error?

Inactive
Jordan U.
Answer:

Statistical Hypothesis testing requires the formulation of an unambiguous statement known as the null hypothesis ($$H_0$$), and is essentially the opposite of your hypothesis ($$H_A$$). For example, if a research team is hypothesizing that shorter people live longer, their hypotheses might be as follows: $$H_A$$: Shorter people tend to live longer. $$H_0$$: Height does not contribute to life expectancy. After data collection and statistical analyses, the research team may reach a conclusion, however, it is important to remember that statistical hypothesis testing conclusions can never be made with 100% certainty. Because of this, statisticians have devised ways to categorize the different types of errors that may occur. While the chances of these errors occurring are small, it is still important to recognize them. Type l Error (False Positive): A Type l Error occurs when there is an incorrect rejection of a true null hypothesis. In the example, a Type l Error would be if the researchers concluded that short people do tend to live longer (rejecting null hypothesis) when in reality, height does not play a role in life expectancy (null hypothesis is true). Type ll Error (False Negative): A Type ll Error occurs when there is an incorrect acceptance of a false null hypothesis. In the example, a Type ll Error would be if the researchers concluded that height does not contribute to life expectancy (accepting null hypothesis) when in reality, short people do tend to live longer (null hypothesis is false).

Contact tutor

Send a message explaining your
needs and JORDAN will reply soon.
Contact JORDAN

Request lesson

Ready now? Request a lesson.
Start Lesson

FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.
BEST IN CLASS SINCE 2015
TutorMe homepage
Made in California by Zovio
© 2013 - 2021 TutorMe, LLC
High Contrast Mode
On
Off