Tagged Questions

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

nlme estimates near zero variance for the random effects

I am doing various analysis on a small sample. Basically, we have an experiment where 14 subjects (UID 1 ~ 14) used one of the 6 instruments (MID 1 ~ 6) on 3 occasions (Sequence 1 ~ 3). Each time an ...
1
vote
0answers
15 views

How to plot model with forecasts in R? [migrated]

I recently upgraded R from 2.x to 3.1 and I feel like there were some changes that I am not aware of with regards to plotting models. ...
0
votes
0answers
4 views

Why does aov consider a 3x3 factorial design unbalanced?

I have a two factor, bot at 3 levels with all factor levels, and with 5 replicates for each. This is a standard 3^2 factorial design, and yet aov gives the message "Estimated effects may be ...
0
votes
0answers
11 views

Making a neural network model more sensitive to one of its several inputs

I am currently using neural network methods in R to model energy consumption (response) based on temperatures, previous consumption values and weekend dummy variables (inputs). Unfortunately, the ...
0
votes
0answers
16 views

Please help me about Dunnett's test in R [on hold]

I have got a problem about the test of Dunnett's test.Why I cann't run the results. I cannot understand it.Please help me and thanks for the answer.
0
votes
0answers
11 views

Techniques for comparing two windows of data in a time series

I'm working on a small independent project in R, trying to make my own (very crude) forecasting method. The general idea of the component that is giving me trouble is trying to compare two windows of ...
0
votes
0answers
4 views

Rate table in package survexp.fr in R [on hold]

I would like to calculate the similar parameters produced by SMR(...) in SURVEXP.FR package. The question that I have is if I ...
1
vote
0answers
4 views

Linear mixed model construction validation

I have 6 groups of fish made up of 8 individuals. Each group is tested three times under different treatments. These group level treatments are hungry , ...
0
votes
1answer
18 views

R times series — correct use of forecast() and accuracy() in forecast package

Cross-posting this from Stack Overflow, because it's a bit of a stats/ technology cross-over. I'm relatively new to R and the forecast package I believe authored by Rob Hyndman. I'm having trouble ...
0
votes
1answer
33 views

Proportions Test for when one sample has lots of zeros

I tried using chi-squared test, but it is giving me odd results, For example: Let's say that I am testing whether behavior between male and female users is the same. Males only bought 3 units of ...
0
votes
0answers
26 views

Comparing medians from two groups

Hi: I have a survey where respondents were asked to rank a series of statements in terms of how much they agreed with them. There were seven statements. So, for each of seven statements, each ...
1
vote
1answer
15 views

Mixed effects model for power function data

I have data which I suspect follows a power function over time. It is collected from several units which have different intercepts. Therefore I'd like to do a mixed model with the parameters of the ...
0
votes
0answers
13 views

Dealing with non events in one treatment group - survival analysis

I am currently trying to apply survival analysis to several tree species which were monitored for growth and phenology for 4 years and seperated into three treatment groups. From this data I have ...
-1
votes
0answers
27 views

False rejection rate of simulated values in R

I need to create a table of Estimated Rate of False Rejection of Null Hypothesis in testing at the Nominal $0.05$ level for selected $n$ and $k$ in simulating values from the Gamma Distribution with ...
1
vote
1answer
39 views

Multiple Linear Regression Variable Selection

Using all possible subsets we consider the adjusted $R^2$, Akaike's Information Criterion (AIC), corrected AIC ($AIC_c$), and Bayesian Information Criterion. The model with the highest adjusted $R^2), ...
1
vote
0answers
21 views

Using A Time Series To “Scale” Another

I know the "average theoretical cost per impression" for Jan 13 - Dec 13. I have other monthly time series for "total # of impressions", "total # of clicks" and "total number of conversions" for Jan ...
0
votes
0answers
11 views

How to calculate y predictor based on ANCOVA estimates? [duplicate]

