Question

In: Statistics and Probability

How to simulate independent binary response for GEE in R?

How to simulate independent binary response for GEE in R?

Solutions

Expert Solution

set.seed(123)
# sample size
sample_size <- 100
# cluster size
cluster_size <- 4
# intercept
beta_intercepts <- 0
# regression parameter associated with the covariate
beta_coefficients <- 0.2
# correlation matrix for the NORTA method
latent_correlation_matrix <- toeplitz(c(1, 0.9, 0.9, 0.9))
# time-stationary covariate
x <- rep(rnorm(sample_size), each = cluster_size)
# simulation of clustered binary responses
simulated_binary_dataset <- rbin(clsize = cluster_size, intercepts = beta_intercepts, 
    betas = beta_coefficients, xformula = ~x, cor.matrix = latent_correlation_matrix, 
    link = "probit")
library(gee)
# fitting a GEE model
binary_gee_model <- gee(y ~ x, family = binomial("probit"), id = id, data = simulated_binary_dataset$simdata)
#> Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
#> running glm to get initial regression estimate
#> (Intercept)           x 
#>   0.1315121   0.2826005
# checking the estimated coefficients
summary(binary_gee_model)$coefficients
#>              Estimate Naive S.E.  Naive z Robust S.E. Robust z
#> (Intercept) 0.1315121 0.06399465 2.055048   0.1106696 1.188331
#> x           0.2826006 0.07191931 3.929412   0.1270285 2.224703

Related Solutions

simulate the 7T SRAM in cadense tool.show the response of waveforms.
simulate the 7T SRAM in cadense tool.show the response of waveforms.
Give a method to simulate BN(4,5,16,25,0.67) using cholesky factorization .Using R simulate this BN when n1=...
Give a method to simulate BN(4,5,16,25,0.67) using cholesky factorization .Using R simulate this BN when n1= 50 and n2= 50 and draw scatter diagram of (x1 ,x2) Estimate m1,m2 and sample corr(X1,X2) .Give regression line of X2 and X1 and also draw this line using method of least squares using R. Comment on your results.
Write a C/C++ program that simulate a menu based binary numbercalculator. This calculate shall have...
Write a C/C++ program that simulate a menu based binary number calculator. This calculate shall have the following three functionalities:Covert a binary string to corresponding positive integersConvert a positive integer to its binary representationAdd two binary numbers, both numbers are represented as a string of 0s and 1sTo reduce student work load, a start file CSCIProjOneHandout.cpp is given. In this file, the structure of the program has been established. The students only need to implement the following three functions:int binary_to_decimal(string...
The accompanying figure illustrates various binary relations from R to R. Which are functions?
 The accompanying figure illustrates various binary relations from R to R. Which are functions? For those that are functions, which are onto? Which are one-to-one?
Explain models with binary independent variables and possible issues with them.
Explain models with binary independent variables and possible issues with them.
For each of the following determine whether ∗ is a binary operation on R. If so,...
For each of the following determine whether ∗ is a binary operation on R. If so, determine whether or not ∗ is associative, commutative, has an identity element, and has inverse elements. (a) a ∗ b = (ab) / (a+b+1) (b) a ∗ b = a + b + k where k ∈ Z (c) a ln(b) on {x ∈ R | x > 0}
Using built in R functions to calculate mean and standard deviation. Simulate the X vector with...
Using built in R functions to calculate mean and standard deviation. Simulate the X vector with a length of 50 from a normal distribution with mean 2 and variance 1. Using a for() loop, create 100 different confidence intervals and also create a variable that keeps a count of how many of these confidence intervals contain the true mean 2. Hint: Use If/else statement to keep track of whether the confidence interval contains the true mean or not within the...
Question 4 Which of these are examples of binary response models a) using income (measured in...
Question 4 Which of these are examples of binary response models a) using income (measured in dollars) to predict the probability of whether or not someone buys a house b) using probability of buying a house to predict income (measured in dollars) c) both a and b are examples of binary response models d) neither a nor b are examples of binary response models Question 5 When comparing the possible advantages and disadvantages of the Logistical (Logit) Models versus the...
How to convert binary to hex?
How to convert binary to hex?
Consider a binary response variable y and an explanatory variable x. The following table contains the...
Consider a binary response variable y and an explanatory variable x. The following table contains the parameter estimates of the linear probability model (LPM) and the logit model, with the associated p-values shown in parentheses. Variable LPM Logit Constant −0.78 −5.90 (0.03 ) (0.03 ) x 0.04 0.28 (0.07 ) (0.02 ) a. Test for the significance of the intercept and the slope coefficients at the 5% level in both models. Coefficients LPM Logit Intercept Slope b. What is the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT