# Tutor profile: Sunil D.

## Questions

### Subject: R Programming

How do I read in an excel spreadsheet into R and perform a t-test between two groups. The excel has one column specifying the type of car ("ford" or "tesla") and another column giving it's maximum speed. The data previewed looks like this: company max_speed ford 122 ford 127 ford 127 tesla 120 tesla 115 tesla 127

I'm going to list what is being done on the line after step x: Then I'm going to give you the relevant R code below that step to execute what is stated. Step 1: Read in the csv file using the read.csv command data = read.csv("name_of_your_file.csv") Step 2: Separate the max_speed values based on company name tesla = data$max_speed[ which(data$company == "tesla") ] ford = data$max_speed[ which(data$company == "ford") ] Step 3: Perform the t-test based on these values t.test(tesla,ford) The t.test command will print to the screen important statistics from the test such as the p-value. In this particular example the p-value was 0.4042 meaning that there is no significant difference between the max speeds of the two groups.

### Subject: Calculus

Find the local minima of the function: $$ f(x) = x^{3} - 3x$$.

When asked to find minimas or maximas of a function, the first step you should perform is to find the derivative of the function, set it equal to 0, and solve for x, like so: $$ f'(x) = 3x^{2}-3 = 0 $$ $$ 3(x+1)(x-1) = 0 $$ $$ x = 1 $$ or $$ x = -1 $$ We now have two potential candidates as local extrema (local maxima or local minima), but how do we determine which of these are maxima/minima? We do this by plugging in our two candidates into the second derivative of the function like so: $$ f''(x) = 6x $$ $$ f''(1) = 6 $$ $$ f''(-1) = -6 $$ Rules: If the second derivative is positive when evaluated at the value , it is a local minima If the second derivative is negative when evaluated at the value , it is a local maxima Note: A way to remember this is that it's the opposite of what you would think. You would think a maxima would be at the largest value (a positive value) of the 2nd derivative, but it's the opposite. A maxima is at a negative value of the 2nd derivative. Using the above two rules it is easy to see that $$x=1$$ is a minima and $$x=-1$$ is a maxima and so the answer to the question is that $$x=1$$ is the local minima of the function.

### Subject: Statistics

An unfair coin is tossed 10 times with the probability of head being 0.6. What is the probability of getting exactly 3 heads?

The number of successful outcomes (success being heads in this case) can be modeled with a binomial distribution. $$ P(X = k) = {n \choose k} p^{k}(1-p)^{n-k}$$ Where n is the number of trials (10 in our case) and k is the number of successes (3 heads) and p is the probability of success (p=0.6). Using our formula to evaluate we have: $$ P(X = 3) = {10 \choose 3} (0.6)^{3}(1-0.6)^{10-3} = 120*(0.6)^{3}(0.4)^{7} = 0.04246733 $$ A way to think about this solution is that suppose we got 3 heads on the first 3 tosses of the coin and then 7 tails. The probability of this happening is $$ (0.6)^{3}(0.4)^{7} = 0.0003538944$$. But notice that this is only one way of achieving 3 heads and 7 tails. We could have gotten 7 tails on the first 7 tries and then 3 heads which would have also satisfied our requirements of having 3 heads and 7 tails out of the 10 tosses. As a matter of fact there are $$ {10\choose3} = 120 $$ ways of attaining our desired outcome and that is why we multiply the probability of a getting a single successful outcome $$ (0.6)^{3}(0.4)^{7} $$ by 120.

## Contact tutor

needs and Sunil will reply soon.