[R] Problem with glm, gaussian family with log-link

2012-11-26 Thread Florian Weiler
Dear all, I am using the book "Generalized Linera Models and Extension" by Hardin and Hilbe (second edition, 2007) at the moment. The authors suggest that instead of OLS models, "the log link is generally used for response data that take only positive values on the continuous scale". Of course the

Re: [R] some R exercises

2012-05-09 Thread Florian Weiler
Just thought about it, you can have this of course "cheaper" without the loops. Like this: fun1 <- function(x) sum((x-mean(x))^2)/(length(x)+1) fun2 <- function(x) sum((x-mean(x))^2)/(length(x)) x <- rexp(15) fun1(x) fun2(x) -- View this message in context: http://r.789695.n4.nabble.com/some-R-

Re: [R] some R exercises

2012-05-09 Thread Florian Weiler
On Exercise 5, how about this (I'm rather new to R as well, so no guarantee this is right and I'm sure there are more efficient ways to do this!): fun1 <- function(x) { y <- 0 for (i in 1:length(x)) {y[i] <- (x[i]-mean(x))^2} sum(y)/(length(x)+1) } fun2 <- function(x) { y <- 0 for

[R] ergm model, nodematch with diff=T

2012-05-09 Thread Florian Weiler
Dear all, I am new to network analysis, but since I have good data I started to read about it and learned how to use the ergm and related packages. I generally get interesting results, but when I run a model including sociality and selective mixing effects for different groups, the model runs (an

[R] Multiple imputation using mice

2012-03-07 Thread Florian Weiler
Dear all, I am trying to impute data for a range of variables in my data set, of which unfortunately most variables have missing values, and some have quite a few. So I set up the predictor matrix to exclude certain variables (setting the relevant elements to zero) and then I run the imputation. T

Re: [R] Loop

2012-02-22 Thread Florian Weiler
Thanks a lot all of you! @ Berend, your code works fine, thanks. @ Milan, you have a point there, makes sense to create 1 instead of 10 objects! -- View this message in context: http://r.789695.n4.nabble.com/Loop-tp4409865p4410444.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Loop

2012-02-22 Thread Florian Weiler
Thanks for the answer, and sorry if I was not clear. So I run the data imputation using mice with 10 chains and then I get a mids-object. From that object I can then extract 10 data sets using the complete(imp, n) command (with n=c(1:10)). Now I can type this out 10 times: set1 <- complete(imp, 1

[R] Loop

2012-02-22 Thread Florian Weiler
Dear all, I have a (probably very basic) question. I am imputing data with the mice package, using 10 chains. I can then write out the 10 final values of the chains simply by name1 <- complete(imp, 1) : : name10 <- complete(imp,10) Not a big deal, I ju

Re: [R] Lattice - different axis length

2012-02-07 Thread Florian Weiler
Thanks a lot for your help! I found that the relation="free" command was very helpful, but then I had a little space between the axis and where the bars actually begun. I tried to deal with it in a panel function but was unable to do so. However, I found a way providing a list to xlim: barchart(

[R] Lattice - different axis length

2012-02-07 Thread Florian Weiler
Dear all, I have a question about the lattice package, more specifically about the control of the x-axis length in the different panels. I use the following code to make the stacked barchart: barchart(country ~ climatechangefocalpoint + meteorologyservice + adaptationorvulnerability + cdmcarbonm

[R] Bar chart: break long bars

2011-10-25 Thread Florian Weiler
Dear all, I have a problem with my stacked bar charts. I have one very long bar, hence I would like to break the x-axis at a certain point so that the shorter bars can be seen better. Here is a cooked up example: library(lattice) group <- rep(1:3,10) x <- runif(30, 0, 100) y <- runif(30, 0, 100)

Re: [R] R crashes when communicating with JAGS

2010-08-31 Thread Florian Weiler
't understand why. Is there another package I need to install when using an older version of Jags? Thanks again, Florian On Tue, Aug 31, 2010 at 12:38 AM, Ben Bolker wrote: > Florian Weiler johnshopkins.it> writes: > >> First I create some data: >> N <- 1000 >> x

Re: [R] R crashes when communicating with JAGS

2010-08-30 Thread Florian Weiler
ose and reopen the program. I don't even start drawing samples from the model, it just crashes the moment I try to call on JAGS. Sorry for not providing the example right away, Florian On Mon, Aug 30, 2010 at 9:17 AM, Florian Weiler wrote: > Dear all, > > I have a question regarding

[R] R crashes when communicating with JAGS

2010-08-30 Thread Florian Weiler
Dear all, I have a question regarding using JAGS and R. My problem is that every single time I want to call JAGS from R the latter crashes (i.e. it turns pale and the Windows tells me "R has stopped working". Strangely, if there is a mistake in my jags code, this will be reported without a crash.