# r programming

1. ### 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...
2. ### 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...
3. ### 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...
4. ### [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)]...
5. ### 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 ~...
6. ### 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...
7. ### K-means clustering

Is there any algorithm to find the value of 'k' in k-means clustering for a big data set?
8. ### 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...
9. ### 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...
10. ### 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...
11. ### 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 =...
12. ### 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)^2) + ... + log(1+(x-X)^2) curve(h, from = -8, to = 7) But I get the error message 'Error in h(x) : '...' used in an incorrect context' How do...
13. ### 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...
14. ### 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
15. ### 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...
16. ### 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...
17. ### 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...
18. ### [ 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...
19. ### Problem with a regression in "R" - Dataset Workinghours

I'm a student. I'm working on a research using the statistical program "R 2.15.1". Here's my problem: how i can do a regression considering only values over a certain limit? Giorgio
20. ### Kulldorff's Spatial Scan Statistic

Hello, I have a semester project to develop a tool using Python which implements Kulldorff's algorithm and finds clusters in point (geo)data. Currently it is a mess: I understand Kuldorff's algorithm upto the part before it dives into Bernoulli & Poisson. I imagine I have to call certain...