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 use `R`.

learn more… | top users | synonyms

0
votes
0answers
14 views

Comparing r^2 values?

Short version: I have two values of r^2, one 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 ...
1
vote
1answer
9 views

Condensing spatial time series data and spatial interpolation

I have spatio-temporal albedo (roughly, the 'reflectivity' of earth's surface) dataset, from NASA's MODIS satellite, for a 130 square kilometer area. The dataset contains raster files in the NetCDF ...
0
votes
0answers
7 views

standard error and liklihood for nested parameter estimations

Pursuant to this question, I am attempting to fit the model $$runoff = \beta_0 + \beta_1(antecedent + C*precip)$$ with a breakpoint in $antecedent+C*precip$ I would like to estimate $C$ and the ...
0
votes
0answers
21 views

First linear regression - interpreting results to guide next step?

This is my first time attempting to build a linear regression model and I am not sure what to do next given the results I have. I have a data set with 24 predictors and 1 response and there are 999 ...
0
votes
0answers
7 views

Nested ANOVA with 3 random effects and unbalanced design

I would like to run a nested ANOVA to test three random effects (secteur, loc nested in secteur, site nested in loc) on the variable A. The design is unbalanced so I used lmer instead of aov. However, ...
0
votes
0answers
18 views

Test for ANCOVA validity in R

I have a function Y ~ X + trt; where for each trt (treatment group), I have Y and X which correlate with one another. Basically, I want to use ANCOVA to estimate the model parameters, but I don't ...
1
vote
1answer
15 views

R mtcars dataset - linear regression of MPG in Auto and Manual transmission mode

I was looking at the mtcars dataset and explore the relationship between MPG and the transmission modes (auto/manual). I choose to use the following linear models with the regressors specified in the ...
0
votes
0answers
39 views

Testing normality [duplicate]

How can I (in R) test whether the given data set is normally distributed? I read related questions suggesting shapiro.test. Unfortunately, according to wikipedia, ...
1
vote
0answers
18 views

R: fractionally cointegrated vector autoregressive model with error correction

I can find packages for VECM (vars,urca, tsDyn) but I cannot find: fractionally cointegrated vector autoregressive model with error correction (FVECM). There is a package in MATLAB that deals with ...
0
votes
0answers
22 views

Is it possible to reduce Fisher's non-central hypergeometric distribution from a multivariate to a univariate equivalent?

Is it possible to combine the odds for two or more groups of balls in a multivariate version of Fisher's non-central hypergeometric distribution to give a univariate equivalent? For example, this ...
0
votes
0answers
21 views

Auto insurance claim modelling

I am really struggling with finding the best model for predicting claims with my third party motor insurance data. First of all, I am not sure whether I have done correctly with the grouping of ...
0
votes
0answers
8 views

Caret and GBM: task 1 failed - “arguments imply differing number of rows: 0, 9902”

I'm trying to run a GBM with caret with the code below: ...
0
votes
0answers
4 views

Purpose of multiple models with fixed slope

I'm fairly ignorant when it comes to fitting models, and I'm having trouble grasping the point of fitting more than one line with the same slope. Is this generally used in a context with factors, ...
3
votes
1answer
45 views

Daily Time Series Analysis

I am trying to do time series analysis and am new to this field. I have daily count of an event from 2006-2009 and I want to fit a time series model to it. Here is the progress that I have made: ...
0
votes
0answers
12 views

Mechanics of converting success/failure values to logit in glm?

While I am reasonably comfortable with performing and interpreting the output from logistic regression using glm in R, I had a question about the mechanics of the calculation to better understand what ...
-3
votes
0answers
18 views
1
vote
0answers
22 views

Use lmer to test main effects and interaction

I have to solve a problem using a linear mixed model (lmer). Six subjects performed two tests, (test1, ...
1
vote
1answer
23 views

What is the test statistics used for a conditional inference regression tree?

In Hothorn et al, the test statistic is specified as $$ T_j(L_n, w) = vec(\sum w_i g_j(X_{ji}) h(Y_i, (Y_1,...,Y_n)^T))$$ What is the exact form of this test statistic with a continuous response and ...
2
votes
1answer
32 views

Finding how many times I need to perform an action before I have an x% chance of a specific outcome in r

Non-specific question: There is an action that can be performed that has multiple outcomes. Each outcome has a different probably, p, of occurring. How many times, n, do I need to do the action before ...
0
votes
0answers
19 views

Panel data - industry average calculation in R

I have panel data with many observations of companies' financial indicators that could be grouped by year and industry. What should I do if I need to adjust each observation by the yearly industry ...
0
votes
0answers
24 views

multiple linear regression analysis with continuous and categorical data result interpretation

I have data from gene expression arrays and I have clinical data associated with the samples used. I am using gene expression (discrete), age at diagnosis (discrete) and ethnicity (categorical) to ...
0
votes
0answers
10 views

Isolate 10% of observations based on conditions [migrated]

My data frame has a 10 columns and 100,000 rows, each row is an observation and the columns are data pertaining to each observation. One of the columns has the date of an observation in the Julian day ...
0
votes
0answers
28 views

Replicating SPSS factor analysis/PCA in R [on hold]

I am trying to replicate SPSS factor analysis/principal component analysis results in r using two previously suggested methods, but neither has succeeded. (What are the differences between Factor ...
0
votes
0answers
7 views

Specifying interaction term within nested factors in lmer [on hold]

I'm trying to understand how to include a nested term within an interaction effect in a mixed model ANOVA. Data: Factor A (Fixed) Factor B (Random) Factor C (Random) Factor D (Random) Model: ...
4
votes
2answers
41 views

Variance of slope

I have a bunch of data that I fit a linear regression to, and now I need to find the variance of my slope. Is there an analytical way to get this? If an example is necessary, consider this my data in ...
-2
votes
0answers
16 views

optimizing Average Run Length [migrated]

How can I code in R to solve for $p$ in $370=(1/p)(1/[1-(1-p)^L]),\ L=1,2,3,...$ and get the positive values of $p$ at different values of $L$ even when $p$ is at the right hand side of the equation. ...
3
votes
1answer
34 views

Getting an Excel file with many sheets into R [on hold]

I am importing data from an Excel file that contains 15 sheets. Each sheets represent a year in which there are observations on the same variables. Here is what I would like to do (elgantly) from R: ...
1
vote
0answers
21 views

Different results based on two target rotation approaches

I am trying to do some data analyses based on target rotation in R using two different approaches. Here is a small simulation in r. ...
2
votes
1answer
27 views

How to perform a simple smoothing forecast for next 12 months (using forecast package in R) [on hold]

I currently have timeseries data (of gold prices) and I am trying to use a simple smoothing forecast to estimate gold prices for the next 12 months. I am not sure what function to use to accomplish ...
0
votes
1answer
22 views

lmer syntax for a two-way model with one fixed and one random factor [on hold]

Please could anyone tell me if my R code is correct? I have a two-way model with one fixed factor, habitat, and one random factor, site. The code I am using is: ...
0
votes
1answer
23 views

Applying randomforest algorithm (fit) on new data without recomputing the fit [on hold]

I have a need to do realtime predictions for individual rows of data based on a previously computed randomForest algorithm. How can I run the "predict" command without recomputing "fit" on the entire ...
0
votes
1answer
27 views

Post hoc analysis for linear mixed model with nested effects

I'm having trouble in R with my Linear Mixed-Effects Model. I'm working with yeast in nectar. This is a part of my data just so you can see what is going on: For the condition sucrose, I have 4 ...
0
votes
0answers
24 views

How to interpret the coefficients from Dirichlet Regression?

I have a response Y, which consists out of 5 response variables which are proportions and for each observation, add up to 1. I'm tying to regress these with a set of independent variables. As I ...
0
votes
0answers
12 views

nnet function in R

I have 7 input variables,2 hidden neron and 1 output variable.the train sample are 50.I used nnet function in R to train my network but it returns 187-2-50 network with 526 weights means 187 inputs ...
0
votes
0answers
25 views

how to debug the error in R codes [on hold]

I used the 'neuralnet' package in R to train the network, but it gave me the error such as below: ...
0
votes
0answers
24 views

Are there peer-reviewed psychology or neuroscience journal articles that include the raw data (data set)? [on hold]

I am hoping to carry out a pedagogical analysis of a peer reviewed paper. This would be easier with the raw data its self, in additional to the results section of the paper.
0
votes
0answers
4 views

Implications of using fixed effects to account for hierarchical data structure

I am currently implementing a hidden Markov model in R, using the msm package. The data I am using are drawn from a cluster-randomized trial; i.e. there is a ...
0
votes
0answers
11 views

Generating markovian paths

given a 4 by 4 transition matrix P, I want to simulate m Markovian paths of length n I created this function can anyone tell me if this is is correct ? ...
0
votes
0answers
11 views

R - Combining and visualising spatial data [migrated]

I'm trying to combine some spatial data with a csv data frame then produce a visualisation of some features of the result using ggplot2. When I combine the data and then try to fortify the result so ...
0
votes
0answers
23 views

What is the use of as.numeric() in R? [migrated]

this is Ex.1 on Page 252 in Statistics and Data Analysis for Financial Engineering by Ruppert: This problem and the next use CRSP daily returns. First, get the data and plot the ACF in two ways: ...
2
votes
0answers
19 views

Can complete separation between a continuous predictor and a random effect cause failure to converge in a logit GLMM?

I’m running a logit mixed-effects model on binary data with a 2x2 within-subjects design, with subjects and items as crossed random effects, and the two independent variables deviation-contrast coded. ...
0
votes
1answer
35 views

Subset data in R [on hold]

I have several time series and want to regress the dependent variable on the explanatory variables. My question is: Because of structural breaks in my series I do not want to include all the ...
0
votes
0answers
11 views

graph classification task - multi label?

I have a data set in graph format representing semantic connection between terms. The data set is divided into clusters, each with several labels (not unique, or mutually exclusive, no set number of ...
1
vote
0answers
47 views

What is the difference between lm(log(y) ~ x) and glm(y ~ x, family = gaussian(link = “log”))? [duplicate]

Is all in the title. I would like to know if there is any difference in terms of coefficients, residuals, p-values, but also conceptually.
0
votes
0answers
15 views

Interpretation of multinomial probit using MNP package

I used MNP to analyze the election in 1992 and I want to know the probability that non-partisan voters vote for Bush when the personal economic condition varies and the effect of education is ...
0
votes
1answer
21 views

How to do power analysis for two-way analysis of variance? [on hold]

The pwr library can be used to do power analyses when testing with 1-way analysis of variance. Are there similar libraries for 2-way ANOVAs? How could I got about doing this in R?
1
vote
1answer
55 views

Likelihood ratio tests using ML vs. REML

I am using Mixed effects models (nlme package in R) to choose the model with the best random and fixed effects. I am following the procedure of Zurr et al. (2009) ...
0
votes
0answers
14 views

Test if two means are significantly different in R [duplicate]

I would like to test if two means are significantly different from each other. I am using R and I do this: t.test(SampleA,SampleB) and I get output that looks ...
0
votes
0answers
12 views

Summary statistics for imputed data from Zelig & Amelia [migrated]

I'm using Amelia to impute the missing values. While I'm able to use Zelig and Amelia to do some calculations... How do I use these packages to find the pooled means and standard deviations of the ...
0
votes
0answers
9 views

Plot histogram using ggplots to be similar as hist() in R base [migrated]

I am new with ggplot2. I am using it to plot a histogram. Here is the code ...