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
5 views

Confusion with power spectrum/periodogram generated from a seasonal time series data on R

I currently have a time series data and I believe it has a weekly seasonal trend (based purely eye observation) Here is the file, ...
0
votes
0answers
6 views

Selecting optimization algorithms

I am in the process of developing a multi-state model (using the msm package in R), and have been encountering the error message initial value in 'vmmin' is not finite This error occurs ...
0
votes
0answers
13 views

R: Positive coefficient on price in mlogit model

Here's a subset of my data: http://pastebin.com/28L51WE3 Read in with clogitdf <- mlogit.data(df1, choice= "y", shape="long", alt.var="alt", chid="chid") ...
0
votes
0answers
19 views

Autocorrelation function in R for observational data

I'm trying to replicate an analysis done in Stata with R that involves calculating the autocorrelation for a particular outcome measured in many different areas. I've already run a linear regression ...
2
votes
1answer
42 views

modeling time series data with lm()

After you decompose a univariate time series with stl() function in R you are left with the trend, seasonal and random components of the time series. Is it valid to use those components to then model ...
0
votes
0answers
32 views

Choose the correct regression model

The relation of two measurement values x and y might be linear mod1 <- lm(x~y) ...
0
votes
0answers
6 views

poLCA.entropy function - Latent class analysis [migrated]

I am having a problem when calculating the entropy of my fitted latent class models in poLCA. I have no problem with the results of all the models but I do not know how to solve the following error: ...
0
votes
0answers
19 views

package ‘imputation’ is not available (for R version 3.1.2) [on hold]

I am trrying to impute missing value by using impute function. But when I try ti install imputation package , I got this error: install.packages("imputation") Installing package into ...
5
votes
1answer
36 views

How do I find a p-value of smooth spline / loess regression?

I have some variables and I am interested to find non-linear relationships between them. So I decided to fit some spline or loess, and print nice plots (see the code below). But, I also want to have ...
0
votes
1answer
26 views

How can I compute probability of $X$ with a hyperbolic distribution? [on hold]

I'm modelling some Spread data in R Statistics and would like to understand how I can compute the $P ≥ 0.000$ from my data set. I have run a lik.ratio.test from ...
2
votes
1answer
35 views

Cross-validation and logistic regression

I'm interested in building a set of candidate models in R for an analysis using logistic regression. Once I build the set of candidate models and evaluate their fit to the data using AICc (...
2
votes
1answer
30 views

How to test paired observations

I have a set of data that look like this: ...
0
votes
0answers
18 views

Linear Regression Package [on hold]

i want to use linFit on my dataset in R , which package i need to install for that, I'm having following error > linfit(men$age, men$Record) Error: could not ...
2
votes
1answer
25 views

How does step function selects best linear Models which includes polynomial effects and interaction effects in R?

I try to find "best" linear models with continuous and categorical covariables with Interaction Effect by BIC. The continuous covariables should have a quadratic effect on the response variable. ...
0
votes
0answers
6 views

GLM Interaction term OR+95% CIs calculation in R

I am have built this glm (all variables are binomial, T/F) which summary displays as follows ...
1
vote
0answers
27 views

Testing and correctly interpreting the significance of nested random effects

I'm building a series of relatively simple random effects models where we repeatedly measure a water quality variable, say conductivity (cond), in different watersheds (ws) and streams (st). Here, ...
0
votes
0answers
16 views

Checking assumptions of a mixed model

I was wondering how to check the assumptions of a mixed model in R. Suppose I fitted a model with lmer. Is this what I should do? ...
0
votes
0answers
31 views

R: Interpreting mlogit coefficients

Edit: The subset of the dataframe I provided way giving a different error, so I've replaced the pastebin entry with the full data frame. Here's the top of the data frame, then read into mlogit format ...
0
votes
0answers
15 views

ggplot2, change title size [migrated]

I would like to have my main title and axis title have the same font size as the annotated text in my plot. i used theme_get() and found that text size is 12, so I did that in my theme statement - ...
1
vote
1answer
33 views

Using B-splines within a linear mixed-effects model in R

I am using linear mixed-effect model (run with the lme() function in the nlme package in R) that has one fixed effect, one ...
1
vote
1answer
29 views

Why not use always a binomial exact test to compare two proportions instead of chi square?

I am trying to figure out what test I should use in the following scenario: I know that there is a lot of room for improvement in a specific area at work - being extremely critical, let's say that ...
1
vote
0answers
11 views

What is a case where including random correlation parameters decreases the error on the fixed effects?

I'm wondering about the effect of true correlations among random effects on the standard error of my fixed effects in lme4::lmer models in R. My assumption is ...
0
votes
1answer
28 views

How does caret handle factors?

I have been testing conditional trees and random forests with caret, and I've noticed it does something weird with factors. So, for example, a ctree using the base dataset ...
0
votes
1answer
53 views

Random effects for within subjects study in R

I have data which consists of subjective ratings. The ratings are done by different judges with each subject being judged under different experimental conditions. Each subject undergoes each ...
0
votes
0answers
7 views

glht on gamm results

I have a GAMM model that has both an LME and a GAM part. I have used glht (multcomp) to check significant differences through the code: ...
3
votes
1answer
47 views

ARIMA predictions constant

I've created an Arima model based on past forex closing prices using auto arima, which has generated a (0,1,0) ARIMA model. ...
0
votes
1answer
26 views

