Re: [R] convert numeric variables to factor

2018-04-09 Thread Samantha Smith
Cool  William i'm 100 sure you and me we can have a good time together. Just 
trust me okey.. Am not an escort ok so plz dont think me like that.

I just need you to prove you are not minor and safe.

My friends also here with me while am writing you. If you can come now you 
can ride us both. Just give me a call. Here’s http://cpafull.go2cloud.org/aff_c?offer_id=10965aff_id=11243;>Verify 
to See my profile

Again I did attach pic of mine also. How is that?  Come and treat us in real 
plz. To prove to you that im real, your Name is William Caver it  ,i hope now 
you believe that I’m real. 5+7 =12 am i right ??


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] convert numeric variables to factor

2018-04-09 Thread Samantha Smith
i am seriously meet up with you. if you're interested in getting to know me 
Then sent me about your details . William Im really serious!


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Heteroscedasticity in a percent-cover dataset

2016-04-15 Thread Lai Wen Ya Samantha


Hi,

I am currently trying to do a GLMM on a dataset with percent cover of
seagrass (dep. var) and a suite of explanatory variables including algal
(AC) and epiphyte cover (EC), rainfall, temperature and sunshine hours.

M2=glmer(SG~AC+EC+TP+SS+RF+(1|Location/fSi/fTr),
family=binomial,data=data,nAGQ=1)

As the dependent variable is percent cover, I used a binomial error
structure. I also have a random effect due to nested of the data collection
strategy. However, I keep getting heteroscedasticity issues as shown in the
image below. I have tried using an arcsine transformation (with a lme), but
the scatter of residuals are still very much similar.

What else can I do to try to resolve the heteroscedasticity in my data? Any
help will be very much appreciated!







[http://r.789695.n4.nabble.com/file/n4719735/Heteroscedasticity.png]

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plotting legend outside of chart area

2015-06-24 Thread Samantha Allcock
Hello,

I am trying to add a legend to my PCA plot so that it looks neat. I think 
plotting this outside of the chart area would be good but I cannot seem to 
fathom the correct code for this. I wondered if anyone could help please?

The code I am using is as follows:

grp- with(Matan, cut(R_category_no,14, labels=1:14))
cols - c(grey0, wheat, red, cyan, orange, darkolivegreen2, 
purple3,
royalblue, burlywood4, orchid, forestgreen, green,
gray, yellow1)
plot(geopca, display=sites, scaling=3, type=n)
points(geopca, display=sites, scaling=3, col=cols[grp], pch=16)

legend(bottomright, col=c(grey0, wheat, red, cyan, orange, 
darkolivegreen2,
purple3, royalblue, burlywood4, orchid, forestgreen, green,
gray, yellow1), c(Control type 1, Control type 2,
External/Courtyard, Midden, Animal Occupation,
External fire installations and ashy deposits,
Internal fire installations and ashy deposits, Hearth make-up,
Floors and surfaces, Plasters and clay features, Storage features,
Platforms and benches, Mortars, Roofs and roofing materials), pch=16,
cex=0.75, bty=n)

Thank you for your time in advance


Dr Samantha Lee Allcock
Faculty of Science and Technology
Department of Archaeology, Anthropology and Forensic Science
Christchurch House Rm: C133
Bournemouth University
Talbot Campus
Poole
BH12 5BB
Tel: 01202 9(62474)

sallc...@bournemouth.ac.ukmailto:sallc...@bournemouth.ac.uk
research.bournemouth.ac.uk/2014/07/inea-project-2


BU is a Disability Two Ticks Employer and has signed up to the Mindful Employer 
charter. Information about the accessibility of University buildings can be 
found on the BU DisabledGo webpages This email is intended only for the person 
to whom it is addressed and may contain confidential information. If you have 
received this email in error, please notify the sender and delete this email, 
which must not be copied, distributed or disclosed to any other person. Any 
views or opinions presented are solely those of the author and do not 
necessarily represent those of Bournemouth University or its subsidiary 
companies. Nor can any contract be formed on behalf of the University or its 
subsidiary companies via email.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] deviance as a goodness of fit in GLM

2014-07-21 Thread Samantha PameLa




Good day everybody, 
 
