R is an open source programming language and software environment for statistical computing and graphics.
0
votes
0answers
4 views
R Matrix process with conditional additions
I have to pre-process a big matrix. To make my example easier to understand I will use the following matrix:
Raw data
$\begin{array}{ccc}
18 & 0 & 14\\
12 & 13 & 0\\
15 & 0 & ...
1
vote
0answers
10 views
Repeated Measures in R, SAS or SPSS: Whale Body Temperature Data
I have a question regarding a repeated measures experiment. I have 5 whales (randomly selected) that I recorded body temperature on. Data was collected via satellite, programmed to transmit records at ...
1
vote
0answers
8 views
0
votes
0answers
10 views
ARIMA forecasting with external regressors
I am trying to build ARMAX models using auto.arima. I have a time series to forecast (weekly and monthly seasonality, I've put the ts() frequency=7), another two variables as external regressors, as ...
0
votes
1answer
37 views
Investigation to assess interaction of two predictors using R software
In preparation for my end of semester R exam, I've been working on the following CSV file which was modelled on R, which I'm currently having problems figuring out.
To investigate this issue I ...
1
vote
1answer
37 views
Which is the best accuracy measuring criteria among rmse, mae & mape?
I have created training set and test set from my data. Then I performed auto.arima() and ets() in R on the training set to predict one-step ahead forecasts. These were then compared with the test set ...
0
votes
0answers
25 views
Select best set of binary variables for clustering known sample labels
I have a set of samples, for which I know the "true groups". For this samples I have about 200 binary variables, I would like to know a method to select the subset of variables, that gives me a ...
0
votes
0answers
38 views
AIC vs BIC vs MDL
I am trying to learn the difference between the three approaches and their applications.
a) As I understand,
AIC = -LL+K
BIC = -LL+(K*logN)/2
Unless I am ...
0
votes
0answers
41 views
R linear model summaries, why is one model “better” than the other?
I am attempting to get my head around the summaries of linear models given within R. In other words i am trying to identify when the summary of a model is good or bad. Consider the following two ...
0
votes
0answers
33 views
How to compare 2 regression slopes with R?
I have to compare the slopes of 2 regression lines with R. The 2 regressions are made with the same parameters in 2 different locations.
I did my regressions with the function lm(). Now I have the ...
0
votes
1answer
64 views
2
votes
1answer
39 views
Interpolation of influenza data that conserves weekly mean
For each week, I have the following count data (one value per week):
Number of doctors' consultations
Number of cases of influenza
My goal is to obtain daily data by interpolation (I thought of ...
0
votes
0answers
9 views
How to load arrays with 3 dimension using R2WinBUGS? [migrated]
Since WinBUGS and R have different ways of organizing data for arrays, how should I organize the data when using R2WinBUGS so that the order is correct? Thanks!
0
votes
0answers
15 views
In R, how to add a one-step-ahead forecast to a timeseries, using nothing but the forecast package? [duplicate]
I am wondering if its possible to add a one-step-ahead forecast to a timeseries, using nothing but the forecast package in R?
To avoid lookahead bias, this would involve running ...
2
votes
0answers
17 views
Repeated measures ANOVA in R for non-orthogonal design
I have data from a two-factor within-subjects experiment design where the conditions are not orthogonal. Factor one (Location) has three levels; factor two (Stimulus) has three levels, one of which is ...
1
vote
1answer
46 views
Fisher's method for combing p-values - what about the lower tail?
I have a bunch of independent p-values and now I want to combine them using the Fisher's method. Each of the individual p-values is coming from a one-sided test. I am just a little bit confused about ...
1
vote
1answer
51 views
Why are my prediction intervals a little too narrow?
I'm trying to make a little function to make population-level predictions from a model that includes random effects, which in turn was fit using a package that doesn't support ...
1
vote
1answer
31 views
Why R function Chol() breaks for Hilbert matrices of order n > 12
Is there any theoretical reason that Chol() in R breaks for Hilbert matrix of order greater than 12?
Thanks,
1
vote
0answers
21 views
R module for creating plots of prototypical individuals from fitted models?
In order to help interpret fitted models — especially those with interaction terms and non-linear components — I've found it useful to plot predicted values of a dependent variables for what we might ...
-2
votes
0answers
36 views
How do I calculate (age-specific) mortality rates in R? [migrated]
Using data in the following form, in which ways can I calculate the (age-specific) mortality rate in the R programming language?
...
2
votes
0answers
36 views
Variable selection / Dataset reduction for large datasets (in R)
I'm working on a behavoural scorecard modelling exercise, and many of the decisions taken to date have been based on the experience of a consulting credit analyst (whose experience software-wise is ...
2
votes
0answers
25 views
Best practices for dealing with shifting, inconsistent seasonality
This question is related to a previous post I've looked at (Calculation of seasonality indexes for complex seasonality), but deals with more granular data (daily instead of weekly), and transforming ...
1
vote
1answer
32 views
ARIMA and external regressors in SAS and R
So I remember reading somewhere that when we have external regressors, auto.arima cannot make correct predictions for the order of difference for either ...
0
votes
0answers
31 views
Reconstructing time series data with missing values from external data source
I have a 100 year time series. But the first 30 years are missing. So I correlated the 70 years that I have with another (100 year) time series to predict back / reconstruct the missing values. For ...
-1
votes
0answers
16 views
Plot specific values on x axis using plot() in R [migrated]
Let's say I have some points:
a=c(1.234, 23.332, 3.433, 34.53)
b=c(112, 234, 221, 23)
I would like to plot them by having "a" on the x axis and "b" on the y ...
0
votes
0answers
33 views
Mapping gini index
In my model, there are 3 players, whose income is function of two arbitrary parameters. Say, ...
-1
votes
0answers
20 views
How to plot a scatter diagram using rpy2 in python [closed]
I have a dataset like below in dictionary format,
...
0
votes
0answers
30 views
NMDS: why is the r-squared for a factor variable so low
I am doing an NMDS ordination. The data come from a number of sites scattered around two lakes. In the plots, I coloured the samples from the two lakes blue and green. There seems to be some pretty ...
0
votes
2answers
75 views
How to interpret the output of the summary method for an lm object in R? [duplicate]
I am using sample algae data to understand data mining a bit more. I have used the following commands:
...
0
votes
0answers
20 views
R: obtaining marginal effects from survreg model [migrated]
Could someone quickly explain how to obtain marginal effects from a weibull duration model of the form:
...
2
votes
0answers
39 views
Procrustes Analysis of 3d point cloud without defined landmarks
I am working with several hundred 3d point clouds generated using a 3d scanner and would like to be able to compare their shapes using something like a procrustes analysis. Instead of manually ...
1
vote
0answers
20 views
Computing $\eta_P^2$ from $\eta_G^2$ generalized eta for G*Power
I am trying to perform a power calculation using G*Power. I need $\eta_P^2$, but the ez package for R gives me $\eta_G^2$. I understand the reasons for it doing this, but I still need $\eta_P^2$ for a ...
1
vote
1answer
39 views
How to output varimax-rotated data in R?
I have ran PCA on 25 variables and selected the top 7 PCs using 'prcomp'.
prc <- prcomp(pollutions, center=T, scale=T)
I have then done varimax rotation on ...
0
votes
1answer
29 views
Simple Mixed Model with 1 Fixed and 1 Random Effect
I have various datasets I need to analyse regarding soil properties, all in the same fashion, with one fixed effect (which is a position along a transect, indicating different land uses). Now my main ...
2
votes
0answers
34 views
Dummy variables for time series
I'm a new user on R. I'm stuck on my times series research currently with the some questions. Not sure anyone can help me.
Dummy variable.
I wanted to add more than 1 dummy variable in the model. ...
0
votes
0answers
12 views
Pairs Formula function programming in R, upper, middle lower levels [migrated]
I'm having a difficult time programming the pairs function in r, so i can setup upper, middle and lower panels of correlation, histogram and loess respectively. My panel Data looks like this: ...
1
vote
0answers
14 views
How to specify a path model with exogenous variables jointly affected by an unmeasured variable
I’ve simulated some data consisting of one response variable (‘y’) and two collinear predictor variables (‘Amount’ and ‘MPS’), where collinearity arises from one of two causes: (1) Amount causes MPS, ...
0
votes
1answer
25 views
GLM conditional distribution from R GLM
I want to obtain the full distribution of a Gamma (or Inverse Gaussian) distributed $y_i$ given a vector of $\bar x_i$ that have been used in the linear predictor of a coefficient. Suppose also for ...
0
votes
0answers
4 views
Operating on multiple matrices in a for loop using R [migrated]
I have 1000 matrices named A1, A2, A3,...A1000.
In a for loop I would like to simply take the colMeans() of each matrix:
...
0
votes
0answers
18 views
Specifying a correct full model for an unbalanced repeated measures design in R lme4
Recently, I have done a fairly complex experiment, and I am having trouble coming up with a model that is suitable for the data. I have spent a few days reading about, e.g., when random effects should ...
0
votes
0answers
10 views
Change variable name in for loop using R [migrated]
I have a for loop:
for (i in 1:10){ Ai=d+rnorm(3)}
What I would like to do is have A1, A2,A3...A10 and I have the variable i ...
0
votes
0answers
22 views
Plot normal probability for effect estimates in factorial design in R
I have 2 level Design (DOE) with 4 factors (A,B,C,D). I've already calculated the estimates for each main effect and all the interaction effects.
How can I construct the normal probability plot to ...
0
votes
0answers
26 views
Confusion matrix with low incidence rate
I am trying to use a binomial regression to predict customer churn. A reproducible example is below. In the example, there is about 5% latent attrition and customers with a price above 200 have a 15% ...
-4
votes
0answers
14 views
Choosing highest number in vector and knowing its position in R [migrated]
I have a vector in R:
y=c(-29.900900, 5.728916, 35.234331, 11.854811, 61.309519, 50.432798, -27.654741, 21.413622, -10.805339, -37.504199)
I would like to ...
3
votes
5answers
371 views
Generate three random numbers that sum to 1 in R
I would like to generate three random numbers and then standardize them so that they add up to 1.
I would like to repeat this procedure so that in the long run the mode is .33 for each number.
3
votes
0answers
33 views
How to build a model where variance depends on covariate?
I have what I believe is a very simple problem for anyone used to modelling with unequal variances (which I am unfortunately not). I have a dependent variable "totrich" which I want to model as a ...
2
votes
1answer
38 views
Iterative Proportional Fitting in R
The mission
I am trying to find a way to do Iterative Proportional Fitting in R. The logic of the procedure is like this: one has a table with e.g. sample distribution of some variables. Let us say ...
0
votes
1answer
41 views
Fit of a normal distribution to a one-dimensional dataset in R
I've got a set of (continuous) values from a measurement, where each object should be either positive or negative, and I know that the values of the "negative" objects should be approximately normally ...
0
votes
0answers
24 views
0
votes
1answer
61 views
First steps learning to predict financial timeseries using machine learning
I am trying to get a grasp on how to use machine learning to predict financial timeseries 1 or more steps into the future.
I have a financial timeseries with some descriptive data and I would like to ...

