Test 6 R
docx
keyboard_arrow_up
School
University of South Carolina, Aiken *
*We aren’t endorsed by this school
Course
374
Subject
Mathematics
Date
Apr 3, 2024
Type
docx
Pages
2
Uploaded by DrRabbitMaster1088
How does changing the RATING from 1 to 2 affect the odds of DEFAULT according to the model? - It increases the odds of DEFAULT by about 12.4 times.
Which variable in the model is statistically significant at the 1% level? – RATING “3”
What is the impact of SIZE on the odds of DEFAULT, as per the model? - Each one-unit increase in SIZE increases the odds of DEFAULT by about 26.9%.
Which of the following creates a function in R that calculates the square of a number? -
square <- function(x) { x ^ 2 }
What is the correct way to define a function in R that calculates the cube of a number? -
cube <- function(x) { x * x * x }
What will the following R function output when called as sqAndCu(3)?
sqAndCu <- function(x) {
list(square = x^2, cube = x^3)
}
-list(square = 9, cube = 27)
What would be the output of the following R code?
sqRFunc <- function(x) {
sqrt(x)
}
sqRFunc(16)
-
[1] 4
What does the following R function do?
isEv <- function(x) {
x %% 2 == 0
}
-
Returns TRUE if x is even
What will be the output of the following function when called as sumEven(c(1, 2, 3, 4, 5))?
sumEven <- function(numbers) {
sum(numbers[numbers %% 2 == 0])
}
-6
What is the result of the following R code snippet?
seq(1, 5, by=2)
-[1] 1 3 5
What will be the output of the following function when called as calculateModulus(9, 4)?
calculateModulus <- function(a, b) {
a %% b
}
-
1
Consider a function that uses sapply(). What does sapply() do?
applyToVector <- function(v, f) {
sapply(v, f)
}
-
Applies the function f to each element of vector v and returns a vector.
What will the following function return when called as incVector(c(1,2,3))?
incVector <- function(vec) {
vec + 1
}
-
c(2, 3, 4)
What will be the output of the following R code?
modFunc <- function(x, y) {
x %% y
}
modFunc(10, 3)
-[1] 1
What would be the output of the following code?
revFunc <- function(x) {
rev(x)
}
revFunc(c(1, 2, 3))
-
[1] 3 2 1
What is the output of the following R code?
v <- c(3, 6, 9, 12)
mean(v)
-
[1] 7.5
What will be the output of the following function when called as isP(5)?
isP <- function(n) {
if (n <= 1)
return(FALSE)
for (i in 2:(n - 1)) {
if (n %% i == 0)
return(FALSE)
}
return(TRUE)
-TRUE
What will be the output of the following R code?
f <- function(x) {
if (x > 10) "Greater" else "Smaller"
}
f(15)
-[1] "Greater"
What will be the output of the following function when called as sayMessage("Hello")?
sayMessage <- function(message) {
paste("The message is:", message)
}
-"The message is: Hello"
What will the following R function output when called as greetPerson("Alice")?
greetPerson <- function(name) {
paste("Hello", name, "!")
}
-"Hello Alice!"
What will be the output of the following R code?
concatFunc <- function(a, b) {
paste0(a, b)
}
concatFunc("Hello", "World")
-"HelloWorld"
The logit in logistic regression is:-
The natural logarithm of the odds
What is logistic regression primarily used for? -
Classifying outcomes
into categories
Logistic regression is typically used for: -
Predicting a categorical variable from continuous or categorical variables.
What does the term 'logit' represent in logistic regression? -
The natural logarithm of the odds.
A logit function in logistic regression is defined as: -
The natural logarithm of the odds of the outcome.
Logistic regression assumes: -
A linear relationship between predictor variables and the logit of the outcome variable.
A logistic regression model essentially: -
Classifies cases based on a set of predictors into categories of the dependent or criterion variable
In logistic regression, the intercept can be interpreted as: -
The log odds of the outcome when all predictor variables are zero.
In logistic regression, the intercept term represents: -
The log odds of the outcome when all predictors are zero.
In the logistic regression equation, what role does the intercept play?-
It is the log odds of the outcome when all predictors are zero
In a logistic regression model, the dependent variable is characterized by: -
Two categories
In logistic regression, the range of the dependent variable (probability of success) is: -
(0, 1)
In logistic regression, the outcome variable is typically:-
Categorical,
often binary.
The logistic regression model is used when the outcome variable is:
-
A categorical variable with two levels (binary).
What type of variable is best suited for logistic regression analysis? -
Both continuous and categorical variables
The logit link function in logistic regression is used to: -
Model the probability of the outcome as a linear function of the predictors.
What is the role of the logit function in logistic regression? -
It linearly relates independent variables to the probability of the outcome
In logistic regression, a logit link function is used to: -
Connect the linear predictors to the probability of the outcome.
Which of the following is a correct assumption of logistic regression? -
t requires a linear relationship between the logit of the
outcome and the predictors.
Why is logistic regression preferred over linear regression for binary outcomes? -
Because it models the probability of binary outcomes.
In logistic regression, what does the coefficient of a predictor variable indicate? -
The change in the log odds of the outcome per unit increase in the predictor
What does the coefficient in a logistic regression model represent? -
The change in the outcome's log odds for a one-unit change in the predictor
In logistic regression, if a coefficient is close to zero, it implies that: -
The predictor has a minimal impact on the probability of the outcome.
When applying logistic regression, what is the implication of an odds ratio of 0.5 for a predictor? -
The event is half as likely to occur with a one-unit increase in the predictor.
In logistic regression, what does a significant p-value for a coefficient suggest? -
The predictor is likely to be a meaningful addition to the model.
In logistic regression, a significant negative coefficient for a predictor variable indicates that: -
s the predictor increases, the probability of the outcome decreases.
Which statement is true regarding the interpretation of odds ratios in logistic regression -
An odds ratio greater than 1 suggests an increased likelihood of the event occurring.
In logistic regression, what does an odds ratio greater than 1 indicate? -
The event is more likely to occur
-
An odds ratio less than 1 in logistic regression indicates that: -
The likelihood of the event decreases as the predictor increases.
What does an odds ratio of more than 1 signify in a logistic regression model? -
The event is more likely to occur as the predictor value increases.
In logistic regression, the odds ratio is defined as: -
The ratio of the odds after a unit change in the predictor to the original odds.
What is the primary difference between linear and logistic regression? -
Linear regression is used for predicting continuous outcomes, while logistic regression is for categorical outcomes.
Why is logistic regression preferred over linear regression for binary outcomes? -
Because it models the probability of binary outcomes.
Which of the following best describes the logistic function in logistic
regression? -
It transforms the linear regression output to a probability.
What is an important feature of logistic regression in terms of prediction? -
It predicts the probability of different categorical outcomes.
In the context of logistic regression, multicollinearity among predictors: -
Can distort the estimated coefficients and their significance.
How does multicollinearity affect logistic regression models? -
It can lead to unreliable and unstable estimates of regression coefficients.
Which of the following is the correct way to define a default value for a parameter in R functions?-
myFunc <- function(x, y = 1) { ... }
The range of the logit function (logit(π)) in the domain π=[0,1] is: -
(-
∞,∞)
When flipping a fair coin, the odds of getting tails are: -
1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help