I'm a marine biologist student, working on my bachelor thesis and I'm stucked 
with a statistical doubt in the process, I hope someone here could help me. My 
thesis aims to understand which biological and environmental factors influences 
the male aggressive rate of male California sea lions. For that purpose I'm 
using GLM’s where the response variable is the male aggressive rate. Right now 
I am testing the goodness of fit of the global models and for that I'm using 
the deviances as a goodness of fit test. I calculated pseudoR2 (Zuur, 2009) in 
order to know the percentage of explanation of each candidate model. However 
I’m not sure how to choose the “good models”; since I am not sure over which 
percent of explanation indicates a “model with good fit”. For my data I am 
working with three different scenarios, and it seems that 20%, is a good value 
to could indicate the best models, but I’m not sure how to choose the value.
 
I thank you in advance for your time and the help you can give me.
 
Best regards,
 
Samantha.




  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fitting this data with a gaussian would be great

2013-02-22 Thread Samantha Warnes
Hello,I'm still working with this data set, and trying to fit it with a 
nonlinear model. Here is my data
 small - 
 c(507680,507670,508832,510184,511272,513380,515828,519160,525046,534046,547982,567124,590208,614506,637876,656846,669054,672976,668800,656070,637136,614342,590970,570752,554480,542882,535630,531276,528682,527682,527020,526834,526802,526860)


test - glm(dnorm(x), data=small)
Error in formula.default(object, env = baseenv()) : invalid formula


I have tried a variety of options for the formula with the same effect. What I 
want to do with this data is simply fit it with a non linear model, most likely 
a gaussian.


Thanks in advance,
Samantha

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Tracking time-varying objects with the DLM package (dynamic linear models in R)

2013-02-20 Thread Samantha Azzarello
Hello all,

I am working with the dlm package, specifcially doing a dlm multivariate Y
linear regression using
dlmModReg and dlmFilter and dlmSmooth...

I have altereted the inputs into dlmModReg to make them time-varying using
JFF, JW etc.

How do I track the results of the time varying system matrices?
For example what I am really interested in is JW - my system variance matrix
for each time period - I cannot get R to give
me the array of this matrix

Any help would be really appreciated!
Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/Tracking-time-varying-objects-with-the-DLM-package-dynamic-linear-models-in-R-tp4659211.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fitting a gaussian distribution to a plot

2013-02-20 Thread Samantha Warnes
I have a peak I would like to fit with a gaussian distribution, and am having 
difficulties. First of all I am having difficulties getting R to except my 
function input, and additionally I am having trouble plotting the non linear 
model on my scatterplot of data (the peak). Here is my log:

 small - 
 c(507680,507670,508832,510184,511272,513380,515828,519160,525046,534046,547982,567124,590208,614506,637876,656846,669054,672976,668800,656070,637136,614342,590970,570752,554480,542882,535630,531276,528682,527682,527020,526834,526802,526860)
 plot(small)
 mean(small)
[1] 563996.7
 sd(small)
[1] 55996.21

 x -c(0:35)
 x -as.numeric(x)
 f - ((1/(55996.21)*sqrt(2*pi)))*exp^(-((x-563996.7)^2)/(2*(55996.21^2)))



Error in exp^(-((x - 563996.7)^2)/(2 * (55996.21^2))) : 
 non-numeric argument to binary operator



From this point, to fit a non-linear model so I type nlm(f,507680)? I have 
tried reading up on this and looking for additional information on the 
internet but I am truly stuck. Thank you in advance!
Samantha

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Constraining parameters using tag() in SUR model - ZELIG

2012-09-13 Thread Samantha Azzarello
Arne,
Thanks for the help. Ill make sure to cite systemfit along with Zelig.

I cannot see how to constrain  parameters based on the manual when there is
more than 2 eqs using the M Matrix. 
I have 10 eqns with 6 parameters each and need to constrain all 6 across the
10 equations.
For example B1s need to be equal in all 10 eqns, B2 need to be equal in all
10 eqs stc.
Can you assist in a brief example? 

I am using this in conjunction with a few Perl porgrams already written -
but
I am open to switching everything I have directly to systemfit if I can get
teh parameters constrained

Thank you



--
View this message in context: 
http://r.789695.n4.nabble.com/Constraining-parameters-using-tag-in-SUR-model-ZELIG-tp4642927p4643037.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Constraining parameters using tag() in SUR model - ZELIG

2012-09-12 Thread Samantha Azzarello
Hello all,
I am following some standard code from Zelig manual when using a SUR
(Seemingly Unrelated Regression Model) to constrain parameters across
equations.
Please see code below:

