R feedback - R Feedback Instructor: Simin Seury [Please...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: R Feedback Instructor: Simin Seury [Please note: The following only clarifies about the common mistakes in your assignment, so that you do not do this mistakes again] ## Q1 # Stest has 3 entry, 1st one is your marks from Test-1, 2nd and 3rd entries are expected marks from Test 2 and Test 3 respectively > Stest = c(60, 70, 80) # adding all 3 marks > sum(Stest) [1] 210 # common mistakes were: not denoting the variable as Stest, not using sum command in the way it would work etc. # notice if you only used R as the way calculator works, i.e. using "+" "=" signs, etc., that was fine as well ##Q2 # assume expected marks from final exam = 80 # assume Midterms mark is 60 # assume 20% of Surprise test, ST20 is 15 # assume 30% of Surprise test, ST30 is 20 > EFIN = c(80) > MID = c(60) # Option1 20% *(Class Tests) + 30% *(Midterm) + 50% *(Final) > ST20 + 0.30*MID + 0.50*EFIN [1] 73 # Option2 30% *(Class Tests) +20% *(Midterm) + 50% *(Final) > ST30 = c(20) > ST30 + 0.20*MID + 0.50*EFIN [1] 72 ##Q3 # this questions tests if you know how to read data in R. As we have discussed and shown in class, an easy way is to read in a delimited text file with the read.table command. #R will read in a variety of delimited files. (For all the options associated with this command type ?read.table in R.) # Remember you will have to specify the location of the file yourself depending on where you have it saved # if you only copied the "hsb2... csv" command from posted Rnotes, it shows that you missed R-lectures in class and/or never tried to run R by yourself at all and/or did not understand that it is a command to read files from the internet, not to read a file saved in your C drive #here is an example how you import data: >T1 = read.table("C:/Econ2500/Data/BestG.txt", header=TRUE, na="NA") #The header option specifies whether the first line of the file contains the names of the variables ##Q4 # by default missing values are output as NA in R # you need to enter "N/A" responses either as "NA" or as missing value # you can even type "?Na" and you will get help # there was another way about reading data in excel, creating extra two columns, transferring the data into txt.file and reading in R again, to use "length" command # again, if the assignment shows that the student did not write any reasonable answer, it reflects s/he did not follow the ways suggested in lecture and/or never tried to run R and/or never even tried to understand it in Excel # another way it to create a variable Misc like following: > Misc = c(BestG=NA) > length(Misc) [1] ** # where ** are your missing values or N/A responses ##Q5 # please read lecture slides and relevant sections of the textbook #Q6 cor(Stest1, BestG) ##Q7 # use dbinom with detailed explanation ##Q8 # please see lecture slides and relevant sections of the textbook. this should a neat graph clearly showing the percentage area with proper labeling (in the exam you will loose marks if the graph is not proper) ...
View Full Document

Ask a homework question - tutors are online