[R] gamlss to predict dependent variables in [0, 1] interval (fractional variable)

2016-12-27 Thread Janka VANSCHOENWINKEL
Dear R-users, I want to model a proportional variable bounded by [0,1] (the % of land fertilized). A high percentage of the data contains 0s (60%), a smaller percentage contains 1s (10%), and all the rest falls in between. I want to compare different models with each other to see their performa

[R] Weighted demean by group on only a selection of the dataset

2015-12-24 Thread Janka VANSCHOENWINKEL
Dear colleagues, I am trying to find a simple code to demean 1) only certain values of a dataset, 2) by group 3) and in a weighted fasion. Currently, I can only demean all the numeric variables in the dataset: Data[,sapply(Data, is.numeric)] <- apply(Data[sapply(Data, is.numeric)], 2, function(

Re: [R] Lag variable by group

2015-09-08 Thread Janka VANSCHOENWINKEL
8075 -1.818075 > > 4: 2005 28954 -1.818075 -1.818075 > > 5: 2005 28955 -1.818075NA > > 6: 2007 28955 -1.818075 -1.818075 > > > > Is it what you intended? > > Cheers > > Petr > > > > > > *From:* Janka VANSCHOENWINKEL [mailto:janka.vanschoe

Re: [R] Lag variable by group

2015-09-07 Thread Janka VANSCHOENWINKEL
year = c(2005, 2006, 2007, 2008), t1 = c(-1.81807494163513, > -1.81807494163513, -1.81807494163513, -1.81807494163513 > )), .Names = c("year", "t1"), row.names = c(17L, 18L, > 30L, 44L), class = "data.frame")), .Names = c("28954", &

[R] Lag variable by group

2015-09-07 Thread Janka VANSCHOENWINKEL
Hi! I have the following dataset with the variables ID (this is a unique ID per farmer), year, and another variable t1. I now would like to have a fourth variable which is the lag value of t1 for each farm ID. I found a code on the internet that does exactly what I need, but it does not work for

Re: [R] cut variable within a loop

2015-08-23 Thread Janka VANSCHOENWINKEL
Thank you all very much. A combination of the solutions suggested solved my problem! 2015-08-16 22:31 GMT+02:00 David Winsemius : > > On Aug 16, 2015, at 8:57 AM, Janka VANSCHOENWINKEL wrote: > > > Hi David, > > > > Thanks for your comment. I'll explain w

Re: [R] cut variable within a loop

2015-08-16 Thread Janka VANSCHOENWINKEL
92617989, 0, 0, > > 65.5172407627106, 0, 61.904764175415, 34.4827562570572, 7.95454531908035, > > 75, 0, 0, 0, 0, 0, 0, 5.26393800973892, 0, 0, 0, 0, 0, 0, 0, > > 0, 0, 74.6153831481934, 84.6153914928436, 0, 5.09554147720337, > > 0, 0, 0, 21.0884347558022, 18.4549376368523, 6.1

Re: [R] cut variable within a loop

2015-08-14 Thread Janka Vanschoenwinkel
ot;, "BG", "CZ", "EE", "HU", "LT", "LV", "PL", "RO", "SI", "SK", "b48", "b50", "irrigation", "awc_class", "sys02", "se025"), row.names = c(

Re: [R] cut variable within a loop

2015-08-14 Thread Janka Vanschoenwinkel
r > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > 2015-08-11 14:57 GMT+02:00 Janka Vanschoenwinkel < > janka.vanschoenwin...@uhasselt.be>: > &g

Re: [R] cut variable within a loop

2015-08-14 Thread Janka Vanschoenwinkel
If you supply a single number to the breaks parameter of cut I think it is > the number of intervals. > > > On 11/08/2015 13:57, Janka Vanschoenwinkel wrote: > >> Hi Thierry! >> >> Thanks for your answer. I tried this, but I get this error: >> >> "E

Re: [R] cut variable within a loop

2015-08-11 Thread Janka Vanschoenwinkel
d of. ~ Sir Ronald Aylmer Fisher > The plural of anecdote is not data. ~ Roger Brinner > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > 2015-08-11 14:38 GMT+02:

[R] cut variable within a loop

2015-08-11 Thread Janka Vanschoenwinkel
Dear list members, I have a loop where I want to do several calculations for different samples and save the results for each sample. These samples are for each loop different. I want to use the "i" in the loop to cut the samples. So for instance: - In loop 1 (i=1), I have a sample from 0-1 an

[R] simultaneous equation model with endogenous interaction terms

2015-08-10 Thread Janka Vanschoenwinkel
Dear list members, I am building a model such as: Y1 = Y2*X1 + X2 Y2 = Y1*X1 + X2 X2 is the exogenous variable Z1 is the instrument of Y1 Z2 is the instrument of Y2 This is a simultaneous equation model. I know how to build a simultaneous equation model without interaction terms: library(syste

[R] Testing for significant differences between groups in multiple linear regression

2015-01-23 Thread Janka Vanschoenwinkel
Dear R-colleagues, I am looking for a way to test whether one regression has significant different coefficients and overall results for 10 groups (grouping variable is "irr"). *What I have* The regression is: Depend = temp + temp² + perc + perc² + conti è split up for multiple groups of irr