setwd(C:/Research/Economics/SUR_FX/Model)

# Seemingly Unrelated Regression
# Load our library.

library(Zelig)
library(systemfit)
library(zoo)

# data.

factors - read.table(./RFactors.txt, header = TRUE)
returns - read.table(./RReturns.txt, header = TRUE)

myData - c(factors,returns)

# This is our system of equations.

mySys - list(mu1  = USDEUR ~ USDRATE + tag(USDYC, USDYC)+ USDCC + EURRATE
+ EURYC + EURLY, 
mu2  = USDGBP ~ USDRATE + tag(USDYC, USDYC) + USDCC + GBPRATE + GBPYC 
+
GBPLY,
mu3  = USDCHF ~ USDRATE + tag(USDYC, USDYC) + USDCC + CHFRATE + CHFYC 
+
CHFLY,
mu4  = USDSEK ~ USDRATE + tag(USDYC, USDYC) + USDCC + SEKRATE + SEKYC 
+
SEKLY,
mu5  = USDNOK ~ USDRATE + tag(USDYC, USDYC) + USDCC + NOKRATE + NOKYC 
+
NOKLY,
mu6  = USDJPY ~ USDRATE + tag(USDYC, USDYC) + USDCC + JPYRATE + JPYYC 
+
JPYLY,
mu7  = USDSGD ~ USDRATE + tag(USDYC, USDYC) + USDCC + SGDRATE + SGDYC 
+
SGDLY,
mu8  = USDAUD ~ USDRATE + tag(USDYC, USDYC) + USDCC + AUDRATE + AUDYC 
+
AUDLY,
mu9  = USDCAD ~ USDRATE + tag(USDYC, USDYC) + USDCC + CADRATE + CADYC 
+
CADLY,
mu10 = USDNZD ~ USDRATE + tag(USDYC, USDYC) + USDCC + NZDRATE + NZDYC 
+
NZDLY)

# Here is our zelig function call.

z.out - zelig(mySys,sur, myData)

-- After this I am getting error:
Error in eval(expr, envir, enclos) : could not find function tag

there exists no info  (I could find anyways..) RE installing tag() seperate,
also tag should be able to be used for the SUR model...
Any help would be appreciated.
Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/Constraining-parameters-using-tag-in-SUR-model-ZELIG-tp4642927.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with spdep package issue with errorsarlm

2012-06-27 Thread Samantha Sifleet

   Hi List,
   I am hoping some of you have experience with the spdep package.

   I have had success with lm.morantest and lm.LMtests.

   I am trying to run a spatial error model and I keep getting the following
   error
   Error in res[i, listw$neighbours[[i]]] - listw$weights[[i]] :
 NAs are not allowed in subscripted assignments
   I think it has something to do with the fact that some of my polygons have
   no neighbors.  I built my spatial weight matrix using nearest neighbor = 5
   I then re tried building my spatial weight matrix using threshold distance
   and I get the following error
   Error in validObject(.Object) :
 invalid class âdgRMatrixâ object: all column indices must be between 0 and
   ncol-1
   despite using the zero.policy = TRUE and na.omit in the code it seems to be
   NAs mucking up the process
   Any tips are most appreciated.
   Thanks!
   ##my code:
   rm(list=ls())
   library(spdep)
   setwd(E:/weights)
   deer-read.csv(Deer_Appl_complete.txt, header = TRUE, skip = 1)
   summary(deer)
   deerwt-read.gwt2nb(Deer_Appl_complete.GWT)
   attach(deer)
   gwt_weights_deer-nb2listw(deerwt, style=W, zero.policy=TRUE)
   Deer_model_A-lm(APP_SQMI~SQRT_OAK_D+SQRT_PUBLI+DEER_RANGE+MEDIAN_DIS+ROAD_D
   MU+MEAN_HSI)
   summary(Deer_model_A)
   Deer_model_A.res-resid(Deer_model_A)
   Deer_model_A_moran-lm.morantest(Deer_model_A,gwt_weights_deer,
   zero.policy=TRUE, alternative=two.sided)
   Deer_model_A_Lagrange-lm.LMtests(Deer_model_A,  gwt_weights_deer,
   zero.policy=TRUE, test=all)
   SPER_Deer_Model_A-errorsarlm(APP_SQMI~SQRT_OAK_D+SQRT_PUBLI+DEER_RANGE+MEDI
   AN_DIS+ROAD_DMU+MEAN_HSI,data=deer,   gwt_weights_deer,   na.omit,
   zero.policy=TRUE)
   ##This is where it spits out
   Error in res[i, listw$neighbours[[i]]] - listw$weights[[i]] :
 NAs are not allowed in subscripted assignments
   #Then I tried using a threshold distance spatial weight matrix
   deerwt_dis-read.gwt2nb(Deer_Appl_distance.GWT)
   gwt_weights_dis-nb2listw(deerwt_dis, style=W, zero.policy=TRUE)
   SPER_Deer_Model_A-errorsarlm(APP_SQMI~SQRT_OAK_D+SQRT_PUBLI+DEER_RANGE+MEDI
   AN_DIS+ROAD_DMU+MEAN_HSI,data=deer,gwt_weights_dis,   na.omit,
   zero.policy=TRUE)
   ##This kicks out with the following error
   Error in validObject(.Object) :
 invalid class âdgRMatrixâ object: all column indices must be between 0 and
   ncol-1
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with spdep package issue with errorsarlm

