Question

In: Statistics and Probability

Complete the R code using Rstudio so that it calculates and returns the estimates of β,...

Complete the R code using Rstudio so that it calculates and returns the estimates of β, the intercept and regression weight of the logistic regression of approximate GPA on Rouder-Srinivasan preference.

## Data
Preference <- c(  0,   0,   0,   0,   0,   1,   1,   1,   1)  # 0: Rouder; 1: Srinivasan
GPA        <- c(2.0, 2.5, 3.0, 3.5, 4.0, 2.5, 3.0, 3.5, 4.0)
Count      <- c(  4,   5,  21,  22,   8,   2,   1,   4,   7)

# Define the deviance function
deviance <- function(beta) {
   ... complete this ...
}

## Test the function
deviance(c(0,1))

## Estimate
optim(c(0, 1), deviance)$par

Solutions

Expert Solution

The attach images details solution solved in R-studion software given below.

1.

2.

Conclusion:

Null Deviance:         12.37 
Residual Deviance: 2.558e-09 

Lower the value of AIC=6 better the model

Deviance is a measure of goodness of fit of a model. Higher numbers always indicates bad fit. The null deviance shows how well the response variable is predicted by a model that includes only the intercept (grand mean) where as residual with inclusion of independent variables


Related Solutions

***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
***This problem must be done using R so please provide the R code used to find...
***This problem must be done using R so please provide the R code used to find the solution. I have provided the data in data-wtLoss.txt below the question. I will also give "thumbs-up for correct R code" Thanks in advance.*** The file “data-wtLoss.txt” contains data on weight loss and self esteem evaluation at three time points over a period of three months for 34 individuals who are randomly selected from a residential area. These individuals are randomly assigned to one...
What is the code in Rstudio or R? (a) Generate 200 random samples of size n...
What is the code in Rstudio or R? (a) Generate 200 random samples of size n = 10 from a Poisson distribution with mean λ = 12. i. Calculate sample means for each sample. Report the first 10 sample means. ii. Draw a histogram of the sample means (where the y-axis is the density) and fit a density estimate (default density estimator is ok). iii. What is your finding about the sampling distribution of the sample mean, based on your...
RStudio R-Programming Statistics Problem - power.t.test and p-values *I believe we're expected to write code using...
RStudio R-Programming Statistics Problem - power.t.test and p-values *I believe we're expected to write code using for loops? Any guidance will help! 4. For this problem, you will run a simulation to investigate how violating the assumption of normally distributed data can affect the properties of a t-test. a. The gamma distribution is skewed to the right. It contains a parameter called “shape”. The R function for generating data from a gamma distribution is rgamma – you can read the...
Complete the code so that it can convert the date to day of week using python,...
Complete the code so that it can convert the date to day of week using python, the code should pass the doctest def convert_datetime_to_dayofweek(datetime_string): """ This function takes date in the format MON DAY YEAR HH:MM(PM/AM) and returns the day of the week Assume input string is UTC    >>> convert_datetime_to_dayofweek('Jun 1 2005 1:33PM') 'Wednesday' >>> convert_datetime_to_dayofweek('Oct 25 2012 2:17AM') 'Thursday' """ # code goes here
Problem 3 Write code in R or Rstudio (Programming) A prime number is an integer greater...
Problem 3 Write code in R or Rstudio (Programming) A prime number is an integer greater than one whose only factors are one and itself. For example, the first ten prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A twin prime is a prime that has a prime gap of two. Sometimes the term twin prime is used for a pair of twin primes. For example, the five twin prime pairs are (3, 5),...
This question requires using Rstudio. This is following commands to install and import data into R:...
This question requires using Rstudio. This is following commands to install and import data into R: > install.packages("ISLR") > library(ISLR) > data(Wage) The required data installed and imported, now this is description of the data: This dataset contains economic and demographic data for 3000 individuals living in the mid-Atlantic region. For each of the 3000 individuals, the following 11 variables are recorded: year: Year that wage information was recorded age: Age of worker maritl: A factor with levels 1. Never...
This question requires using Rstudio. This is following commands to install and import data into R:...
This question requires using Rstudio. This is following commands to install and import data into R: > install.packages("ISLR") > library(ISLR) > data(Wage) The required data installed and imported, now this is description of the data: This dataset contains economic and demographic data for 3000 individuals living in the mid-Atlantic region. For each of the 3000 individuals, the following 11 variables are recorded: year: Year that wage information was recorded age: Age of worker maritl: A factor with levels 1. Never...
This question requires using Rstudio. This is following commands to install and import data into R:...
This question requires using Rstudio. This is following commands to install and import data into R: > install.packages("ISLR") > library(ISLR) > data(Wage) The required data installed and imported, now this is description of the data: This dataset contains economic and demographic data for 3000 individuals living in the mid-Atlantic region. For each of the 3000 individuals, the following 11 variables are recorded: year: Year that wage information was recorded age: Age of worker maritl: A factor with levels 1. Never...
Assignment 1 - IN PDF FORMAT Using R and Rstudio Pick a database from: data() Then...
Assignment 1 - IN PDF FORMAT Using R and Rstudio Pick a database from: data() Then preview the first 10 rows. Print the number of rows and columns - Print the names of the variables If you have row names, print them - work with the values for a field in your dataset. You can do it by dataset[[xx]] operator with xx can be the index of the field or the nae of the field. Now use dataset[xx] to get...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT