RE: [R] Using R to illustrate the Central Limit Theorem

2005-05-13 Thread Bliese, Paul D LTC USAMH
Interesting thread. The graphics are great, the only thing that might be worth doing for teaching purposes would be to illustrate the original distribution that is being averaged 1000 times. Below is one option based on Bill Venables code. Note that to do this I had to start with a k of 2. N <-

[R] read.spss in R 2.1.0 & make basic dataframe

2005-05-26 Thread Bliese, Paul D LTC USAMH
Recent changes to read.spss() in the foreign package return a dataframe containing additional attributes. For example, >TEMP<-read.spss(choose.files(), to.data.frame=T,use.value.labels=F) > str(TEMP) `data.frame': 780 obs. of 8 variables: $ EXPOS01: atomic 1 1 2 1 2 3 2 4 2 1 ...

[R] apply the function "factor" to multiple columns

2005-05-31 Thread Bliese, Paul D LTC USAMH
I have a case where I would like to change multiple columns containing numbers to factors. I can change each column one at a time as in: TEMP.FACT$EXPOS01<-factor(TEMP.FACT$EXPOS01,levels=c(1,2,3),labels=c("No ne","Low Impact","MedHigh Imp")) TEMP.FACT$EXPOS02<-factor(TEMP.FACT$EXPOS02,levels

[R] lars / lasso with glm

2005-05-31 Thread Bliese, Paul D LTC USAMH
We have been using Least Angle Regression (lars) to help identify predictors in models where the outcome is continuous. To do so we have been relying on the lars package. Theoretically, it should be possible to use the lars procedure within a general linear model (glm) framework - we are particul

[R] Simulate dichotomous correlation matrix

2006-06-28 Thread Bliese, Paul D LTC USAMH
Newsgroup members, Does anyone have a clever way to simulate a correlation matrix such that each column contains dichotomous variables (0,1) and where each column has different prevalence rates. For instance, I would like to simulate the following correlation matrix: > CORMAT[1:4,1:4]

[R] Why are lagged correlations typically negative?

2006-08-24 Thread Bliese, Paul D LTC USAMH
Recently, I was working with some lagged designs where a vector of observations at one time was used to predict a vector of observations at another time using a lag 1 design. In the work, I noticed a lot of negative correlations, so I ran a simple simulation with 2 matched points. The crude simul

[R] Simulate phi-coefficient

2005-09-09 Thread Bliese, Paul D LTC USAMH
Looking for help with the following problem. Given a sample of zeros and ones, for example: > VECTOR1<-rep(c(1,0),c(15,10)) > VECTOR1 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 How would I create a new sample (VECTOR2) also containing zeros and ones, in which the phi-coeff

Re: [R] Simulate phi-coefficient (correlation between dichotomous vars)

2005-09-26 Thread Bliese, Paul D LTC USAMH
Monday, September 12, 2005 1:34 AM To: r-help@stat.math.ethz.ch Subject: [R] Simulate phi-coefficient > From: "Bliese, Paul D LTC USAMH" <[EMAIL PROTECTED]> > > Given a sample of zeros and ones, for example: > > VECTOR1<-rep(c(1,0),c(15,10)) > How would I create a n

[R] Cohen's d on Adjusted Means (UNCLASSIFIED)

2007-04-19 Thread Bliese, Paul D LTC USAMH
Classification: UNCLASSIFIED Caveats: NONE I have a large group randomized trial (pre-post design) where the randomization was marginally successful. Given the pre-existing differences among groups, it makes sense to report adjusted means (aka least squares means though I estimated them via pre

[R] ylim problem in barplot

2006-01-05 Thread Bliese, Paul D LTC USAMH
R Version 2.2.0 Platform: Windows When I use barplot but select a ylim value greater than zero, the graph is distorted. The bars extend below the bottom of the graph. For instance the command produces a problematic graph. barplot(c(200,300,250,350),ylim=c(150,400)) Any help would

[R] gam y-axis interpretation

2006-03-23 Thread Bliese, Paul D LTC USAMH
Sorry if this is an obvious question... I'm estimating a simple binomial generalized additive model using the gam function in the package mgcv. The model makes sense given my data, and the predicted values also make sense given what I know about the data. However, I'm having trouble interp

[R] Weighted Sensitivity, PPV etc.

2006-04-03 Thread Bliese, Paul D LTC USAMH
All, Appreciate any leads on the following: In a recent blind-validation study of a depression screening instrument we used a two-stage sampling design. In stage 1, we used a broad paper-and-pencil screen to identify likely positives (say 30% of entire sample). In stage 2 we conducted

[R] mcnemar.test odds ratios, CI, etc.

2005-01-24 Thread Bliese, Paul D LTC USAMH
Does anyone know of another version of the Mcnemar test that provides: 1. Odds Ratios 2. 95% Confidence intervals of the Odds Ratios 3. Sample probability 4. 95% Confidence intervals of the sample probability Obviously the Odds Ratios and Sample probabilities are easy to calculate f