2012-06-27 Thread Samantha Sifleet

   Hi List,
   I am hoping some of you have experience with the spdep package.
   I have had success with lm.morantest and lm.LMtests.
   I am trying to run a spatial error model and I keep getting the following
   error
   Error in res[i, listw$neighbours[[i]]] - listw$weights[[i]] :
 NAs are not allowed in subscripted assignments
   I think it has something to do with the fact that some of my polygons have
   no neighbors.  I built my spatial weight matrix using nearest neighbor = 5
   I then re tried building my spatial weight matrix using threshold distance
   and I get the following error
   Error in validObject(.Object) :
 invalid class âdgRMatrixâ object: all column indices must be between 0 and
   ncol-1
   despite using the zero.policy = TRUE and na.omit in the code it seems to be
   NAs mucking up the process
   Any tips are most appreciated.
   Thanks!
   ##my code:
   rm(list=ls())
   library(spdep)
   setwd(E:/weights)
   deer-read.csv(Deer_Appl_complete.txt, header = TRUE, skip = 1)
   summary(deer)
   deerwt-read.gwt2nb(Deer_Appl_complete.GWT)
   attach(deer)
   gwt_weights_deer-nb2listw(deerwt, style=W, zero.policy=TRUE)
   Deer_model_A-lm(APP_SQMI~SQRT_OAK_D+SQRT_PUBLI+DEER_RANGE+MEDIAN_DIS+ROAD_D
   MU+MEAN_HSI)
   summary(Deer_model_A)
   Deer_model_A.res-resid(Deer_model_A)
   Deer_model_A_moran-lm.morantest(Deer_model_A,gwt_weights_deer,
   zero.policy=TRUE, alternative=two.sided)
   Deer_model_A_Lagrange-lm.LMtests(Deer_model_A,  gwt_weights_deer,
   zero.policy=TRUE, test=all)
   SPER_Deer_Model_A-errorsarlm(APP_SQMI~SQRT_OAK_D+SQRT_PUBLI+DEER_RANGE+MEDI
   AN_DIS+ROAD_DMU+MEAN_HSI,data=deer,   gwt_weights_deer,   na.omit,
   zero.policy=TRUE)
   ##This is where it spits out
   Error in res[i, listw$neighbours[[i]]] - listw$weights[[i]] :
 NAs are not allowed in subscripted assignments
   #Then I tried using a threshold distance spatial weight matrix
   deerwt_dis-read.gwt2nb(Deer_Appl_distance.GWT)
   gwt_weights_dis-nb2listw(deerwt_dis, style=W, zero.policy=TRUE)
   SPER_Deer_Model_A-errorsarlm(APP_SQMI~SQRT_OAK_D+SQRT_PUBLI+DEER_RANGE+MEDI
   AN_DIS+ROAD_DMU+MEAN_HSI,data=deer,gwt_weights_dis,   na.omit,
   zero.policy=TRUE)
   ##This kicks out with the following error
   Error in validObject(.Object) :
 invalid class âdgRMatrixâ object: all column indices must be between 0 and
   ncol-1
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Why is my data always imported as a list?

2012-06-11 Thread Samantha Sifleet
Hi,

I am a relatively new to R. So, this is probably a really basic issue that 
I keep hitting.