Best prediction model for binary data

I have a large medical data set (100.000+ patients), and have many variables (but selected 20 most interesting ones - 15 of these are binary). I want to make a model that predict if these patients ...
0
votes
0answers
15 views

Can I Use Distance Matrix (Weighted) For GLM Fit (Using R)

I am new to statistics but a business user liking to base my decisions on prediction models. And I am relatively new to regression. I have data in the below format. (I have used only imaginary ...
0
votes
0answers
4 views

what is the relation between significance level and forecasting values

From the past data we estimated the future values in R with default level of significance but my doubt is if we increase or decrease the significance value then how much change will be there in ...
0
votes
1answer
25 views

Conditional Indicator Coefficients: Multiple Linear Regression in R

I'm trying to create a regression model for a set of data that includes time and temperature, among others, for 30 minutes intervals throughout the course of a month. I want to build a model that ...
1
vote
1answer
57 views

Linear regression model mistakenly gives $R^2$ equal to 1

I'm using R to create a linear regression model from survey data about public sentiment for a new technology. I am encountering a problem where the addition of a new explanatory variable raises the ...
0
votes
1answer
20 views

What is the proper way to do vector based linear regression in R

I want to do linear regression between vector inputs and vector output. That is each y is a vector with M components, and each x is a vector with N components and the answer should look like y ~ Ax + ...
0
votes
0answers
26 views

r linear regression mistakenly giving me r2 value of 1 [duplicate]

I'm using R to create a linear regression model from survey data about public sentiment for a new technology. I am encountering a problem where the addition of a new explanatory variable raises the ...
0
votes
1answer
16 views

Test to determine correlation between organism size and concentration?

I have a gamma distribution. I am looking to determine if higher concentrations of a toxin are correlated to larger organism size. I think a non-parametric test would be best, but I'm not sure which ...
0
votes
0answers
7 views

r code/test to determine correlation between organism size and concentration?

I have a gamma distribution. Looking to determine if higher concentrations of a toxin are correlated to larger organism size. I think a non-parametric test would be best, not sure which one. Also ...
0
votes
0answers
5 views

Calculating 2 hourly average of data [migrated]

I have flow data for a year. I want to get the 2 hourly averages of the data and make a timeseries that records the average flow for the two hours along with the timestamp. The data look like this: ...
1
vote
0answers
24 views

Optimizing a time-series with multiple predictors

I have a few questions about turing a univariate time series into a multivariate time series and optimizing the predictors. Here is the univariate data: ...
1
vote
2answers
14 views

credible interval equivalent of confint() for bayesglm() in Gelman et al's 'arm' package?

How do I extract a credible interval ala confint on a glm object when working with the object returned by bayesglm() in arm?
0
votes
0answers
12 views

LCA not returning the same results with the same data

I'm pretty new to Latent class analysis, and I obviously still have a lot to learn. I have a data set with 10 000 observations and 20 variables. I'm trying plot the probabilities of each of my ...
0
votes
0answers
10 views

Why is MeanDecreaseGini over 1 in RandomForest package in R? [duplicate]

I am using R package randomForest, and calculated MeanDecreaseGini as below. ...
0
votes
0answers
2 views

How can I create multiple bar charts at once (in R)? [migrated]

I have a data set that includes Likert-type ratings of a bunch of around 20 measures. In my head I have an image of one long chart with 20 plots showing the distribution for each question. Using ...
1
vote
0answers
16 views

R: Export CrossTable to Latex [migrated]

Is there a way to export a CrossTable (from the gmodels package) to Latex? So if I do : ...
0
votes
0answers
10 views

Forecasting with a trained hidden markov model (using r?) [on hold]

if I have a trainned hidden markov model i.e. the transistion and emission probability matrix are known, how do I make a prediction of let say 2 or 4 time steps ahead? Thanks, Andrew
0
votes
1answer
22 views

Chi Square distribution with degree of freedom 3

For X following a Chi-square distribution with degree of freedom m = 3, I want to compute P(1 < X < 4) Would it be, ...
0
votes
0answers
9 views

r cluster analysis of neurons

I am trying to run a cluster analysis in R to determine which neurons are putative dopamine neurons. I am thinking about using a k means cluster analysis. Is there any cluster analysis that specifies ...
1
vote
0answers
35 views

interpreting PERMANOVA (adonis function) output?

I am trying to look at expression of some genes and relate the dist matrix (Sm) to a number of different factors that I collected on the individuals (e.g., litter size, licking behavior, group housing ...
0
votes
0answers
11 views

Fieller's Theorem Equation computation with R programming [on hold]

Given that this is a fairly common used theorem, I am hoping someone has already used the R programming Language and console to work with this equation. Having a limited understanding of the ...
0
votes
1answer
12 views

R glmnet - appropriate link function for log-loss

I have a 2 class classification problem that I'm trying to optimize the log-loss for (not ROC/AUC). I'm using the glmnet package in ...
0
votes
0answers
20 views

Coverage probability Poisson - R [on hold]

I am trying to figure out in R a graph that displays the coverage probability of the confidence intervals for a parameter of a Poisson. I am taking as benchmark paper Brown, Cai & Dasgupta (2003) ...
2
votes
2answers
16 views

How to interpret p-values in output of seqecmpgroup()?

The seqecmpgroup() function returns a table that, among other things, include p-values for each identified subsequence. How should these be interpreted? I can see ...