r programming

  1. Curious Jorge

    Is the binomial distribution appropriate for this time-series data?

    I need direction for the parametric model options for deriving a probability distribution of any given point-in-time of time series data. I've preliminarily adopted the binomial distribution because in my data set, over time, an element either enters a dead-state (X) or it doesn't. Please let me...
  2. J

    How to intrepret this Correlation Matrix result from R ?

    This is the correlation matrix of Variable 1 against 16 other variables. I have applied the Distance correlation matrix from the R package "Correlation" which I read is suitable for non-linear data. But I am having time interpreting this result as I could not find enough resources on the...
  3. S

    P values from bootstrap in R

    I've been trying to get the pvalue of my samples from a bootstrap rsquared test in R. I'm not very good with statistics so could someone please take a look at my below code and point me in the right direction with regards to how I can extract the p-values per sample (basically input a...
  4. S

    Extracting p value from bootstrap

    I've been trying to get the pvalue of my samples from a bootstrap rsquared test in R. I'm not very good with statistics so could someone please take a look at my below code and point me in the right direction with regards to how I can extract the p-values per sample (basically input a...
  5. L

    R - Finding Frequency - Bar Graph or Percentage? Which should be used or both?

    [R] -How to Find Frequency - Bar Graph or Percentage? Which is best or both? Would the Bar Graph attached be sufficient when they ask to "Find Frequency"? or Do I need to find the specific percentage probability? If the latter, how would I go about getting the number...percentage for the...
  6. M

    [R] How to get normal/ rankit scores from non-normal data with ties.

    Hello, I would like to see whether pathogen levels influenced certain bumblebee colony development parameters such as the number of queen pupae produced. Due to non-normality of the data I would like to do a rankit transformation of the data as suggested by [Bishara & Hittner (2012)][1]...
  7. L

    JAGS error for MCMC Bayesian inference

    In R, I am running an MCMC Bayesian inference for data from mixture of Gamma distributions. JAGS is used here. The model file gmd.bug is as follows model { for (i in 1:N) { y[i] ~ dsum(p*one, (1-p)*two) } one ~ dgamma(alpha1, beta1) two ~ dgamma(alpha2, beta2) alpha1 ~ dunif(0, 10) beta1 ~...
  8. L

    Finding correlation for penalized regression in R

    I need to use the penalized models (lasso, ridge) for linear regression. In R, I use the "penalized" package. The output is a penfit object. If I want to find the in-sample and predictive correlation, how can I do that in R? Converting the penfit oject to glm maybe a good idea,but I don't...
  9. C

    K-means clustering

    Is there any algorithm to find the value of 'k' in k-means clustering for a big data set?
  10. N

    rollapply with Arima model: testing for stability of coefficients

    Hi everyone, I am trying to fit an arima model on a rolling window using rollapply.My aim is to plot a graph of the evolution of the coefficient, plot the error and the standard deviation. well i encountered the following problems: 1) each window in the roll apply have different set of...
  11. E

    Comparing multiple PDF documents using R

    Is there a way to compare more than two or atleast two documents using R to identify the differences/common content? I have about 60 PDF files at most one or two pages each that have similar content (but not the same). Some may be same. Each PDF is like an schedule/invoice kind of a document...
  12. E

    Best book on R

    Sorry guys, this post may not belong here but I had no idea where else to post. I'm looking for some recommendations for an "excellent" book for R programming focused on uses of R in statistics, data analysis, producing graphs -including making them look more than just vanilla etc. I...
  13. B

    R programming - (nonparaeff) package, direc.dea - Help specifying >1 input

    Hello, i am trying to model firm frontier efficiency using the nonparaeff package in R for the ''directional distance function- direc.dea). The instruction manual in HELP provides a simple example: ## Simple Example of one input, one good output, and one bad output. my.dat <- data.frame(yg =...
  14. H

    plotting log likelihood function

    Here is the code I am using to try to plot a log likelihood curve (cauchy distribution): X=rcauchy(10) h <- function(x) log(1+(x-X[1])^2) + ... + log(1+(x-X[10])^2) curve(h, from = -8, to = 7) But I get the error message 'Error in h(x) : '...' used in an incorrect context' How do...
  15. M

    aggregate function

    Hi All, I have the following data: Year Day Month Time Ambient_Air_Temperature Wind_Speed Precipitation 1 2002 1 January 15 -7.980 2.668 146.90 2 2002 1 January 30 -8.090 2.541 146.90 3 2002 1 January 45...
  16. C

    Is that the correct procedure to showing unbiasedness.

    I want to modify the following program to show unbiasedness using r x <- c(10,12,14,13,10,11,9,15,8,14) mu=mean(x) T=0 #the statistic for(i in 1:210){ r = sample(x,size=4,replace=F) T[i]=mean(r) } MSE <- (1/209)*sum(T-mu)^2 #mean square error MSE
  17. M

    how to put data in a matrix form

    I have the following data: date pcp 1 20010101 1.051627e+01 2 20010102 9.139277e-02 3 20010103 2.826194e+00 4 20010104 2.115948e+00 5 20010105 6.152151e-01 6 20010106 9.994188e-01 7 20010107 1.130322e-01 8 20010108 5.135144e-01 9 20010109...
  18. M

    2 graphs in the same plot

    HI All, I have the following 2 graphs: mat <- matrix(c(107.6937,75.23753,61.22222,39.83478,23.69258,14.5623,6.201099,3.622861,2.132939, 141.0136,103.0853,82.92933,54.3715,33.37596,20.16385,8.279188,4.765267,2.781721...
  19. V

    hierarchical regression with different DV for each block?

    Greetings. I'm trying to figure out how to do a hierarchical regression whereby the DV regressed on block 1 becomes the IV in block 2, which then has a different DV. That DV then becomes the IV in block 3, at which point the final DV is in place. It'd look something like this: Block 1...
  20. F

    [ R + regression ] How do you set up a regression with restrictions on coefficients?

    Hello, I would like help imposing restrictions on coefficients estimated in the regression model show below: lm(Y ~ C + S, weights = W) Y = stock returns C = set of country membership binaries (1 or 0) I = set of industry membership binaries (1 or 0) W = market capitalization weights...