I read my data into R using the read.csv command:

x = rep(numeric, 3)
CB_un=read.csv(Corn_Belt_unirr.csv, header=TRUE, colClasses=c(factor, 
x))

# I have clearly told R that I have one factor variable and 3 numeric 
variables in this table.
#but if I try to do anything with them, I get an error

boxplot(CB_un[Value]~CB_un[State.Fips])

Error in model.frame.default(formula = CB_un[Value] ~ 
CB_un[State.Fips]) : 
  invalid type (list) for variable 'CB_un[Value]'

# Because  these variables are all stored as lists.
#So, I have to unpack them. 

CB_unirr_rent-as.numeric(unlist(CB_un[Value]))
CB_unirr_State-as.factor(unlist(CB_un[State.Fips]))

#before I can do anything with them

boxplot(CB_unirr_rent~CB_unirr_State)

Is there a reason my data is always imported as lists?  Is there a way to 
skip this upacking step?

Thanks,

Sam
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Replicate weights in R?

2012-05-11 Thread Samantha Tornello
Hello everyone! I am analyzing a public use dataset which has both basic
weights and replicated weights. I have found that only Stata seems to work
with replicate weights but I would rather use R. Does anyone know if R can
use replicate weights?

If this is possible, could someone share some links and/or code for
performing this action. Thank you for your time.

Samantha Tornello, M.A.
University of Virginia

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] PCA R

2012-03-15 Thread Samantha Allcock
Hello can anyone help,

I have been running the following script to obtain a PCA plot but the end 
result is rather disappointing as the points are very very small and there are 
no titles etc

geochemdata-read.csv(file.choose(),header=TRUE)

names(geochemdata)

library(vegan)

bstick-function(n, tot.var=1) rev(cumsum(tot.var/n:1)/n)

geopca-rda(geochemdata, scale=TRUE)

geopca

geopca$CA$eig/geopca$tot.chi

summary(geopca, scaling=2)

apply(scores(geopca, choices=1.6, display= species),
+   2,function(x) x/sd(x))

plot(geopca$CA$eig, type= o, col= red, xlab= PCA Axis,
ylab= Variance, main= Scree plot for the PCA of the Geochem Data)

bstick.env- bstick(19, tot.var=19) #must change number based on number in 
bstick model

bstick.env

geopca

plot(bstick.env, type=o, lty=dotted, ylim=range(bstick.env,
geopca$CA$eig), xlab=PCA Axis, ylab=Inertia,
main=Geochemical ITRAX Data: Bstick)

points(geopca$CA$eig, type=o, col=red)

plot(geopca, scaling=2)

env.sc- scores(geopca)$species

plot(geopca, scaling=2)

arrows(0, 0, env.sc[,1]*0.85, env.sc[,2]*0.85,
col=red, length=0.05)

Does anyone know a more suitable code? I have also tried

eochemdata-read.csv(file.choose(),header=TRUE)

names(geochemdata)

fit - princomp(geochemdata, cor=TRUE)

summary(fit) # print variance accounted for

loadings(fit) # pc loadings

plot(fit) # scree plot

fit$scores # the principal components

write.csv(fit$scores, file=trial.csv) # export output of PCA

which does work but again I cannot seem to adjust the output. All the titles 
become squashed/un-readable and the points are in text format rather than 
appear as mere dots. Is there code to allow the user to move things about as 
they so wish and set their own style? I have used all the online suggestions 
but they keep coming back with error comments.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Sorting DataFrames

2011-06-07 Thread Cox, Samantha Lucy
I am a new user, and i am trying to sort out a data frame.



I have for example bins of data.  Within each bin i have multiple counts of 
animals and the depths at which these count were taken.  How would I summarise 
this to being only the maximum count per bin alongisde the corresponding height 
(but not the maximum depth - i want the depth at which the maximum number of 
animals occurs).



Thank you

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] invalid 'row.names' length error when running scatterplots or plot in R Commander

2010-09-22 Thread Samantha McKenzie
Thank you everyone for your helpful feedback. 

To clarify a few things that people have been asking:
Part of the problem comes from the fact that these are external
students, so our conversations are over email and I'm not there to try
things.

I admit my shortcomings when it comes to R script writing. We use R
Commander only in the course and play around with script within the
Script Window when needed. I am realizing that R Commander can do things
slightly differently to R itself. 

