Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer (b) is not *just* about how to program in `R`.

learn more… | top users | synonyms

0
votes
0answers
6 views

Extracting metadata (author, creation date …) from word documents with R [migrated]

I would like to extract the metadata (author, creation date ...) from a batch of MS word documents with R. Can anybody tell me if that is possibile, and if so how I can do this? Thanks, Fred.
0
votes
0answers
13 views

Extended COX model in R [on hold]

Objective: To predict time to event of a customer using R I developed a Non parametric model but as per my understanding we cannot perform predictions from these models, so I have to build a model ...
1
vote
3answers
39 views

Correlation using Logistic Regression and Pearson

I am so sorry, I am beginner in statistic analysis, I have project using R to analyze the correlation between dependent variables and independents variables. In this case I have two dependent ...
0
votes
0answers
12 views

How to handle large .csv file in R? [migrated]

I have a large(>100,000) single column floating point time-series data. I want to find structural changes within the data with respect to time( in my case index). In-order to do that, I am using R ...
1
vote
0answers
12 views

Test if a slope falls within a back-transformed (log) prediction interval

I'm trying to test the hypothesis that the relationship (slope) between second molar tooth size and overall molar tooth size is 0.33 (in species of rodents), using generalized least squares regression ...
0
votes
1answer
28 views

Compare regression slopes of repeated measures linear regression

In my design, I have two groups of subjects and every subject is tested in four different conditions. So, I have a within-subject factor ('span_num', which ranges from 0 to 3) and a between-subject ...
0
votes
1answer
68 views

Is it possible to construct a discrete-time multilevel hazard model in R?

I'm trying to run a discrete-time multilevel hazard analysis comparable to the model proposed by Barber et al. I am attempting to model the hazard of migrating internationally using predictors at the ...
2
votes
2answers
64 views

How to predict the amount of data needed for modeling?

Is there a way to estimate the amount of data (or the number of records) required to build a statistical model? I read few blogs and I feel that most of the responses concur that there is no way or ...
6
votes
1answer
218 views

Generate random numbers following a distribution within an interval in R

I need to generate random numbers following Normal distribution within the interval $(a,b)$. I know the function rnorm(n,mean,sd) will generate random numbers ...
5
votes
3answers
138 views

Simulation involving conditioning on sum of random variables

I was reading this question, and thought about simulating the required quantity. The problem is as follows: If $A$ and $B$ are iid standard normal, what is $E(A^2|A+B)$? So I want to simulate ...
3
votes
2answers
55 views

Why isn't the lasso selected variable even not significant?

I performed a lasso selection using lars::lars for a well normally distributed outcome using a pool of 86 predictors. Here is the plot of the output: The ...
1
vote
0answers
12 views

Estimated random effects correlation of 1 when fitting a random intercept model using lme

I am trying to fit the linear random effects model: $y_{ijk}=\theta_{ij}+\epsilon_{ijk},$ where $\theta_{ij}$ is a random effect. I assume the random effects and error distributions are normal. ...
1
vote
0answers
13 views

'systemfit' package and systems of non-linear equations/regression

I am trying to estimate a system of non-linear equations using 'systemfit' package in R. I have had issues with it. The two equations share the same parameters i.e. "sigma", "al" and "ae". I expect ...
0
votes
0answers
57 views

Calculating $R^2$ two different ways

I am calculating my $R^2$ for a model two different ways. I used pred = predict(model, newdata = mydata, se.fit = T) and then calculated ...
0
votes
0answers
12 views

using decompose function for high frequency data

I have a table as Date Time Energy 1/1/2008 10:30 0.89 1/1/2008 11:30 0.76 and so on. The data is recorded for every half an hour. I wish to ...
-4
votes
0answers
89 views

Exploratory regression analysis for data with missing values

Recently I have performed an exploratory regression analysis, using lavaan R package and observed the following output with some warning messages in it. I have the ...
1
vote
0answers
21 views

