Tutor profile: Ron S.
Subject: R Programming
What are the steps to build a linear regression model in R?
Step 1: Load the data. You can use any data with at-least two columns of information which should ideally be related with each other. Say one column gives the information of the years of education ("education") and the second column gives information about wages ("wages"). Here, you can create a regression model where "wages" is the dependent variable which you want to predict using the independent variable, "education". Let us call the data frame which contains these two columns as "df". I can email example data-sets to you for practice. Step 2: Create the regression model. $$model <- lm(wages~education, data=df)$$ #here lm stands for linear models $$summary(model)$$ This first function will create the regression model and the second function will give you the basic information relating to the regression model such as the coefficients, standard error, t-value, p-value, R-squared, adjusted R-squared, F-Statistic etcetera. Step 3: Create a least squares regression line on a scatter plot $$install.packages("ggplot2")$$ #This installs the package ggplot2 from the internet $$library(ggplot2)$$ #This applies the package ggplot2 into the current session $$ggplot(data=df, aes(x=education, y=wages)) + geom_point() + geom_smooth(method = lm, fill=NA)$$ This will create the required scatter plot with the least squares regression line between education and wages.
Of the 100 toys in a container, 15 are defective. An inspector will select 3 toys simultaneously and randomly from the container. What is the probability that neither of 3 toys are defective? Give your answer as a fraction.
This is a 'hard' level question in GRE. Therefore, you can take up-to 3 minutes to answer it (depending upon time left and other factors). Remember, no more than 3 minutes! Now moving on to the question. Step 1: Let us take one toy at a time. What is the probability of selecting a non-defective toy from a container of 100 toys? Simple! Just divide the number of non-defective toys with the total number of toys. (100-15)/100 = 85/100 = 0.85 This means, if a single toy is selected at random from the container, there is an 85% probability that the toy is not defective. Step 2: Now, let us select another toy from the same container and check its probability. What is the probability of selecting a non-defective toy from the container after one toy has already been taken out? Just divide the number of REMAINING non-defective toys with the total number of REMAINING toys. Basically you have to calculate using the same formula as above with 1 subtracted from both numerator and denominator. 1 is subtracted simply to factor in the toy already selected in Step 1. 84/99 = 0.848 Step 3: Calculate the probability of selecting a non-defective toy from the container after 2 toys have already been selected. 83/98 = 0.846 Step 4: Finally, calculate the probability that NEITHER of the 3 selected toys are defective. You have to simply multiply the solutions found in steps 1, 2 and 3. You're going to have to use the on-screen calculator for the same. 0.85 * 0.848 * 0.846 = 0.6101 This means that there is a 61% probability that the inspector will select 3 toys that are non-defective.
If unemployment is rampant in the agricultural sector of my country, is it considered to be disguised unemployment or seasonal unemployment or both?
There can be many forms of unemployment occurring simultaneously within a single sector of an economy. So while a person who was made redundant in her job and is in the process of searching for another is considered frictionally unemployed, another person who has taken an early retirement and voluntarily decided not to work is considered voluntarily unemployed (surprise!). Similarly, within the agricultural sector, farmers can be both disguisedly unemployed and seasonally unemployed. To give an example, disguised unemployment occurs when there are 10 farmers working in a field producing an output which could’ve been easily produced by 5 farmers as well. Thus, the 5 'extra' farmers, without whom the produce would be the same will be considered as disguisedly unemployed. Now if all of these 10 farmers have no work to do during the lean season, then all 10 would be seasonally unemployed. As you can see, a single farmer can be both seasonally and disguisedly unemployed in different circumstances.
needs and Ron will reply soon.