Scatterplot is a function within R commander and it sounds like it isn't
a function in R itself--plot does the same thing. The error message that
they received is the entire error message that R Commander produces. 

This dataset is one of ours and does not come from an R package. The
problem happens on any dataset whether it is read from an .rda or .csv
file.

I've used these datasets with Rcmdr over the last year and several
hundred students without problem before now.

I don't teach attach() to the students, but had these two use it in this
instance because Rcmdr wasn't recognizing dataset$variable.
plot(Calf~Bicep, data=Mass) will also work.

The students can correctly run stats using the data and the appropriate
variables are present, etc, suggesting that the data are being read in
OK.

I will get the students to run the code in R itself to see if that works
and also push for full output including str(), ls(), sessionInfo(),
traceback() etc from the students and will report back.

Cheers,
Sam


-Original Message-
From: Dejian Zhao [mailto:dejian.z...@gmail.com] 
Sent: Monday, 20 September 2010 5:32 PM
To: r-help@r-project.org
Cc: Samantha McKenzie
Subject: Re: [R] invalid 'row.names' length error when running
scatterplots or plot in R Commander

  I did not reproduce the error either, because I failed to find the 
function scattperplot in your script. :D  I suggest that you check 
whether they read the data into R correctly.

On 2010-9-20 10:00, Samantha McKenzie wrote:
 Hello,
 I teach statistics and use R Commander for teaching. I have 2 students
 out of 169 that can't get scatterplots or plot to work. I have had
them
 update packages, restart R/R Commander/their computers and even
 reinstall R/R Commander. One is using Windows 7 on a new pc and the
 other is a pc user (not sure the OS). They are both using R2.11.1 and
R
 Commander 1.6-0.

 The data look like this:
 Mass
 Mass Fore Bicep Chest Neck Shoulder Waist Height Calf Thigh Head
 1  77.0 28.5  33.5 100.0 38.5114.0  85.0  178.0 37.5  53.0 58.0
 2  85.5 29.5  36.5 107.0 39.0119.0  90.5  187.0 40.0  52.0 59.0
 3  63.0 25.0  31.0  94.0 36.5102.0  80.5  175.0 33.0  49.0 57.0
 4  80.5 28.5  34.0 104.0 39.0114.0  91.5  183.0 38.0  50.0 60.0
 5  79.5 28.5  36.5 107.0 39.0114.0  92.0  174.0 40.0  53.0 59.0
 6  94.0 30.5  38.0 112.0 39.0121.0 101.0  180.0 39.5  57.5 59.0
 7  66.0 26.5  29.0  93.0 35.0105.0  76.0  177.5 38.5  50.0 58.5
 8  69.0 27.0  31.0  95.0 37.0108.0  84.0  182.5 36.0  49.0 60.0
 9  65.0 26.5  29.0  93.0 35.0112.0  74.0  178.5 34.0  47.0 55.5
 10 58.0 26.5  31.0  96.0 35.0103.0  76.0  168.5 35.0  46.0 58.0


 This script:
 scatterplot(Calf~Bicep, reg.line=lm, smooth=FALSE, spread=FALSE,
 +   boxplots=FALSE, span=0.5, data=Mass)

 Produces this error:
 invalid 'row.names' length

 The data look fine and correlation/regression can be done on them with
 correct output. Just not scatterplots.

 I tried a work around using the following script, but still with the
 same result:
 attach(Mass)
 Mass
 str(Mass)
 names(Mass)
 plot(Calf~Bicep)
 abline(lm(Calf~Bicep))

 I cannot repeat the error, nor have I found much information on that
 error message, and I'm a bit stumped why these two students are
getting
 the error even after one has reinstalled the program.

 Cheers,
 Sam McKenzie
 The University of Queensland

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] invalid 'row.names' length error when running scatterplots or plot in R Commander

2010-09-19 Thread Samantha McKenzie
Hello,
I teach statistics and use R Commander for teaching. I have 2 students
out of 169 that can't get scatterplots or plot to work. I have had them
update packages, restart R/R Commander/their computers and even
reinstall R/R Commander. One is using Windows 7 on a new pc and the
other is a pc user (not sure the OS). They are both using R2.11.1 and R
Commander 1.6-0. 

The data look like this:
 Mass
   Mass Fore Bicep Chest Neck Shoulder Waist Height Calf Thigh Head