Estimating parameters and latent variables in a split Poisson distribution using R and JAGS

I am trying to estimate parameters and latent variables in a split Poisson model that describes observable and unobservable counts in time assuming the split probability is $\pi$. An observable event ...
0
votes
0answers
12 views

Time series Data Analysis and Forecasting by country and time factor

cty year qtr tl Argentina 2009 Q4 3 Argentina 2010 Q1 2 Argentina 2010 Q2 7 Argentina 2010 Q3 7 Argentina 2010 Q4 10 Argentina 2011 Q1 7 Argentina 2011 Q2 7 Argentina 2011 Q3 1 Argentina 2011 ...
0
votes
0answers
8 views

R - What does “incomplete block on file” mean? [migrated]

I am using RStudio, and am trying to use packrat with my current project. I click the checkbox "Use packrat with this project" and press OK, where I get the following output from the console: ...
1
vote
0answers
13 views

How to compare fit of discrete process with discrete underlying process?

I am basically looking for an equivalent to something like an $\mathbb{R}^2$ for a model on a dataset that is itself simply a collection of points. That is, if my data set is (trivial example): ...
0
votes
0answers
13 views

Sum to Zero Constraint GAM Factor Interaction

I was under the impression that the smooths fit with mgcv were made identifiable through a sum to zero constraint - i.e. if one was to sum the smooth over the ...
0
votes
0answers
14 views

How are CP (Cost Complexity) values calculated in RPART (or decision trees in general)

From what I understand, the cp argument to the rpart function helps pre-prune the tree in the same way as the minsplit or minbucket arguments. What I don't ...
0
votes
1answer
38 views

Estimating the area between two ecdfs

I wish to calculate the area between two ecdfs in R (see below): ...
1
vote
0answers
17 views

Missing values issue [migrated]

I have a dataset (data1.csv) that contains some missing data ** . ** (missing at random), I am creating a subset from this dataset (d1) such that only complete observations are retained in d2. I am ...
0
votes
0answers
36 views

Propensity to purchase using regression analysis in R [closed]

I have a dataset with a sample snapshot of it looking like this: ...
1
vote
2answers
47 views

ks.test and ks.boot - exact p-values and ties

I am confused by the behaviour of ks.test (package stat) a) in the presence of ties and b) if one-sided while doing a two-sample test. Documentation: "Exact p-values are not available for the ...
1
vote
0answers
18 views

One inflated beta regression with random effects using GAMLSS

I am new to modelling percentage data, and I would be greatfull for some advice. I have proportion data (0,1] on a percentage of money sent by Player B to Player A. Participants received an amount of ...
5
votes
1answer
69 views

How to statistically compare groups for multiple density plots?

Is there a statistical method to compare these density plots other than ANOVA (MANOVA)? I would like to compare the densities among year within each plot and report which of those distributions are ...
1
vote
0answers
19 views

Would this be a problem that Survival Analysis can tackle? The problem deals with localized durations and uncensored data

I am trying to fit a model in R that doesn't have censoring. In other words, I know that each event will eventually happen. There are several experimental groups with people in each group receiving ...
0
votes
1answer
44 views

Random effect significance in linear mixed model

I have performed LRT: ...
0
votes
0answers
13 views

Does the ghyp R package create different GHD random data than the fBasic version?

I have been comparing two packages that are calculating generalised hyperbolic density (GHD) functions as I intend to become more familiar with these. But the results are different for each package. ...
0
votes
0answers
8 views

How can I plot “intcox” interval cox proportional survival curve?

I'm doing survival analysis. I read intcox package manual but it doesn't provide R code for plotting survival curve. Anyone knows how to plot it? ...
2
votes
1answer
59 views
0
votes
0answers
3 views

Create grid and color cells with average values of scatterplot using ggplot2 [migrated]

Given a numeric dataset $\{(x_i, y_i, z_i)\}_{i = 1}^N$, one can create a scatterplot by drawing a point $P_i = (x_i, y_i)$ for each $i = 1, \dots N$ and color each point with an intensity depending ...
7
votes
2answers
76 views

