Search results

1. R command like rowfirst in Stata

Hi, I would like to be able to take the first non missing value in two columns of data in R as shown in the attached image (CREDIT2002, CREDIT2004) to create the new variable CREDIT_FIRST.
2. Creating variables in R- two issues

I have two basic questions about new variable creation in R. I will show some code and hopefully someone can help answer these! df0$new <- ifelse(df0$old=="yes",1,0) In this code I am creating a new variable called "new" that is equal to 1 if the variable "old" is equal to yes or is otherwise...
3. One way confidence interval

Suppose I am estimating a parameter that ranges from 0 to 5. Now, suppose I obtain an estimate of 5. How do I report a confidence interval for this? An upper bound above 5 would simply not make sense. I believe this is a one-tailed test but how do I report this? Would it be (lower bound, 5)...
4. Twins raised together and twins raised apart

Greetings All, I am examining smoking behavior in a sample of twins raised apart and together.I have repeated measures at different time points asking participants if they smoke or not. I also have a question about whether the participant grew up in a household where parents smoked. My...
5. Is there a R package for analyzing twins raised together and apart?

I have data from a clinical study on samples of twins raised together and apart. I have not found much resources for this type of analysis. Can anyone point me in the direction of these type of information or R package? CHEERS
6. R ggplot NO alphabatize

I am plotting box plots for several variables using ggplot. However, ggplot is alphabetizing the variables and I want them to present as the order I have them in the code. How could that be fixed?
7. Data frame of results

Hi all Suppose I have 10 different models as such: fit1.glm <- glm(admit ~ gre , data = dat, family = "binomial") fit2.glm <- glm(admit ~ gpa, data = dat, family = "binomial") fit3.glm <- glm(admit ~ rank, data = dat, family = "binomial") ... Suppose then, I want to form a data frame...
8. Odds ratio plot on log scale

Greetings, I have had difficulties plotting results from GLM logit models to show up as odds ratios on a log scale. Ultimately I want to obtain estimates from different models and plot the results on one graph as shown here (https://www.ctspedia.org/do/view/CTSpedia/ClinAEGraph001). Do you...
9. multilevel random effects model

I want to look at the change in the percentage of income savings measured in dollars using repeated measures data for older adults. I want to compare three groups based on their father's occupation while growing up. I want to estimate different slopes and intercepts for the three groups. For...
10. lmer multilevel model

Hi to all, I want to look at the change in the percentage of income savings measured in dollars using repeated measures data for older adults. I want to compare three groups based on their father's occupation while growing up. I want to estimate different slopes and intercepts for the...
11. Details on missing data in R

Hello all, Say I have data as shown below. I want to generate a report in R like this: Missing 0 tests: 1 Missing 1 test: 2 Missing 2 tests: 2 Missing 3 tests: 1 I then want to generate a report that says the combination of missing values. For example, 1/3 of respondents who were...
12. extract first value from multiple columns

i am trying to do this in R. it is equivalent to the stata command rowfirst suppose i have four columns as shown below (T1, T2, T3, T4). I want to create a new column (TX) which contains for each row the first element in columns T1:T4. ID T1 T2 T3 T4 A 0 2 4 5 B . . 6 5 C . 8...
13. Subset based on missing in differnet variables

Suppose I have credit ratings for 5 years (credit1, credit2, credit3, credit4, credit5). I only want to keep observations which have at least three non-missing credit scores of any combination. Is there a more efficient way to do this than using rbind? Thank you!
14. growth curve models

hi all, suppose my outcome is total yearly savings (\$). i want to use growth curve models to see how 4 different groups change in their savings habit over time. i have variables such as race which don't change. however i also have an income variable which does change every year. how can i use...