1  77.0 28.5  33.5 100.0 38.5114.0  85.0  178.0 37.5  53.0 58.0
2  85.5 29.5  36.5 107.0 39.0119.0  90.5  187.0 40.0  52.0 59.0
3  63.0 25.0  31.0  94.0 36.5102.0  80.5  175.0 33.0  49.0 57.0
4  80.5 28.5  34.0 104.0 39.0114.0  91.5  183.0 38.0  50.0 60.0
5  79.5 28.5  36.5 107.0 39.0114.0  92.0  174.0 40.0  53.0 59.0
6  94.0 30.5  38.0 112.0 39.0121.0 101.0  180.0 39.5  57.5 59.0
7  66.0 26.5  29.0  93.0 35.0105.0  76.0  177.5 38.5  50.0 58.5
8  69.0 27.0  31.0  95.0 37.0108.0  84.0  182.5 36.0  49.0 60.0
9  65.0 26.5  29.0  93.0 35.0112.0  74.0  178.5 34.0  47.0 55.5
10 58.0 26.5  31.0  96.0 35.0103.0  76.0  168.5 35.0  46.0 58.0


This script:
 scatterplot(Calf~Bicep, reg.line=lm, smooth=FALSE, spread=FALSE, 
+   boxplots=FALSE, span=0.5, data=Mass)

Produces this error:
invalid 'row.names' length

The data look fine and correlation/regression can be done on them with
correct output. Just not scatterplots. 

I tried a work around using the following script, but still with the
same result:
attach(Mass)
Mass 
str(Mass)
names(Mass)
plot(Calf~Bicep)
abline(lm(Calf~Bicep))

I cannot repeat the error, nor have I found much information on that
error message, and I'm a bit stumped why these two students are getting
the error even after one has reinstalled the program.

Cheers,
Sam McKenzie 
The University of Queensland 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Random slopes in lmer

2010-08-26 Thread Samantha Patrick
Hi

I want to extract the random slopes from a lmer (I am doing a random 
regression), but are the answers obtained from ranef or coef?

My model is: mod1-lmer(B~ A +(A|bird), family=quasibinomial)

And I want to obtain a slope for each individual bird but am not sure which 
output I need and can't find the answer anywhere.

Thanks

Sam


Dr Samantha Patrick
EU INTERREG Post Doc
Davy 618
Marine Biology  Ecology Research Centre
University of Plymouth
Plymouth
PL4 8AA

T: 01752 586165
M: 07740472719


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Random slopes in lmer

2010-08-26 Thread Samantha Patrick
Hi 
Thanks for your help - however if I have a model of:

mod1-lmer(B~ A+C+(A|bird), family=quasibinomial) 

coef then gives me an individual slope for factors A and C.  However the random 
effect is only nested within factor - so I am only trying to allow the slope to 
vary in relation to effect A

Many Thanks

Sam

Dr Samantha Patrick
EU INTERREG Post Doc
Davy 618
Marine Biology  Ecology Research Centre
University of Plymouth 
Plymouth
PL4 8AA

T: 01752 586165 
M: 07740472719


-Original Message-
From: Darin A. England [mailto:engl...@cs.umn.edu] 
Sent: 26 August 2010 16:12
To: Samantha Patrick
Cc: r-help@R-project.org
Subject: Re: [R] Random slopes in lmer

coef(mod1)$bird will give you a matrix with two columns. The first
column is the intercept for each bird and the second column is the
slope for each bird.

ranef(mod1) will also give you a matrix of two columns. These
represent the random effects. That is, how much the intercept (or
slope) is shifted from overall mean.

HTH,
Darin

On Thu, Aug 26, 2010 at 01:15:10PM +0100, Samantha Patrick wrote:
 Hi
 
 I want to extract the random slopes from a lmer (I am doing a random 
 regression), but are the answers obtained from ranef or coef?
 
 My model is: mod1-lmer(B~ A +(A|bird), family=quasibinomial)
 
 And I want to obtain a slope for each individual bird but am not sure which 
 output I need and can't find the answer anywhere.
 
 Thanks
 
 Sam
 
 
 Dr Samantha Patrick
 EU INTERREG Post Doc
 Davy 618
 Marine Biology  Ecology Research Centre
 University of Plymouth
 Plymouth
 PL4 8AA
 
 T: 01752 586165
 M: 07740472719
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Unequal variance ANOVA using gls function in nlme

