r language

  1. R

    a function created does not work

    Hello, I had created a function and I aimed to verify if it complies with certain data and if it was, then it is stored in another variable. data = c(12, 20, 11, 16, 18, 32, 22 , 8) class = function(N){} tabla1= c(1:8) for (i in length(N)){ if (data[i]<21.78){ table1[i]= data[i]...
  2. M

    Constrained design of experiments

    Good evening! I would like to conduct a 2-level fractional factorial experimental design on 8 factors. I used the FrF2 package in R to do so. I have capacity to do roughly 30 experiments, so I selected a resolution IV 2^(8-3) with one center-point. Repeats aren't necessary for reasons related...
  3. P

    Survival Analysis Alternative for disproportionately missing cases

    Hello everyone, I am new to the Data world and am facing a problem which I can’t seem to fix. My task is to analyze why some people cancel their policies and some don’t (find sig. factors) and to estimate the risk of cancelling for different groups. I was thinking of using survival analysis...
  4. L

    non-numeric argument to binary operator -R

    I have this code : dataset <- maml.mapInputPort(1) library(tm) ## Text mining library ## Set the comlumn names colnames(dataset) <- c("sentiment", "tweets") ## Extract text data and coerce the vector to a tm corpus tweet.text<- Corpus(VectorSource(dataset['tweets'])) ## Apply...
  5. J

    Importance of vars in linear regression (R)

    I have a question that is and R question and a statistical question: I am analysing sales of a retailer. These sales are related to some vars: var1, var2, var3.., varN Most of the vars are continuos. I want to analyze the relationship between sales and the vars. I have made a linear...
  6. A

    Simulate Ar(1) process with different y0 values and uniform distribution

    I need to plot an Ar(1) graph for the process yk = 0.75yk-1 + ek. for y0=1 and another graph for y0=10. assume ek is uniformly distributed on interval [-0.5,0.5]. i have the following code but i am not sure how to control y0. #----------#Start#---------# rm(list=ls())...
  7. U

    Finding Runs for Consecutive Ones

    Hi, I am new to programming. Sorry for the basic question. I came across this code to find runs for consecutive ones for the vector (1,0,0,1,1,1,0,1,1). The code for this is findruns1<-function(x,k) { n<-length(x) runs<-vector(length=n) count<-0 for(i in 1:(n-k+1)){...
  8. rogojel

    What does Python offer that R can't?

    Hi, I am looking at Coursera data anlysis specializations and most (basically all except John Hopkins) offer Python as the language of choice for their courses. I really like R but I started to wonder if I am missing something? I just see no advantages in Python for data analysis, that would...
  9. H

    R Markdown document-How do you display/format a References/Bibliography section?

    Hello, I am trying to write a scientific paper using R Markdown, but am unsure about the best way to include the references section. Since I have over 50 references (currently as a list of 50 PMIDs) I am looking for a fast way to format them in the style of the specific journal I want to...
  10. B

    Fisher r to z transform / significance test for two different values of r^2

    Short version: I have two values of r^2 from Pearson's correlation, one from a control group (.713) and one for an experimental (.527), and I would like to quantitatively compare the difference in how well/poorly the points in each group cluster around their fit line. Long Version: The data...
  11. I

    Principal Component Analysis in R- Data rotation

    I ran prcomp on my data (7000 observations, 48 variables), and I biplot I got seems to have thousands of points. My guess is that R is treating each of the 7000 observations as variables. Is there a way to "rotate" my data so that I get 48 points on my PCA graph instead of 7000? Each column...
  12. I

    Principal Component Analysis in R Help

    I am a beginner to R. I have read several guides, but still am stuck on this: I have data in an excel csv file, on which I want to run PCA. I'm not sure how the prcomp formula works. The help page states: prcomp(x, retx = TRUE, center = TRUE, scale. = FALSE, tol = NULL, ...)...
  13. E

    Logistic regression, sample sizes and bootstraping

    Hello, this is my first post. I currently I'm working in my phD in a multivariate logistic model but I have a problem regarding the sample size of my observations: -The "success" (1) event group has a sample size of 249 distinct observations - The "non success" (0) event group has a sample size...
  14. M

    specifying claims from 1992-2002 for months April through septemebr

    I have a data with unordered dates as follows: 2009-10-19, 2011-04-28, 2008-04-11, 2009-10-18, 2009-06-12, 2006-08-04, 2009-08-21 With corresponding claims data as follows: 1,0,0,1,1,1,0 This is just a small part of the data, Now I want to specify the claims with dates from...
  15. R

    package expm: matrix powers within a product of matrices: operation precedence

    I want to double check that for M and N kxk mtrices and v a k-vector M%^%2%*%N%*%v is not automatically read as (M%^%2)%*%N%*%v or M%*%N%^%2%*%v is not automatically read as M%*%(N%^%2)%*%v or both I had been assuming the usual precedence (powers first, then multiplication) applies...
  16. Z

    Ordered Permutation

    Is there any way in R to generate ordered permutation and used them one by one.
  17. V

    Data analysis (with R)

    I'm taking a data analysis course with R and in my assignment I am asked how variables A, B and C are associated with X. My answer should include descriptive statistics and analyses (group comparisons and/or association tests). It is not completely clear to me which test I should run. So far...
  18. victorxstc

    Contributions to writing code that enable R to analyze the "Descriptive" statistics

    Apparently R does use only the raw data. In some other statistical programs, there is the option to calculate some simple tests, only by inputting the descriptive statistics. I for one think it would be much better if we could enable R to run such tests too. There are not many tests that can...