Avoiding numerical error propagation

I simulated a MA(1) process $y_t = \mu + \epsilon_t + \theta \epsilon_{t-1}$ in R and tried to recover the error terms $\epsilon_t$ just by computing them successively (supposing I know the parameters ...
3
votes
1answer
51 views

Design of matrix of contrasts in R

I am doing some post-hoc comparisons (in lme4, but here I'll just present a simple linear model), and I am having a hard time making sure that I am building the right matrix of contrasts to test ...
0
votes
0answers
9 views

In practice, how is the penalisation matrix for splines, created by smoothCon (package mgcv), specified?

Evaluating a smooth object with smoothCon provides, besides several other things, the ordinary "untouched" spline bases ...
0
votes
0answers
15 views

Seasonal vs non-seasonal coefficients in R ARIMA

Let's say I have the two following ARIMA models: ARIMA(7,1,1) (no seasonality) ARIMA(6,1,1)(1,0,0)7 (seasonality of period 7). Are they conceptually the same? If so, why is that when I model ...
2
votes
0answers
22 views

Independence of effects in meta-analysis and meta-regression

In meta-analysis, I know that an important assumption is independence. Clearly, if we want to estimate a pooled effect size, its best if each effect comes from an independent sample of observers. ...
1
vote
1answer
21 views

Is it possible to measure the independent variable with part of the dependent variable

I have Beta as my independent variable and Economic value added (EVA) as my dependent variable. To calculate EVA I need to use Cost of capital and to calculate that I have to use Beta, so is it ...
0
votes
0answers
14 views

JAGS prior-based prediction

I'm trying to use rjags to predict what the curve-maximums will be for different groups of incomplete data (one metric x and one metric y). Here is an example of the indata: ...
0
votes
0answers
15 views

Flexmix to test bimodality [closed]

How to use flexmix in r to check the modality of dataset, for example I have a vector of some 100 numbers how should I apply flexmix to test whether this data has bimodality or trimodality? Thanks.
0
votes
0answers
20 views

In the survival analysis package of R, `survival`, where do we specify the hazard functional form?

I am trying to fit either the coxph or survreg function with the Survival package. I would ...
-1
votes
0answers
41 views

Sales Forecasting using Support Vector Machine

I have sales data for last three years 2011-2013. I want to use Support Vector Machine technique in R to do the predictions. I just wanted to know that the approach that I am using is correct or not? ...
0
votes
0answers
24 views

How to interpret residual plots from time series regression

I am doing a time series regression between 2 variables. I used the dynlm library in R. I'm trying to understand how to interpret the results. Could you please point out where I am getting it wrong: ...
4
votes
1answer
59 views

It it possible in R to specify a regression formula for the hazard rate for a survival analysis model?

I am currently trying to fit a survival analysis model which has the following survival function: $S(t) = \lambda_i e^{-\lambda_i t}$ but with $\lambda_i = e^{\beta_0 +\beta_1 log(1+X_i)}$ where ...
1
vote
0answers
18 views

Inconsistency between 'read.csv' and 'write.csv' in R [migrated]

The R function read.csv works as the following as stated in the manual: "If there is a header and the first row contains one fewer field than the number of columns, ...
0
votes
0answers
17 views

How does one estimate the number of trees and the depth when using random forests?

I am using random forests for a class. I am predicting weight training. In scikit learn I always used a rule of thumb of a depth of 5, the depth x features rounded. I had 53 features, rounded to 50 ...
1
vote
1answer
38 views

why simulated gamma distributed data have negative kernel values?

I know that Gamma distribution does not allow 0 or negative values. I was doing some simulation and when I write this code in R ...
0
votes
0answers
26 views
+50

F-adjusted Mean Residual Test in R

I'm running diagnostics on a logit model in R produced with glm(formula = formula, data = data, family = "binomial"). I'm ...