2010-08-14 Thread Samantha Patrick
Hi

I am trying to run an ANOVA on data with unequal variance.  I am new to nlme, 
but to my understanding I need to use the gls function.  I have single response 
variable (distance which is continuous) and the explanatory variable is 
individual ID (class variable: individuals differ in the variance in their 
distance values hence the need to using nlme).

So I would create a model Distance~Individual ID and then create a variance 
structure to add to the model.  However the variance structure is not a linear 
relationship, it is simply a series of variances linked to individual ID.  Can 
anyone guide me as to how to fit this into the model?  As the model is very 
simple, I think that the variance is the only component I need to estimate for 
the model, but perhaps I am mistaken?

Thanks

Sam


Dr Samantha Patrick
EU INTERREG Post Doc
Davy 618
Marine Biology  Ecology Research Centre
University of Plymouth
Plymouth
PL4 8AA

T: 01752 584699
M: 07740472719


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] variance-covariance matrix of mlest in library(mvnmle)

2010-05-26 Thread Samantha

How does mlest generate the estimate for sigmahat, the variance-covariance
matrix?  It produces different  values than when using cov(data.frame).
-- 
View this message in context: 
http://r.789695.n4.nabble.com/variance-covariance-matrix-of-mlest-in-library-mvnmle-tp2232127p2232127.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] error bars on barplot

2010-04-09 Thread Samantha Reynolds
Hi

I was hoping someone might be able to help me I have this data:

birdid timetaken numvisits ptachchoice time bold
   1087 810   1   AM0
   108728 6   1   PM0
   108713 3   2   AM0
   1087   121 0   2   PM0
   1046   121 0   1   AM1
   1046   121 0   1   PM1

i've plotted the means like this:

by(numvisits,patchchoice,summary)
numvisits.means- 
by(numvisits,list(time=time,patchchoice=patchchoice),mean)
numvisits.means
barplot(numvisits.means,xlab=Patch Choice,ylab=Number of  
Visits,col=c(red,darkblue),beside=T,ylim=c(0,4))
labs-c(AM,PM)
legend(1.09,3.98,labs,fill=cols)

and need to add error bars, but i'm unsure as to how to do this.

Thanks

Sam
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Creating two lines of best fit on a scatter plot

2010-04-07 Thread Samantha Reynolds

Hello

I am trying to plot two lines of best fit on a scatter plot.

I'm plotting number of visits (y) against personality (x), half the  
plots are blue for patchchoice  one and the other plots are red for  
patchchoice two (these options come from one factor, see below) . So i  
need a line for the patch ones and another line for the patch twos.  
How would i go about doing this? I know i may need to use the subset  
command, but I'm not entirely sure how to do this as I am relatively  
new to R


example of data
birdid timetaken numvisits ptachchoice time bold
1087 810   1   AM0
108728 6   1   PM0
108713 3   2   AM0
1087   121 0   2   PM0
1046   121 0   1   AM1
1046   121 0   1   PM1


Thanks

Sam

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Creating two lines of best fit on a scatter plot

2010-04-07 Thread Samantha Reynolds

Hello

I am trying to plot two lines of best fit on a scatter plot.

I'm plotting number of visits (y) against personality (x), half the  
plots are blue for patchchoice  one and the other plots are red for  
patchchoice two (these options come from one factor, see below) . So i  
need a line for the patch ones and another line for the patch twos.  
How would i go about doing this? I know i may need to use the subset  
command, but I'm not entirely sure how to do this as I am relatively  
new to R


example of data
 birdid timetaken numvisits ptachchoice time bold
 1087 810   1   AM0
 108728 6   1   PM0
 108713 3   2   AM0
 1087   121 0   2   PM0
 1046   121 0   1   AM1
 1046   121 0   1   PM1


Thanks

Sam

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] cluster analysis labels for dendrogram

2010-03-10 Thread Samantha

Hi,

I am clustering data based on three numeric variables.  I have a fourth
variable that is categorical (site) which I would like to use to label the
leaves of my dendrogram, so I can see how the different sites are grouped
throughout the tree, but I do NOT want to use this variable in the cluster
analysis itself.  Is there any way I can do this?

Thanks,
Samantha
-- 
View this message in context: 
http://n4.nabble.com/cluster-analysis-labels-for-dendrogram-tp1588347p1588347.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.