My formula looks like this: lm(formula=BearWeight ~ honey + age, data=BearData) my output looks like this I am told to interpret each estimate and then use the estimates to predict the weight of a ...
0
votes
1answer
14 views

Vectorise Within-Groups Sum of Squares in R

I've got a multivariate dataset (p=2) that I'm trying to calculate the W matrix for use in canonical variates analysis If each $x_{kj}$ is the jth observational unit from the kth group, and ...
0
votes
0answers
18 views

KNN Regression in R - using KKNN package [on hold]

I have been trying to figure out how to plot a multiple regression for a training set with the K(KNN regression). The package name is KKNN for R. The line below expresses the multiple regression model ...
1
vote
1answer
20 views

Comparing two sequence objects?

Using TraMineR, is it possible to compare two sequence objects to calculate the discrepancy between them? By this I mean not comparing two sequences but two sets of ...
0
votes
0answers
11 views

individual level random effect for over dispersion

In glms we can use a quassipoison fudge factor to account for over dispersion in our poisson models. In glmms we can add an individual level random effect (e.g. ...
0
votes
1answer
44 views

Customizing a graph with gray regions

I'd like to do a graph similar to this one with the gray regions to point the recessions in my graph. I have R and Excel and Stata, I'm simply trying to make it easy to distinguish the recessions by ...
1
vote
0answers
34 views

Package ‘randomForest’ R defining variable importance in advance

I am planning to build 5 successive random forests (RF) on a same data using r 'randomForest' package. I am leveraging work done as per the page. while building the first RF, each X variable should ...
0
votes
0answers
3 views

nonuniform box plot in r [migrated]

Background: I have data that is bursty and non-uniform in time. I am making boxplots of the data Problem: The boxplot in r is placing them uniformly distant. I would like to place them at an ...
0
votes
1answer
18 views

Correlation of change in expression with response variable

I have paired gene expression data before and after a treatment, as well as an ordinal response variable with 3 levels for each sample after treatment. I am interested in the correlation of the ...
0
votes
0answers
16 views

R ivreg command vs. manual 2-stage method

What is the difference between the ivreg command in R and doing the IV regression by hand in two stages? The estimate is the same, but the standard error is not the ...
0
votes
0answers
11 views

VAR model for price forecasting in multiple time-series context. How to get “real figures” as forecasts?

Sorry for the rather long introduction, but since I was (legitimately) critizised for not explaining my cause and questions enough, I will do so now. I would like to conduct a (price)-forecast based ...
0
votes
0answers
19 views

Repeated measures linear mixed effects model

I am working with trees that were fertilized in a full factorial design (N x P x K) in plots that are replicated four times. I currently have a mixed effects model with this structure: ...
0
votes
0answers
11 views

handling trend in predictor and response variable

I am trying to create a linear regression model containing two predictors and 1 response variable. My response variable has a short term pattern, i.e. surge during weekdays and slump during weekends ...
1
vote
1answer
15 views

How to get random classification to assess the performance of classifier with McNemar test?

I'm trying to replicate a study where the author used the McNemar test to assess the performance of classification compared to random classification. I have the original classifier and I'm using R to ...
0
votes
0answers
22 views

regarding skip the intercept term once it is not statistically significant [duplicate]

After building the regression model, the intercept value is not statistically significant Is that reasonable to just skip it in the final regression model?
0
votes
1answer
50 views

How to do MANCOVA in R?

I have two groups of persons, GRP0 and GRP1, on which I measured three continuous variables: VAR1, VAR2 and VAR3. I would like to use Mancova in R with: - VAR1, VAR2 and VAR3 as outcome variables - ...
-1
votes
1answer
26 views

What does the Argument “type” in VAR() - function do?

Right now I am working with vector autoregressive models in order to make 3 months forecasts for a commodity good (sawlogs) y. I have several time-series of "follow-up-products" of sawlogs that should ...
0
votes
0answers
17 views

Logistic Regression in SAS [migrated]

I have the data below. I wish to apply logistic regression. Here the response variable is the proportion of dead. Here is how I analyzed the data in R: ...
0
votes
0answers
19 views

Which function can calculate my curve? [on hold]

i have a question about a special curve. Can you please have a look at the following picture. What i already have is the diagram without the green curve. It is done with R. No I need to implement ...
0
votes
0answers
14 views

group fixed-effects, not individual-fixed effects using plm in R

I am analyzing some data to evaluate the impact (causal effect) of a program that is delivered at group level (a village). The outcome of interest is measured at the individual level (individuals ...
1
vote
1answer
35 views

Testing Logistic Regression Classifier in R

I am testing the logistic regression classifier in R. I created some test data like this: x=runif(10000) y=runif(10000) df=data.frame(x,y,as.factor(x-y>0)) ...
0
votes
1answer
14 views

R - how to transform the similarity matrix to distance matrix for performing hierarchical clustering?

I am trying to cluster nodes (C1, C2, C3...) of a graph using hclust and my similarity metric is number of links between nodes. I have data like ...
2
votes
1answer
26 views

Type of inference to use with log-linear Poisson glm on contingency table frequency counts

I was doing some log-linear models to test for interactions/associations in multiway contingency tables (based on the tutorial here, http://ww2.coastal.edu/kingw/statistics/R-tutorials/loglin.html). I ...
0
votes
0answers
8 views

R [nlme] Incrementing / Adding units to continuous covariates?

I'm trying to find out how I can change the beta estimates for a continuous covariate in my model from 1-increment to another increment. For example, if I have age in the model, and I want to ...
0
votes
0answers
10 views

How do I create 3 or four classes of diameter from a range of diameters in R? [migrated]

I would like some code that can help create 3 or 4 classes from a range of diameters of wood. For example if my three classes are 1-10cm, 10-20cm, 20-30cm, I would like to add a column to the below ...
2
votes
0answers
12 views

Testing semi-parametric versus parametric model

I am estimating a (semi)parametric and a parametric model for a panel data set, and I want to test the functional form by applying the method proposed by Henderson et al. (2008, p.267). In particular, ...
0
votes
0answers
15 views

Multilevel analysis, individual level and group level

I am investigating whether the air pollutant exposure during pregnancy has an impact on the infants' birth weight. The data I have include: 1)birth weight; 2)monthly air pollutant concentration ...
3
votes
1answer
55 views

impose an intercept on lm in r [duplicate]

I am converting a high-dimensional model to a lower dimensional model by fitting a sliding window of it to a linear (parametric) model and looking at the evolution of parameter values over time. I'm ...
0
votes
1answer
33 views

How to choose the best logit model using step function in R

I have the data below. I was wondering how I could choose the best model fit of logit model using step function in R. Here is the data in R format: ...
2
votes
0answers
33 views

Missing data not at random - Advice needed on method

I have been developing a logistic regression model based on retrospective data from a national trauma database of head injury in the UK. The key outcome is 30 day mortality (denoted as "Survive" ...
0
votes
1answer
27 views

An algorithm to predict one of two values based on a linear model

I would like to run by you an algorithm for predicting one of two values from a testing data set, based on a linear model applied to a training set. Please let me know whether this algorithm makes ...
0
votes
0answers
24 views

Deciding overall similarity measure at each step of hierarchical clustering in r

I want to decide the appropriate number of clusters after using hclust() and drawing a dendogram. I don't have any idea about how many clusters should be there ...
1
vote
0answers
11 views

Heckman's selection / switching model- selection variable as a regressor

I am conducting some analyses on the effects of membership and the membership rank on income. Everyone in the sample can choose to apply to join an organization. The membership is given upon ...
0
votes
0answers
19 views

Dealing with outliers: Clustering

I am working with a dataset in R that I will be doing cluster analysis on and I am trying to determine the best way to deal with the outliers.I have twelve variables and most variables have between ...